Merge
authorprr
Mon, 05 May 2014 12:49:13 -0700
changeset 24547 1b3cb0c1ac87
parent 24546 3d338c477e50 (current diff)
parent 24256 da9a41004459 (diff)
child 24548 9c007a986347
Merge
hotspot/test/runtime/6925573/SortMethodsTest.java
jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java
jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java
jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java
jdk/make/lib/Awt2dLibraries.gmk
--- a/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -253,3 +253,4 @@
 b47e021195757f8f45582124ea7cad48ccf5f872 jdk9-b08
 efe7dbc6088691757404e0c8745f894e3ca9c022 jdk9-b09
 8c0bdeecd7c0f9ce3f3762a51991f755cb3a972c jdk9-b10
+0809c9a4d36e6291f1c4384604c4bbf29e975722 jdk9-b11
--- a/.hgtags-top-repo	Mon May 05 09:41:41 2014 -0700
+++ b/.hgtags-top-repo	Mon May 05 12:49:13 2014 -0700
@@ -253,3 +253,4 @@
 db045d8faa0924b7378102d24a1a0d850c1e3834 jdk9-b08
 4a21dc7d57d1069a01f68e7182c074cb37349dfb jdk9-b09
 fa13f2b926f8426876ec03e7903f3ee0ee150f2e jdk9-b10
+ab55a18a95e1990a588929d5d29db3eb9985fea0 jdk9-b11
--- a/common/autoconf/generated-configure.sh	Mon May 05 09:41:41 2014 -0700
+++ b/common/autoconf/generated-configure.sh	Mon May 05 12:49:13 2014 -0700
@@ -4243,7 +4243,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1398196583
+DATE_WHEN_GENERATED=1398861894
 
 ###############################################################################
 #
@@ -43505,9 +43505,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -44093,9 +44094,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -44395,9 +44397,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -44688,9 +44691,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -44981,9 +44985,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -45275,9 +45280,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -45570,9 +45576,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -45861,9 +45868,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
@@ -46152,9 +46160,10 @@
 $as_echo "$as_me: Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location." >&6;}
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
--- a/common/autoconf/libraries.m4	Mon May 05 09:41:41 2014 -0700
+++ b/common/autoconf/libraries.m4	Mon May 05 12:49:13 2014 -0700
@@ -286,9 +286,10 @@
           AC_MSG_NOTICE([Could not find $POTENTIAL_FREETYPE_LIB_PATH/freetype.lib. Ignoring location.])
           FOUND_FREETYPE=no
         fi
-      elif test "x$OPENJDK_TARGET_OS" = xsolaris && test "x$OPENJDK_TARGET_CPU" = xx86_64 && test -s "$POTENTIAL_FREETYPE_LIB_PATH/amd64/$FREETYPE_LIB_NAME"; then
-        # On solaris-x86_86, default is (normally) PATH/lib/amd64. Update our guess!
-        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH/amd64"
+      elif test "x$OPENJDK_TARGET_OS" = xsolaris \
+          && test -s "$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR/$FREETYPE_LIB_NAME"; then
+        # Found lib in isa dir, use that instead.
+        POTENTIAL_FREETYPE_LIB_PATH="$POTENTIAL_FREETYPE_LIB_PATH$OPENJDK_TARGET_CPU_ISADIR"
       fi
     fi
   fi
--- a/corba/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/corba/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -253,3 +253,4 @@
 2da7fead826bc27f193c7d63048c2cf100a8809c jdk9-b08
 1a3a4f48515dbf1cff37279691b2fb74f228298d jdk9-b09
 3bd4039dfc632fd7fc8418a25a3dcc34d1cd4019 jdk9-b10
+77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
--- a/hotspot/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -413,3 +413,4 @@
 4dedef5e51ed3a36677a8ba82949fc517ad64162 jdk9-b08
 05e8f5242c26ba45d4fa947e4f4f54c058c9b522 jdk9-b09
 ebc44d040cd149d2120d69fe183a3dae7840f4b4 jdk9-b10
+783309c3a1a629a452673399dcfa83ef7eca94d8 jdk9-b11
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.cpp	Mon May 05 12:49:13 2014 -0700
@@ -2003,7 +2003,7 @@
       }
     } else {
       assert(MethodData::profile_return(), "either profile call args or call ret");
-      update_mdp_by_constant(in_bytes(ReturnTypeEntry::size()));
+      update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size()));
     }
 
     // mdp points right after the end of the
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.cpp	Mon May 05 12:49:13 2014 -0700
@@ -137,7 +137,7 @@
       movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp);
     } else {
       assert(MethodData::profile_return(), "either profile call args or call ret");
-      update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size()));
+      update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size()));
     }
 
     // mdp points right after the end of the
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Mon May 05 12:49:13 2014 -0700
@@ -3188,8 +3188,8 @@
 #ifdef ASSERT
       Bytecodes::Code code = x->method()->raw_code_at_bci(x->bci_of_invoke());
       int n = x->nb_profiled_args();
-      assert(MethodData::profile_parameters() && x->inlined() &&
-             ((code == Bytecodes::_invokedynamic && n <= 1) || (code == Bytecodes::_invokehandle && n <= 2)),
+      assert(MethodData::profile_parameters() && (MethodData::profile_arguments_jsr292_only() ||
+                                                  (x->inlined() && ((code == Bytecodes::_invokedynamic && n <= 1) || (code == Bytecodes::_invokehandle && n <= 2)))),
              "only at JSR292 bytecodes");
 #endif
     }
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon May 05 12:49:13 2014 -0700
@@ -2831,7 +2831,6 @@
     }
   }
 
-  assert(operand_fill_index == operands->length(), "exact fill");
   assert(ConstantPool::operand_array_length(operands) == attribute_array_length, "correct decode");
 
   u1* current_end = cfs->current();
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Mon May 05 12:49:13 2014 -0700
@@ -564,11 +564,11 @@
                       "--------------------------------\n");
   size_t total_size = totalSizeInIndexedFreeLists();
   size_t   free_blocks = numFreeBlocksInIndexedFreeLists();
-  gclog_or_tty->print("Total Free Space: %d\n", total_size);
-  gclog_or_tty->print("Max   Chunk Size: %d\n", maxChunkSizeInIndexedFreeLists());
-  gclog_or_tty->print("Number of Blocks: %d\n", free_blocks);
+  gclog_or_tty->print("Total Free Space: " SIZE_FORMAT "\n", total_size);
+  gclog_or_tty->print("Max   Chunk Size: " SIZE_FORMAT "\n", maxChunkSizeInIndexedFreeLists());
+  gclog_or_tty->print("Number of Blocks: " SIZE_FORMAT "\n", free_blocks);
   if (free_blocks != 0) {
-    gclog_or_tty->print("Av.  Block  Size: %d\n", total_size/free_blocks);
+    gclog_or_tty->print("Av.  Block  Size: " SIZE_FORMAT "\n", total_size/free_blocks);
   }
 }
 
@@ -2152,7 +2152,7 @@
   for (i = IndexSetStart; i < IndexSetSize; i += IndexSetStride) {
     AdaptiveFreeList<FreeChunk>* fl    = &_indexedFreeList[i];
     if (PrintFLSStatistics > 1) {
-      gclog_or_tty->print("size[%d] : ", i);
+      gclog_or_tty->print("size[" SIZE_FORMAT "] : ", i);
     }
     fl->compute_desired(inter_sweep_current, inter_sweep_estimate, intra_sweep_estimate);
     fl->set_coal_desired((ssize_t)((double)fl->desired() * CMSSmallCoalSurplusPercent));
@@ -2683,7 +2683,8 @@
       _global_num_workers[i] = 0;
       _global_num_blocks[i] = 0;
       if (PrintOldPLAB) {
-        gclog_or_tty->print_cr("[%d]: %d", i, (size_t)_blocks_to_claim[i].average());
+        gclog_or_tty->print_cr("[" SIZE_FORMAT "]: " SIZE_FORMAT,
+                               i, (size_t)_blocks_to_claim[i].average());
       }
     }
   }
@@ -2722,7 +2723,7 @@
         }
       }
       if (PrintOldPLAB) {
-        gclog_or_tty->print_cr("%d[%d]: %d/%d/%d",
+        gclog_or_tty->print_cr("%d[" SIZE_FORMAT "]: " SIZE_FORMAT "/" SIZE_FORMAT "/" SIZE_FORMAT,
                                tid, i, num_retire, _num_blocks[i], (size_t)_blocks_to_claim[i].average());
       }
       // Reset stats for next round
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon May 05 12:49:13 2014 -0700
@@ -1512,6 +1512,8 @@
     gclog_or_tty->print_cr("cms_allocation_rate=%g", stats().cms_allocation_rate());
     gclog_or_tty->print_cr("occupancy=%3.7f", _cmsGen->occupancy());
     gclog_or_tty->print_cr("initiatingOccupancy=%3.7f", _cmsGen->initiating_occupancy());
+    gclog_or_tty->print_cr("cms_time_since_begin=%3.7f", stats().cms_time_since_begin());
+    gclog_or_tty->print_cr("cms_time_since_end=%3.7f", stats().cms_time_since_end());
     gclog_or_tty->print_cr("metadata initialized %d",
       MetaspaceGC::should_concurrent_collect());
   }
@@ -1574,6 +1576,28 @@
       return true;
     }
 
+  // CMSTriggerInterval starts a CMS cycle if enough time has passed.
+  if (CMSTriggerInterval >= 0) {
+    if (CMSTriggerInterval == 0) {
+      // Trigger always
+      return true;
+    }
+
+    // Check the CMS time since begin (we do not check the stats validity
+    // as we want to be able to trigger the first CMS cycle as well)
+    if (stats().cms_time_since_begin() >= (CMSTriggerInterval / ((double) MILLIUNITS))) {
+      if (Verbose && PrintGCDetails) {
+        if (stats().valid()) {
+          gclog_or_tty->print_cr("CMSCollector: collect because of trigger interval (time since last begin %3.7f secs)",
+                                 stats().cms_time_since_begin());
+        } else {
+          gclog_or_tty->print_cr("CMSCollector: collect because of trigger interval (first collection)");
+        }
+      }
+      return true;
+    }
+  }
+
   return false;
 }
 
@@ -2894,13 +2918,13 @@
 
   // Clear the marking bit map array before starting, but, just
   // for kicks, first report if the given address is already marked
-  gclog_or_tty->print_cr("Start: Address 0x%x is%s marked", addr,
+  gclog_or_tty->print_cr("Start: Address " PTR_FORMAT " is%s marked", addr,
                 _markBitMap.isMarked(addr) ? "" : " not");
 
   if (verify_after_remark()) {
     MutexLockerEx x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
     bool result = verification_mark_bm()->isMarked(addr);
-    gclog_or_tty->print_cr("TransitiveMark: Address 0x%x %s marked", addr,
+    gclog_or_tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", addr,
                            result ? "IS" : "is NOT");
     return result;
   } else {
@@ -4569,7 +4593,7 @@
       }
     }
     if (PrintCMSStatistics > 0) {
-      gclog_or_tty->print(" [%d iterations, %d waits, %d cards)] ",
+      gclog_or_tty->print(" [" SIZE_FORMAT " iterations, " SIZE_FORMAT " waits, " SIZE_FORMAT " cards)] ",
                           loops, waited, cumworkdone);
     }
   }
@@ -4721,7 +4745,7 @@
        numIter++, lastNumCards = curNumCards, cumNumCards += curNumCards) {
     curNumCards  = preclean_mod_union_table(_cmsGen, &smoac_cl);
     if (Verbose && PrintGCDetails) {
-      gclog_or_tty->print(" (modUnionTable: %d cards)", curNumCards);
+      gclog_or_tty->print(" (modUnionTable: " SIZE_FORMAT " cards)", curNumCards);
     }
     // Either there are very few dirty cards, so re-mark
     // pause will be small anyway, or our pre-cleaning isn't
@@ -4743,7 +4767,7 @@
   curNumCards = preclean_card_table(_cmsGen, &smoac_cl);
   cumNumCards += curNumCards;
   if (PrintGCDetails && PrintCMSStatistics != 0) {
-    gclog_or_tty->print_cr(" (cardTable: %d cards, re-scanned %d cards, %d iterations)",
+    gclog_or_tty->print_cr(" (cardTable: " SIZE_FORMAT " cards, re-scanned " SIZE_FORMAT " cards, " SIZE_FORMAT " iterations)",
                   curNumCards, cumNumCards, numIter);
   }
   return cumNumCards;   // as a measure of useful work done
@@ -8205,7 +8229,7 @@
 void SweepClosure::initialize_free_range(HeapWord* freeFinger,
     bool freeRangeInFreeLists) {
   if (CMSTraceSweeper) {
-    gclog_or_tty->print("---- Start free range at 0x%x with free block (%d)\n",
+    gclog_or_tty->print("---- Start free range at " PTR_FORMAT " with free block (%d)\n",
                freeFinger, freeRangeInFreeLists);
   }
   assert(!inFreeRange(), "Trampling existing free range");
@@ -8275,10 +8299,10 @@
                            pointer_delta(addr, freeFinger()));
       if (CMSTraceSweeper) {
         gclog_or_tty->print("Sweep: last chunk: ");
-        gclog_or_tty->print("put_free_blk 0x%x ("SIZE_FORMAT") "
-                   "[coalesced:"SIZE_FORMAT"]\n",
+        gclog_or_tty->print("put_free_blk " PTR_FORMAT " ("SIZE_FORMAT") "
+                   "[coalesced:%d]\n",
                    freeFinger(), pointer_delta(addr, freeFinger()),
-                   lastFreeRangeCoalesced());
+                   lastFreeRangeCoalesced() ? 1 : 0);
       }
     }
 
@@ -8421,7 +8445,7 @@
         // the midst of a free range, we are coalescing
         print_free_block_coalesced(fc);
         if (CMSTraceSweeper) {
-          gclog_or_tty->print("  -- pick up free block 0x%x (%d)\n", fc, size);
+          gclog_or_tty->print("  -- pick up free block " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size);
         }
         // remove it from the free lists
         _sp->removeFreeChunkFromFreeLists(fc);
@@ -8483,7 +8507,7 @@
       // this will be swept up when we hit the end of the
       // free range
       if (CMSTraceSweeper) {
-        gclog_or_tty->print("  -- pick up garbage 0x%x (%d) \n", fc, size);
+        gclog_or_tty->print("  -- pick up garbage " PTR_FORMAT " (" SIZE_FORMAT ")\n", fc, size);
       }
       // If the chunk is being coalesced and the current free range is
       // in the free lists, remove the current free range so that it
@@ -8576,7 +8600,7 @@
   }
 
   if (CMSTraceSweeper) {
-    gclog_or_tty->print_cr("  -- pick up another chunk at 0x%x (%d)", fc, chunkSize);
+    gclog_or_tty->print_cr("  -- pick up another chunk at " PTR_FORMAT " (" SIZE_FORMAT ")", fc, chunkSize);
   }
 
   HeapWord* const fc_addr = (HeapWord*) fc;
@@ -8705,7 +8729,7 @@
         "chunk should not be in free lists yet");
     }
     if (CMSTraceSweeper) {
-      gclog_or_tty->print_cr(" -- add free block 0x%x (%d) to free lists",
+      gclog_or_tty->print_cr(" -- add free block " PTR_FORMAT " (" SIZE_FORMAT ") to free lists",
                     chunk, size);
     }
     // A new free range is going to be starting.  The current
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/promotionInfo.cpp	Mon May 05 12:49:13 2014 -0700
@@ -265,7 +265,7 @@
     slots += _spoolHead->bufferSize - 1;
     blocks++;
   }
-  gclog_or_tty->print_cr(" [worker %d] promo_blocks = %d, promo_slots = %d ",
+  gclog_or_tty->print_cr(" [worker %d] promo_blocks = " SIZE_FORMAT ", promo_slots = " SIZE_FORMAT,
                          worker_id, blocks, slots);
 }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp	Mon May 05 12:49:13 2014 -0700
@@ -29,7 +29,7 @@
 #include "gc_implementation/g1/g1HotCardCache.hpp"
 #include "runtime/java.hpp"
 
-ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) :
+ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure) :
   _threads(NULL), _n_threads(0),
   _hot_card_cache(g1h)
 {
@@ -61,7 +61,7 @@
 
   ConcurrentG1RefineThread *next = NULL;
   for (uint i = _n_threads - 1; i != UINT_MAX; i--) {
-    ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, worker_id_offset, i);
+    ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, refine_closure, worker_id_offset, i);
     assert(t != NULL, "Conc refine should have been created");
     if (t->osthread() == NULL) {
         vm_shutdown_during_initialization("Could not create ConcurrentG1RefineThread");
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.hpp	Mon May 05 12:49:13 2014 -0700
@@ -71,7 +71,7 @@
   void reset_threshold_step();
 
  public:
-  ConcurrentG1Refine(G1CollectedHeap* g1h);
+  ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure);
   ~ConcurrentG1Refine();
 
   void init(); // Accomplish some initialization that has to wait.
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp	Mon May 05 12:49:13 2014 -0700
@@ -33,8 +33,10 @@
 
 ConcurrentG1RefineThread::
 ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread *next,
+                         CardTableEntryClosure* refine_closure,
                          uint worker_id_offset, uint worker_id) :
   ConcurrentGCThread(),
+  _refine_closure(refine_closure),
   _worker_id_offset(worker_id_offset),
   _worker_id(worker_id),
   _active(false),
@@ -71,6 +73,7 @@
 }
 
 void ConcurrentG1RefineThread::sample_young_list_rs_lengths() {
+  SuspendibleThreadSetJoiner sts;
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   G1CollectorPolicy* g1p = g1h->g1_policy();
   if (g1p->adaptive_young_list_length()) {
@@ -82,8 +85,8 @@
 
       // we try to yield every time we visit 10 regions
       if (regions_visited == 10) {
-        if (_sts.should_yield()) {
-          _sts.yield("G1 refine");
+        if (sts.should_yield()) {
+          sts.yield();
           // we just abandon the iteration
           break;
         }
@@ -99,9 +102,7 @@
   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
   _vtime_start = os::elapsedVTime();
   while(!_should_terminate) {
-    _sts.join();
     sample_young_list_rs_lengths();
-    _sts.leave();
 
     if (os::supports_vtime()) {
       _vtime_accum = (os::elapsedVTime() - _vtime_start);
@@ -182,37 +183,37 @@
       break;
     }
 
-    _sts.join();
+    {
+      SuspendibleThreadSetJoiner sts;
+
+      do {
+        int curr_buffer_num = (int)dcqs.completed_buffers_num();
+        // If the number of the buffers falls down into the yellow zone,
+        // that means that the transition period after the evacuation pause has ended.
+        if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cg1r()->yellow_zone()) {
+          dcqs.set_completed_queue_padding(0);
+        }
 
-    do {
-      int curr_buffer_num = (int)dcqs.completed_buffers_num();
-      // If the number of the buffers falls down into the yellow zone,
-      // that means that the transition period after the evacuation pause has ended.
-      if (dcqs.completed_queue_padding() > 0 && curr_buffer_num <= cg1r()->yellow_zone()) {
-        dcqs.set_completed_queue_padding(0);
-      }
+        if (_worker_id > 0 && curr_buffer_num <= _deactivation_threshold) {
+          // If the number of the buffer has fallen below our threshold
+          // we should deactivate. The predecessor will reactivate this
+          // thread should the number of the buffers cross the threshold again.
+          deactivate();
+          break;
+        }
 
-      if (_worker_id > 0 && curr_buffer_num <= _deactivation_threshold) {
-        // If the number of the buffer has fallen below our threshold
-        // we should deactivate. The predecessor will reactivate this
-        // thread should the number of the buffers cross the threshold again.
+        // Check if we need to activate the next thread.
+        if (_next != NULL && !_next->is_active() && curr_buffer_num > _next->_threshold) {
+          _next->activate();
+        }
+      } while (dcqs.apply_closure_to_completed_buffer(_refine_closure, _worker_id + _worker_id_offset, cg1r()->green_zone()));
+
+      // We can exit the loop above while being active if there was a yield request.
+      if (is_active()) {
         deactivate();
-        break;
       }
-
-      // Check if we need to activate the next thread.
-      if (_next != NULL && !_next->is_active() && curr_buffer_num > _next->_threshold) {
-        _next->activate();
-      }
-    } while (dcqs.apply_closure_to_completed_buffer(_worker_id + _worker_id_offset, cg1r()->green_zone()));
-
-    // We can exit the loop above while being active if there was a yield request.
-    if (is_active()) {
-      deactivate();
     }
 
-    _sts.leave();
-
     if (os::supports_vtime()) {
       _vtime_accum = (os::elapsedVTime() - _vtime_start);
     } else {
@@ -223,17 +224,6 @@
   terminate();
 }
 
-
-void ConcurrentG1RefineThread::yield() {
-  if (G1TraceConcRefinement) {
-    gclog_or_tty->print_cr("G1-Refine-yield");
-  }
-  _sts.yield("G1 refine");
-  if (G1TraceConcRefinement) {
-    gclog_or_tty->print_cr("G1-Refine-yield-end");
-  }
-}
-
 void ConcurrentG1RefineThread::stop() {
   // it is ok to take late safepoints here, if needed
   {
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp	Mon May 05 12:49:13 2014 -0700
@@ -28,6 +28,7 @@
 #include "gc_implementation/shared/concurrentGCThread.hpp"
 
 // Forward Decl.
+class CardTableEntryClosure;
 class ConcurrentG1Refine;
 
 // The G1 Concurrent Refinement Thread (could be several in the future).
@@ -49,6 +50,9 @@
   Monitor* _monitor;
   ConcurrentG1Refine* _cg1r;
 
+  // The closure applied to completed log buffers.
+  CardTableEntryClosure* _refine_closure;
+
   int _thread_threshold_step;
   // This thread activation threshold
   int _threshold;
@@ -64,13 +68,11 @@
   void activate();
   void deactivate();
 
-  // For use by G1CollectedHeap, which is a friend.
-  static SuspendibleThreadSet* sts() { return &_sts; }
-
 public:
   virtual void run();
   // Constructor
   ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread* next,
+                           CardTableEntryClosure* refine_closure,
                            uint worker_id_offset, uint worker_id);
 
   void initialize();
@@ -84,8 +86,6 @@
 
   ConcurrentG1Refine* cg1r() { return _cg1r;     }
 
-  // Yield for GC
-  void yield();
   // shutdown
   void stop();
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Mon May 05 12:49:13 2014 -0700
@@ -976,11 +976,11 @@
   }
 
   if (concurrent()) {
-    ConcurrentGCThread::stsLeave();
+    SuspendibleThreadSet::leave();
   }
   _first_overflow_barrier_sync.enter();
   if (concurrent()) {
-    ConcurrentGCThread::stsJoin();
+    SuspendibleThreadSet::join();
   }
   // at this point everyone should have synced up and not be doing any
   // more work
@@ -1024,11 +1024,11 @@
   }
 
   if (concurrent()) {
-    ConcurrentGCThread::stsLeave();
+    SuspendibleThreadSet::leave();
   }
   _second_overflow_barrier_sync.enter();
   if (concurrent()) {
-    ConcurrentGCThread::stsJoin();
+    SuspendibleThreadSet::join();
   }
   // at this point everything should be re-initialized and ready to go
 
@@ -1076,7 +1076,7 @@
 
     double start_vtime = os::elapsedVTime();
 
-    ConcurrentGCThread::stsJoin();
+    SuspendibleThreadSet::join();
 
     assert(worker_id < _cm->active_tasks(), "invariant");
     CMTask* the_task = _cm->task(worker_id);
@@ -1103,9 +1103,9 @@
         if (!_cm->has_aborted() && the_task->has_aborted()) {
           sleep_time_ms =
             (jlong) (elapsed_vtime_sec * _cm->sleep_factor() * 1000.0);
-          ConcurrentGCThread::stsLeave();
+          SuspendibleThreadSet::leave();
           os::sleep(Thread::current(), sleep_time_ms, false);
-          ConcurrentGCThread::stsJoin();
+          SuspendibleThreadSet::join();
         }
         double end_time2_sec = os::elapsedTime();
         double elapsed_time2_sec = end_time2_sec - start_time_sec;
@@ -1123,7 +1123,7 @@
     the_task->record_end_time();
     guarantee(!the_task->has_aborted() || _cm->has_aborted(), "invariant");
 
-    ConcurrentGCThread::stsLeave();
+    SuspendibleThreadSet::leave();
 
     double end_vtime = os::elapsedVTime();
     _cm->update_accum_task_vtime(worker_id, end_vtime - start_vtime);
@@ -2655,7 +2655,6 @@
       str = " O";
     } else {
       HeapRegion* hr  = _g1h->heap_region_containing(obj);
-      guarantee(hr != NULL, "invariant");
       bool over_tams = _g1h->allocated_since_marking(obj, hr, _vo);
       bool marked = _g1h->is_marked(obj, _vo);
 
@@ -3302,21 +3301,17 @@
 
 // We take a break if someone is trying to stop the world.
 bool ConcurrentMark::do_yield_check(uint worker_id) {
-  if (should_yield()) {
+  if (SuspendibleThreadSet::should_yield()) {
     if (worker_id == 0) {
       _g1h->g1_policy()->record_concurrent_pause();
     }
-    cmThread()->yield();
+    SuspendibleThreadSet::yield();
     return true;
   } else {
     return false;
   }
 }
 
-bool ConcurrentMark::should_yield() {
-  return cmThread()->should_yield();
-}
-
 bool ConcurrentMark::containing_card_is_marked(void* p) {
   size_t offset = pointer_delta(p, _g1h->reserved_region().start(), 1);
   return _card_bm.at(offset >> CardTableModRefBS::card_shift);
@@ -3417,9 +3412,8 @@
 }
 
 void CMTask::setup_for_region(HeapRegion* hr) {
-  // Separated the asserts so that we know which one fires.
   assert(hr != NULL,
-        "claim_region() should have filtered out continues humongous regions");
+        "claim_region() should have filtered out NULL regions");
   assert(!hr->continuesHumongous(),
         "claim_region() should have filtered out continues humongous regions");
 
@@ -3605,7 +3599,7 @@
 #endif // _MARKING_STATS_
 
   // (4) We check whether we should yield. If we have to, then we abort.
-  if (_cm->should_yield()) {
+  if (SuspendibleThreadSet::should_yield()) {
     // We should yield. To do this we abort the task. The caller is
     // responsible for yielding.
     set_has_aborted();
@@ -3754,7 +3748,7 @@
 
   if (_task_queue->size() > target_size) {
     if (_cm->verbose_high()) {
-      gclog_or_tty->print_cr("[%u] draining local queue, target size = %d",
+      gclog_or_tty->print_cr("[%u] draining local queue, target size = " SIZE_FORMAT,
                              _worker_id, target_size);
     }
 
@@ -3782,7 +3776,7 @@
     }
 
     if (_cm->verbose_high()) {
-      gclog_or_tty->print_cr("[%u] drained local queue, size = %d",
+      gclog_or_tty->print_cr("[%u] drained local queue, size = %u",
                              _worker_id, _task_queue->size());
     }
   }
@@ -3810,7 +3804,7 @@
 
   if (_cm->mark_stack_size() > target_size) {
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%u] draining global_stack, target size %d",
+      gclog_or_tty->print_cr("[%u] draining global_stack, target size " SIZE_FORMAT,
                              _worker_id, target_size);
     }
 
@@ -3820,7 +3814,7 @@
     }
 
     if (_cm->verbose_low()) {
-      gclog_or_tty->print_cr("[%u] drained global stack, size = %d",
+      gclog_or_tty->print_cr("[%u] drained global stack, size = " SIZE_FORMAT,
                              _worker_id, _cm->mark_stack_size());
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Mon May 05 12:49:13 2014 -0700
@@ -814,7 +814,6 @@
   }
 
   inline bool do_yield_check(uint worker_i = 0);
-  inline bool should_yield();
 
   // Called to abort the marking cycle after a Full GC takes place.
   void abort();
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp	Mon May 05 12:49:13 2014 -0700
@@ -89,6 +89,10 @@
   while (!_should_terminate) {
     // wait until started is set.
     sleepBeforeNextCycle();
+    if (_should_terminate) {
+      break;
+    }
+
     {
       ResourceMark rm;
       HandleMark   hm;
@@ -190,9 +194,8 @@
       } else {
         // We don't want to update the marking status if a GC pause
         // is already underway.
-        _sts.join();
+        SuspendibleThreadSetJoiner sts;
         g1h->set_marking_complete();
-        _sts.leave();
       }
 
       // Check if cleanup set the free_regions_coming flag. If it
@@ -262,11 +265,12 @@
       // record_concurrent_mark_cleanup_completed() (and, in fact, it's
       // not needed any more as the concurrent mark state has been
       // already reset).
-      _sts.join();
-      if (!cm()->has_aborted()) {
-        g1_policy->record_concurrent_mark_cleanup_completed();
+      {
+        SuspendibleThreadSetJoiner sts;
+        if (!cm()->has_aborted()) {
+          g1_policy->record_concurrent_mark_cleanup_completed();
+        }
       }
-      _sts.leave();
 
       if (cm()->has_aborted()) {
         if (G1Log::fine()) {
@@ -278,36 +282,43 @@
 
       // We now want to allow clearing of the marking bitmap to be
       // suspended by a collection pause.
-      _sts.join();
-      _cm->clearNextBitmap();
-      _sts.leave();
+      {
+        SuspendibleThreadSetJoiner sts;
+        _cm->clearNextBitmap();
+      }
     }
 
     // Update the number of full collections that have been
     // completed. This will also notify the FullGCCount_lock in case a
     // Java thread is waiting for a full GC to happen (e.g., it
     // called System.gc() with +ExplicitGCInvokesConcurrent).
-    _sts.join();
-    g1h->increment_old_marking_cycles_completed(true /* concurrent */);
-    g1h->register_concurrent_cycle_end();
-    _sts.leave();
+    {
+      SuspendibleThreadSetJoiner sts;
+      g1h->increment_old_marking_cycles_completed(true /* concurrent */);
+      g1h->register_concurrent_cycle_end();
+    }
   }
   assert(_should_terminate, "just checking");
 
   terminate();
 }
 
-
-void ConcurrentMarkThread::yield() {
-  _sts.yield("Concurrent Mark");
-}
+void ConcurrentMarkThread::stop() {
+  {
+    MutexLockerEx ml(Terminator_lock);
+    _should_terminate = true;
+  }
 
-void ConcurrentMarkThread::stop() {
-  // it is ok to take late safepoints here, if needed
-  MutexLockerEx mu(Terminator_lock);
-  _should_terminate = true;
-  while (!_has_terminated) {
-    Terminator_lock->wait();
+  {
+    MutexLockerEx ml(CGC_lock, Mutex::_no_safepoint_check_flag);
+    CGC_lock->notify_all();
+  }
+
+  {
+    MutexLockerEx ml(Terminator_lock);
+    while (!_has_terminated) {
+      Terminator_lock->wait();
+    }
   }
 }
 
@@ -327,11 +338,14 @@
   assert(!in_progress(), "should have been cleared");
 
   MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
-  while (!started()) {
+  while (!started() && !_should_terminate) {
     CGC_lock->wait(Mutex::_no_safepoint_check_flag);
   }
-  set_in_progress();
-  clear_started();
+
+  if (started()) {
+    set_in_progress();
+    clear_started();
+  }
 }
 
 // Note: As is the case with CMS - this method, although exported
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.hpp	Mon May 05 12:49:13 2014 -0700
@@ -89,9 +89,6 @@
   // that started() is set and set in_progress().
   bool during_cycle()      { return started() || in_progress(); }
 
-  // Yield for GC
-  void            yield();
-
   // shutdown
   void stop();
 };
--- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Mon May 05 12:49:13 2014 -0700
@@ -70,7 +70,7 @@
 
 DirtyCardQueueSet::DirtyCardQueueSet(bool notify_when_complete) :
   PtrQueueSet(notify_when_complete),
-  _closure(NULL),
+  _mut_process_closure(NULL),
   _shared_dirty_card_queue(this, true /*perm*/),
   _free_ids(NULL),
   _processed_buffers_mut(0), _processed_buffers_rs_thread(0)
@@ -83,10 +83,11 @@
   return (uint)os::processor_count();
 }
 
-void DirtyCardQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
+void DirtyCardQueueSet::initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
                                    int process_completed_threshold,
                                    int max_completed_queue,
                                    Mutex* lock, PtrQueueSet* fl_owner) {
+  _mut_process_closure = cl;
   PtrQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold,
                           max_completed_queue, fl_owner);
   set_buffer_size(G1UpdateBufferSize);
@@ -98,18 +99,15 @@
   t->dirty_card_queue().handle_zero_index();
 }
 
-void DirtyCardQueueSet::set_closure(CardTableEntryClosure* closure) {
-  _closure = closure;
-}
-
-void DirtyCardQueueSet::iterate_closure_all_threads(bool consume,
+void DirtyCardQueueSet::iterate_closure_all_threads(CardTableEntryClosure* cl,
+                                                    bool consume,
                                                     uint worker_i) {
   assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint.");
   for(JavaThread* t = Threads::first(); t; t = t->next()) {
-    bool b = t->dirty_card_queue().apply_closure(_closure, consume);
+    bool b = t->dirty_card_queue().apply_closure(cl, consume);
     guarantee(b, "Should not be interrupted.");
   }
-  bool b = shared_dirty_card_queue()->apply_closure(_closure,
+  bool b = shared_dirty_card_queue()->apply_closure(cl,
                                                     consume,
                                                     worker_i);
   guarantee(b, "Should not be interrupted.");
@@ -143,7 +141,7 @@
 
   bool b = false;
   if (worker_i != UINT_MAX) {
-    b = DirtyCardQueue::apply_closure_to_buffer(_closure, buf, 0,
+    b = DirtyCardQueue::apply_closure_to_buffer(_mut_process_closure, buf, 0,
                                                 _sz, true, worker_i);
     if (b) Atomic::inc(&_processed_buffers_mut);
 
@@ -218,18 +216,11 @@
   return res;
 }
 
-bool DirtyCardQueueSet::apply_closure_to_completed_buffer(uint worker_i,
-                                                          int stop_at,
-                                                          bool during_pause) {
-  return apply_closure_to_completed_buffer(_closure, worker_i,
-                                           stop_at, during_pause);
-}
-
-void DirtyCardQueueSet::apply_closure_to_all_completed_buffers() {
+void DirtyCardQueueSet::apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {
   BufferNode* nd = _completed_buffers_head;
   while (nd != NULL) {
     bool b =
-      DirtyCardQueue::apply_closure_to_buffer(_closure,
+      DirtyCardQueue::apply_closure_to_buffer(cl,
                                               BufferNode::make_buffer_from_node(nd),
                                               0, _sz, false);
     guarantee(b, "Should not stop early.");
@@ -237,6 +228,24 @@
   }
 }
 
+void DirtyCardQueueSet::par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl) {
+  BufferNode* nd = _cur_par_buffer_node;
+  while (nd != NULL) {
+    BufferNode* next = (BufferNode*)nd->next();
+    BufferNode* actual = (BufferNode*)Atomic::cmpxchg_ptr((void*)next, (volatile void*)&_cur_par_buffer_node, (void*)nd);
+    if (actual == nd) {
+      bool b =
+        DirtyCardQueue::apply_closure_to_buffer(cl,
+                                                BufferNode::make_buffer_from_node(actual),
+                                                0, _sz, false);
+      guarantee(b, "Should not stop early.");
+      nd = next;
+    } else {
+      nd = actual;
+    }
+  }
+}
+
 // Deallocates any completed log buffers
 void DirtyCardQueueSet::clear() {
   BufferNode* buffers_to_delete = NULL;
--- a/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/dirtyCardQueue.hpp	Mon May 05 12:49:13 2014 -0700
@@ -73,7 +73,8 @@
 
 
 class DirtyCardQueueSet: public PtrQueueSet {
-  CardTableEntryClosure* _closure;
+  // The closure used in mut_process_buffer().
+  CardTableEntryClosure* _mut_process_closure;
 
   DirtyCardQueue _shared_dirty_card_queue;
 
@@ -88,10 +89,12 @@
   jint _processed_buffers_mut;
   jint _processed_buffers_rs_thread;
 
+  // Current buffer node used for parallel iteration.
+  BufferNode* volatile _cur_par_buffer_node;
 public:
   DirtyCardQueueSet(bool notify_when_complete = true);
 
-  void initialize(Monitor* cbl_mon, Mutex* fl_lock,
+  void initialize(CardTableEntryClosure* cl, Monitor* cbl_mon, Mutex* fl_lock,
                   int process_completed_threshold,
                   int max_completed_queue,
                   Mutex* lock, PtrQueueSet* fl_owner = NULL);
@@ -102,33 +105,15 @@
 
   static void handle_zero_index_for_thread(JavaThread* t);
 
-  // Register "blk" as "the closure" for all queues.  Only one such closure
-  // is allowed.  The "apply_closure_to_completed_buffer" method will apply
-  // this closure to a completed buffer, and "iterate_closure_all_threads"
-  // applies it to partially-filled buffers (the latter should only be done
-  // with the world stopped).
-  void set_closure(CardTableEntryClosure* closure);
-
-  // If there is a registered closure for buffers, apply it to all entries
-  // in all currently-active buffers.  This should only be applied at a
-  // safepoint.  (Currently must not be called in parallel; this should
-  // change in the future.)  If "consume" is true, processed entries are
-  // discarded.
-  void iterate_closure_all_threads(bool consume = true,
+  // Apply the given closure to all entries in all currently-active buffers.
+  // This should only be applied at a safepoint. (Currently must not be called
+  // in parallel; this should change in the future.)  If "consume" is true,
+  // processed entries are discarded.
+  void iterate_closure_all_threads(CardTableEntryClosure* cl,
+                                   bool consume = true,
                                    uint worker_i = 0);
 
   // If there exists some completed buffer, pop it, then apply the
-  // registered closure to all its elements, nulling out those elements
-  // processed.  If all elements are processed, returns "true".  If no
-  // completed buffers exist, returns false.  If a completed buffer exists,
-  // but is only partially completed before a "yield" happens, the
-  // partially completed buffer (with its processed elements set to NULL)
-  // is returned to the completed buffer set, and this call returns false.
-  bool apply_closure_to_completed_buffer(uint worker_i = 0,
-                                         int stop_at = 0,
-                                         bool during_pause = false);
-
-  // If there exists some completed buffer, pop it, then apply the
   // specified closure to all its elements, nulling out those elements
   // processed.  If all elements are processed, returns "true".  If no
   // completed buffers exist, returns false.  If a completed buffer exists,
@@ -149,7 +134,12 @@
 
   // Applies the current closure to all completed buffers,
   // non-consumptively.
-  void apply_closure_to_all_completed_buffers();
+  void apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl);
+
+  void reset_for_par_iteration() { _cur_par_buffer_node = _completed_buffers_head; }
+  // Applies the current closure to all completed buffers, non-consumptively.
+  // Parallel version.
+  void par_apply_closure_to_all_completed_buffers(CardTableEntryClosure* cl);
 
   DirtyCardQueue* shared_dirty_card_queue() {
     return &_shared_dirty_card_queue;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp	Mon May 05 12:49:13 2014 -0700
@@ -45,32 +45,27 @@
   }
 }
 
-FreeList<G1CodeRootChunk> G1CodeRootSet::_free_list;
-size_t G1CodeRootSet::_num_chunks_handed_out = 0;
-
-G1CodeRootChunk* G1CodeRootSet::new_chunk() {
-  G1CodeRootChunk* result = _free_list.get_chunk_at_head();
-  if (result == NULL) {
-    result = new G1CodeRootChunk();
-  }
-  G1CodeRootSet::_num_chunks_handed_out++;
-  result->reset();
-  return result;
+G1CodeRootChunkManager::G1CodeRootChunkManager() : _free_list(), _num_chunks_handed_out(0) {
+  _free_list.initialize();
+  _free_list.set_size(G1CodeRootChunk::word_size());
 }
 
-void G1CodeRootSet::free_chunk(G1CodeRootChunk* chunk) {
-  _free_list.return_chunk_at_head(chunk);
-  G1CodeRootSet::_num_chunks_handed_out--;
+size_t G1CodeRootChunkManager::fl_mem_size() {
+  return _free_list.count() * _free_list.size();
 }
 
-void G1CodeRootSet::free_all_chunks(FreeList<G1CodeRootChunk>* list) {
-  G1CodeRootSet::_num_chunks_handed_out -= list->count();
+void G1CodeRootChunkManager::free_all_chunks(FreeList<G1CodeRootChunk>* list) {
+  _num_chunks_handed_out -= list->count();
   _free_list.prepend(list);
 }
 
-void G1CodeRootSet::purge_chunks(size_t keep_ratio) {
-  size_t keep = G1CodeRootSet::_num_chunks_handed_out * keep_ratio / 100;
+void G1CodeRootChunkManager::free_chunk(G1CodeRootChunk* chunk) {
+  _free_list.return_chunk_at_head(chunk);
+  _num_chunks_handed_out--;
+}
 
+void G1CodeRootChunkManager::purge_chunks(size_t keep_ratio) {
+  size_t keep = _num_chunks_handed_out * keep_ratio / 100;
   if (keep >= (size_t)_free_list.count()) {
     return;
   }
@@ -88,20 +83,51 @@
   }
 }
 
-size_t G1CodeRootSet::static_mem_size() {
-  return sizeof(_free_list) + sizeof(_num_chunks_handed_out);
+size_t G1CodeRootChunkManager::static_mem_size() {
+  return sizeof(G1CodeRootChunkManager);
+}
+
+
+G1CodeRootChunk* G1CodeRootChunkManager::new_chunk() {
+  G1CodeRootChunk* result = _free_list.get_chunk_at_head();
+  if (result == NULL) {
+    result = new G1CodeRootChunk();
+  }
+  _num_chunks_handed_out++;
+  result->reset();
+  return result;
+}
+
+#ifndef PRODUCT
+
+size_t G1CodeRootChunkManager::num_chunks_handed_out() const {
+  return _num_chunks_handed_out;
 }
 
-size_t G1CodeRootSet::fl_mem_size() {
-  return _free_list.count() * _free_list.size();
+size_t G1CodeRootChunkManager::num_free_chunks() const {
+  return (size_t)_free_list.count();
+}
+
+#endif
+
+G1CodeRootChunkManager G1CodeRootSet::_default_chunk_manager;
+
+void G1CodeRootSet::purge_chunks(size_t keep_ratio) {
+  _default_chunk_manager.purge_chunks(keep_ratio);
 }
 
-void G1CodeRootSet::initialize() {
-  _free_list.initialize();
-  _free_list.set_size(G1CodeRootChunk::word_size());
+size_t G1CodeRootSet::free_chunks_static_mem_size() {
+  return _default_chunk_manager.static_mem_size();
 }
 
-G1CodeRootSet::G1CodeRootSet() : _list(), _length(0) {
+size_t G1CodeRootSet::free_chunks_mem_size() {
+  return _default_chunk_manager.fl_mem_size();
+}
+
+G1CodeRootSet::G1CodeRootSet(G1CodeRootChunkManager* manager) : _manager(manager), _list(), _length(0) {
+  if (_manager == NULL) {
+    _manager = &_default_chunk_manager;
+  }
   _list.initialize();
   _list.set_size(G1CodeRootChunk::word_size());
 }
@@ -187,28 +213,38 @@
   }
 }
 
+size_t G1CodeRootSet::static_mem_size() {
+  return sizeof(G1CodeRootSet);
+}
+
 size_t G1CodeRootSet::mem_size() {
-  return sizeof(this) + _list.count() * _list.size();
+  return G1CodeRootSet::static_mem_size() + _list.count() * _list.size();
 }
 
 #ifndef PRODUCT
 
 void G1CodeRootSet::test() {
-  initialize();
+  G1CodeRootChunkManager mgr;
 
-  assert(_free_list.count() == 0, "Free List must be empty");
-  assert(_num_chunks_handed_out == 0, "No elements must have been handed out yet");
+  assert(mgr.num_chunks_handed_out() == 0, "Must not have handed out chunks yet");
+
+  assert(G1CodeRootChunkManager::static_mem_size() > sizeof(void*),
+         err_msg("The chunk manager's static memory usage seems too small, is only "SIZE_FORMAT" bytes.", G1CodeRootChunkManager::static_mem_size()));
 
   // The number of chunks that we allocate for purge testing.
   size_t const num_chunks = 10;
+
   {
-    G1CodeRootSet set1;
+    G1CodeRootSet set1(&mgr);
     assert(set1.is_empty(), "Code root set must be initially empty but is not.");
 
+    assert(G1CodeRootSet::static_mem_size() > sizeof(void*),
+           err_msg("The code root set's static memory usage seems too small, is only "SIZE_FORMAT" bytes", G1CodeRootSet::static_mem_size()));
+
     set1.add((nmethod*)1);
-    assert(_num_chunks_handed_out == 1,
+    assert(mgr.num_chunks_handed_out() == 1,
            err_msg("Must have allocated and handed out one chunk, but handed out "
-                   SIZE_FORMAT" chunks", _num_chunks_handed_out));
+                   SIZE_FORMAT" chunks", mgr.num_chunks_handed_out()));
     assert(set1.length() == 1, err_msg("Added exactly one element, but set contains "
                                        SIZE_FORMAT" elements", set1.length()));
 
@@ -217,19 +253,19 @@
     for (uint i = 0; i < G1CodeRootChunk::word_size() + 1; i++) {
       set1.add((nmethod*)1);
     }
-    assert(_num_chunks_handed_out == 1,
+    assert(mgr.num_chunks_handed_out() == 1,
            err_msg("Duplicate detection must have prevented allocation of further "
-                   "chunks but contains "SIZE_FORMAT, _num_chunks_handed_out));
+                   "chunks but allocated "SIZE_FORMAT, mgr.num_chunks_handed_out()));
     assert(set1.length() == 1,
            err_msg("Duplicate detection should not have increased the set size but "
                    "is "SIZE_FORMAT, set1.length()));
 
     size_t num_total_after_add = G1CodeRootChunk::word_size() + 1;
     for (size_t i = 0; i < num_total_after_add - 1; i++) {
-      set1.add((nmethod*)(2 + i));
+      set1.add((nmethod*)(uintptr_t)(2 + i));
     }
-    assert(_num_chunks_handed_out > 1,
-           "After adding more code roots, more than one chunks should have been handed out");
+    assert(mgr.num_chunks_handed_out() > 1,
+           "After adding more code roots, more than one additional chunk should have been handed out");
     assert(set1.length() == num_total_after_add,
            err_msg("After adding in total "SIZE_FORMAT" distinct code roots, they "
                    "need to be in the set, but there are only "SIZE_FORMAT,
@@ -242,27 +278,27 @@
     assert(num_popped == num_total_after_add,
            err_msg("Managed to pop "SIZE_FORMAT" code roots, but only "SIZE_FORMAT" "
                    "were added", num_popped, num_total_after_add));
-    assert(_num_chunks_handed_out == 0,
+    assert(mgr.num_chunks_handed_out() == 0,
            err_msg("After popping all elements, all chunks must have been returned "
-                   "but are still "SIZE_FORMAT, _num_chunks_handed_out));
+                   "but there are still "SIZE_FORMAT" additional", mgr.num_chunks_handed_out()));
 
-    purge_chunks(0);
-    assert(_free_list.count() == 0,
+    mgr.purge_chunks(0);
+    assert(mgr.num_free_chunks() == 0,
            err_msg("After purging everything, the free list must be empty but still "
-                   "contains "SIZE_FORMAT" chunks", _free_list.count()));
+                   "contains "SIZE_FORMAT" chunks", mgr.num_free_chunks()));
 
     // Add some more handed out chunks.
     size_t i = 0;
-    while (_num_chunks_handed_out < num_chunks) {
+    while (mgr.num_chunks_handed_out() < num_chunks) {
       set1.add((nmethod*)i);
       i++;
     }
 
     {
       // Generate chunks on the free list.
-      G1CodeRootSet set2;
+      G1CodeRootSet set2(&mgr);
       size_t i = 0;
-      while (_num_chunks_handed_out < num_chunks * 2) {
+      while (mgr.num_chunks_handed_out() < (num_chunks * 2)) {
         set2.add((nmethod*)i);
         i++;
       }
@@ -270,45 +306,45 @@
       // num_chunks elements on the free list.
     }
 
-    assert(_num_chunks_handed_out == num_chunks,
+    assert(mgr.num_chunks_handed_out() == num_chunks,
            err_msg("Deletion of the second set must have resulted in giving back "
-                   "those, but there is still "SIZE_FORMAT" handed out, expecting "
-                   SIZE_FORMAT, _num_chunks_handed_out, num_chunks));
-    assert((size_t)_free_list.count() == num_chunks,
+                   "those, but there are still "SIZE_FORMAT" additional handed out, expecting "
+                   SIZE_FORMAT, mgr.num_chunks_handed_out(), num_chunks));
+    assert(mgr.num_free_chunks() == num_chunks,
            err_msg("After freeing "SIZE_FORMAT" chunks, they must be on the free list "
-                   "but there are only "SIZE_FORMAT, num_chunks, _free_list.count()));
+                   "but there are only "SIZE_FORMAT, num_chunks, mgr.num_free_chunks()));
 
     size_t const test_percentage = 50;
-    purge_chunks(test_percentage);
-    assert(_num_chunks_handed_out == num_chunks,
+    mgr.purge_chunks(test_percentage);
+    assert(mgr.num_chunks_handed_out() == num_chunks,
            err_msg("Purging must not hand out chunks but there are "SIZE_FORMAT,
-                   _num_chunks_handed_out));
-    assert((size_t)_free_list.count() == (ssize_t)(num_chunks * test_percentage / 100),
+                   mgr.num_chunks_handed_out()));
+    assert(mgr.num_free_chunks() == (size_t)(mgr.num_chunks_handed_out() * test_percentage / 100),
            err_msg("Must have purged "SIZE_FORMAT" percent of "SIZE_FORMAT" chunks"
-                   "but there are "SSIZE_FORMAT, test_percentage, num_chunks,
-                   _free_list.count()));
+                   "but there are "SIZE_FORMAT, test_percentage, num_chunks,
+                   mgr.num_free_chunks()));
     // Purge the remainder of the chunks on the free list.
-    purge_chunks(0);
-    assert(_free_list.count() == 0, "Free List must be empty");
-    assert(_num_chunks_handed_out == num_chunks,
+    mgr.purge_chunks(0);
+    assert(mgr.num_free_chunks() == 0, "Free List must be empty");
+    assert(mgr.num_chunks_handed_out() == num_chunks,
            err_msg("Expected to be "SIZE_FORMAT" chunks handed out from the first set "
-                   "but there are "SIZE_FORMAT, num_chunks, _num_chunks_handed_out));
+                   "but there are "SIZE_FORMAT, num_chunks, mgr.num_chunks_handed_out()));
 
     // Exit of the scope of the set1 object will call the destructor that generates
     // num_chunks additional elements on the free list.
-  }
+   }
 
-  assert(_num_chunks_handed_out == 0,
+  assert(mgr.num_chunks_handed_out() == 0,
          err_msg("Deletion of the only set must have resulted in no chunks handed "
-                 "out, but there is still "SIZE_FORMAT" handed out", _num_chunks_handed_out));
-  assert((size_t)_free_list.count() == num_chunks,
+                 "out, but there is still "SIZE_FORMAT" handed out", mgr.num_chunks_handed_out()));
+  assert(mgr.num_free_chunks() == num_chunks,
          err_msg("After freeing "SIZE_FORMAT" chunks, they must be on the free list "
-                 "but there are only "SSIZE_FORMAT, num_chunks, _free_list.count()));
+                 "but there are only "SIZE_FORMAT, num_chunks, mgr.num_free_chunks()));
 
   // Restore initial state.
-  purge_chunks(0);
-  assert(_free_list.count() == 0, "Free List must be empty");
-  assert(_num_chunks_handed_out == 0, "No elements must have been handed out yet");
+  mgr.purge_chunks(0);
+  assert(mgr.num_free_chunks() == 0, "Free List must be empty");
+  assert(mgr.num_chunks_handed_out() == 0, "No additional elements must have been handed out yet");
 }
 
 void TestCodeCacheRemSet_test() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.hpp	Mon May 05 12:49:13 2014 -0700
@@ -128,19 +128,45 @@
   }
 };
 
+// Manages free chunks.
+class G1CodeRootChunkManager VALUE_OBJ_CLASS_SPEC {
+ private:
+  // Global free chunk list management
+  FreeList<G1CodeRootChunk> _free_list;
+  // Total number of chunks handed out
+  size_t _num_chunks_handed_out;
+
+ public:
+  G1CodeRootChunkManager();
+
+  G1CodeRootChunk* new_chunk();
+  void free_chunk(G1CodeRootChunk* chunk);
+  // Free all elements of the given list.
+  void free_all_chunks(FreeList<G1CodeRootChunk>* list);
+
+  void initialize();
+  void purge_chunks(size_t keep_ratio);
+
+  static size_t static_mem_size();
+  size_t fl_mem_size();
+
+#ifndef PRODUCT
+  size_t num_chunks_handed_out() const;
+  size_t num_free_chunks() const;
+#endif
+};
+
 // Implements storage for a set of code roots.
 // All methods that modify the set are not thread-safe except if otherwise noted.
 class G1CodeRootSet VALUE_OBJ_CLASS_SPEC {
  private:
-  // Global free chunk list management
-  static FreeList<G1CodeRootChunk> _free_list;
-  // Total number of chunks handed out
-  static size_t _num_chunks_handed_out;
+  // Global default free chunk manager instance.
+  static G1CodeRootChunkManager _default_chunk_manager;
 
-  static G1CodeRootChunk* new_chunk();
-  static void free_chunk(G1CodeRootChunk* chunk);
+  G1CodeRootChunk* new_chunk() { return _manager->new_chunk(); }
+  void free_chunk(G1CodeRootChunk* chunk) { _manager->free_chunk(chunk); }
   // Free all elements of the given list.
-  static void free_all_chunks(FreeList<G1CodeRootChunk>* list);
+  void free_all_chunks(FreeList<G1CodeRootChunk>* list) { _manager->free_all_chunks(list); }
 
   // Return the chunk that contains the given nmethod, NULL otherwise.
   // Scans the list of chunks backwards, as this method is used to add new
@@ -150,16 +176,18 @@
 
   size_t _length;
   FreeList<G1CodeRootChunk> _list;
+  G1CodeRootChunkManager* _manager;
 
  public:
-  G1CodeRootSet();
+  // If an instance is initialized with a chunk manager of NULL, use the global
+  // default one.
+  G1CodeRootSet(G1CodeRootChunkManager* manager = NULL);
   ~G1CodeRootSet();
 
-  static void initialize();
   static void purge_chunks(size_t keep_ratio);
 
-  static size_t static_mem_size();
-  static size_t fl_mem_size();
+  static size_t free_chunks_static_mem_size();
+  static size_t free_chunks_mem_size();
 
   // Search for the code blob from the recently allocated ones to find duplicates more quickly, as this
   // method is likely to be repeatedly called with the same nmethod.
@@ -179,6 +207,8 @@
   // Length in elements
   size_t length() const { return _length; }
 
+  // Static data memory size in bytes of this set.
+  static size_t static_mem_size();
   // Memory size in bytes taken by this set.
   size_t mem_size();
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon May 05 12:49:13 2014 -0700
@@ -57,6 +57,7 @@
 #include "oops/oop.inline.hpp"
 #include "oops/oop.pcgc.inline.hpp"
 #include "runtime/vmThread.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/ticks.hpp"
 
 size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
@@ -92,56 +93,54 @@
 // Local to this file.
 
 class RefineCardTableEntryClosure: public CardTableEntryClosure {
-  SuspendibleThreadSet* _sts;
-  G1RemSet* _g1rs;
-  ConcurrentG1Refine* _cg1r;
   bool _concurrent;
 public:
-  RefineCardTableEntryClosure(SuspendibleThreadSet* sts,
-                              G1RemSet* g1rs,
-                              ConcurrentG1Refine* cg1r) :
-    _sts(sts), _g1rs(g1rs), _cg1r(cg1r), _concurrent(true)
-  {}
+  RefineCardTableEntryClosure() : _concurrent(true) { }
+
   bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
-    bool oops_into_cset = _g1rs->refine_card(card_ptr, worker_i, false);
+    bool oops_into_cset = G1CollectedHeap::heap()->g1_rem_set()->refine_card(card_ptr, worker_i, false);
     // This path is executed by the concurrent refine or mutator threads,
     // concurrently, and so we do not care if card_ptr contains references
     // that point into the collection set.
     assert(!oops_into_cset, "should be");
 
-    if (_concurrent && _sts->should_yield()) {
+    if (_concurrent && SuspendibleThreadSet::should_yield()) {
       // Caller will actually yield.
       return false;
     }
     // Otherwise, we finished successfully; return true.
     return true;
   }
+
   void set_concurrent(bool b) { _concurrent = b; }
 };
 
 
 class ClearLoggedCardTableEntryClosure: public CardTableEntryClosure {
-  int _calls;
-  G1CollectedHeap* _g1h;
+  size_t _num_processed;
   CardTableModRefBS* _ctbs;
   int _histo[256];
-public:
+
+ public:
   ClearLoggedCardTableEntryClosure() :
-    _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set())
+    _num_processed(0), _ctbs(G1CollectedHeap::heap()->g1_barrier_set())
   {
     for (int i = 0; i < 256; i++) _histo[i] = 0;
   }
+
   bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
-    if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) {
-      _calls++;
-      unsigned char* ujb = (unsigned char*)card_ptr;
-      int ind = (int)(*ujb);
-      _histo[ind]++;
-      *card_ptr = -1;
-    }
+    unsigned char* ujb = (unsigned char*)card_ptr;
+    int ind = (int)(*ujb);
+    _histo[ind]++;
+
+    *card_ptr = (jbyte)CardTableModRefBS::clean_card_val();
+    _num_processed++;
+
     return true;
   }
-  int calls() { return _calls; }
+
+  size_t num_processed() { return _num_processed; }
+
   void print_histo() {
     gclog_or_tty->print_cr("Card table value histogram:");
     for (int i = 0; i < 256; i++) {
@@ -152,22 +151,20 @@
   }
 };
 
-class RedirtyLoggedCardTableEntryClosure: public CardTableEntryClosure {
-  int _calls;
-  G1CollectedHeap* _g1h;
-  CardTableModRefBS* _ctbs;
-public:
-  RedirtyLoggedCardTableEntryClosure() :
-    _calls(0), _g1h(G1CollectedHeap::heap()), _ctbs(_g1h->g1_barrier_set()) {}
+class RedirtyLoggedCardTableEntryClosure : public CardTableEntryClosure {
+ private:
+  size_t _num_processed;
+
+ public:
+  RedirtyLoggedCardTableEntryClosure() : CardTableEntryClosure(), _num_processed(0) { }
 
   bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
-    if (_g1h->is_in_reserved(_ctbs->addr_for(card_ptr))) {
-      _calls++;
-      *card_ptr = 0;
-    }
+    *card_ptr = CardTableModRefBS::dirty_card_val();
+    _num_processed++;
     return true;
   }
-  int calls() { return _calls; }
+
+  size_t num_processed() const { return _num_processed; }
 };
 
 YoungList::YoungList(G1CollectedHeap* g1h) :
@@ -431,6 +428,9 @@
 void G1CollectedHeap::stop_conc_gc_threads() {
   _cg1r->stop();
   _cmThread->stop();
+  if (G1StringDedup::is_enabled()) {
+    G1StringDedup::stop();
+  }
 }
 
 #ifdef ASSERT
@@ -445,24 +445,18 @@
 // implementation of is_scavengable() for G1 will indicate that
 // all nmethods must be scanned during a partial collection.
 bool G1CollectedHeap::is_in_partial_collection(const void* p) {
-  HeapRegion* hr = heap_region_containing(p);
-  return hr != NULL && hr->in_collection_set();
+  if (p == NULL) {
+    return false;
+  }
+  return heap_region_containing(p)->in_collection_set();
 }
 #endif
 
 // Returns true if the reference points to an object that
 // can move in an incremental collection.
 bool G1CollectedHeap::is_scavengable(const void* p) {
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  G1CollectorPolicy* g1p = g1h->g1_policy();
   HeapRegion* hr = heap_region_containing(p);
-  if (hr == NULL) {
-     // null
-     assert(p == NULL, err_msg("Not NULL " PTR_FORMAT ,p));
-     return false;
-  } else {
-    return !hr->isHumongous();
-  }
+  return !hr->isHumongous();
 }
 
 void G1CollectedHeap::check_ct_logs_at_safepoint() {
@@ -476,9 +470,8 @@
 
   // First clear the logged cards.
   ClearLoggedCardTableEntryClosure clear;
-  dcqs.set_closure(&clear);
-  dcqs.apply_closure_to_all_completed_buffers();
-  dcqs.iterate_closure_all_threads(false);
+  dcqs.apply_closure_to_all_completed_buffers(&clear);
+  dcqs.iterate_closure_all_threads(&clear, false);
   clear.print_histo();
 
   // Now ensure that there's no dirty cards.
@@ -491,13 +484,13 @@
   guarantee(count2.n() == 0, "Card table should be clean.");
 
   RedirtyLoggedCardTableEntryClosure redirty;
-  JavaThread::dirty_card_queue_set().set_closure(&redirty);
-  dcqs.apply_closure_to_all_completed_buffers();
-  dcqs.iterate_closure_all_threads(false);
+  dcqs.apply_closure_to_all_completed_buffers(&redirty);
+  dcqs.iterate_closure_all_threads(&redirty, false);
   gclog_or_tty->print_cr("Log entries = %d, dirty cards = %d.",
-                         clear.calls(), orig_count);
-  guarantee(redirty.calls() == clear.calls(),
-            "Or else mechanism is broken.");
+                         clear.num_processed(), orig_count);
+  guarantee(redirty.num_processed() == clear.num_processed(),
+            err_msg("Redirtied "SIZE_FORMAT" cards, bug cleared "SIZE_FORMAT,
+                    redirty.num_processed(), clear.num_processed()));
 
   CountNonCleanMemRegionClosure count3(this);
   ct_bs->mod_card_iterate(&count3);
@@ -506,8 +499,6 @@
                            orig_count, count3.n());
     guarantee(count3.n() >= orig_count, "Should have restored them all.");
   }
-
-  JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl);
 }
 
 // Private class members.
@@ -1512,9 +1503,6 @@
       assert(g1_policy()->collection_set() == NULL, "must be");
       g1_policy()->start_incremental_cset_building();
 
-      // Clear the _cset_fast_test bitmap in anticipation of adding
-      // regions to the incremental collection set for the next
-      // evacuation pause.
       clear_cset_fast_test();
 
       init_mutator_alloc_region();
@@ -1934,8 +1922,7 @@
   _old_marking_cycles_started(0),
   _old_marking_cycles_completed(0),
   _concurrent_cycle_started(false),
-  _in_cset_fast_test(NULL),
-  _in_cset_fast_test_base(NULL),
+  _in_cset_fast_test(),
   _dirty_cards_region_list(NULL),
   _worker_cset_start_region(NULL),
   _worker_cset_start_region_time_stamp(NULL),
@@ -2005,7 +1992,9 @@
   Universe::check_alignment(max_byte_size, HeapRegion::GrainBytes, "g1 heap");
   Universe::check_alignment(max_byte_size, heap_alignment, "g1 heap");
 
-  _cg1r = new ConcurrentG1Refine(this);
+  _refine_cte_cl = new RefineCardTableEntryClosure();
+
+  _cg1r = new ConcurrentG1Refine(this, _refine_cte_cl);
 
   // Reserve the maximum.
 
@@ -2077,20 +2066,7 @@
 
   _g1h = this;
 
-  _in_cset_fast_test_length = max_regions();
-  _in_cset_fast_test_base =
-                   NEW_C_HEAP_ARRAY(bool, (size_t) _in_cset_fast_test_length, mtGC);
-
-  // We're biasing _in_cset_fast_test to avoid subtracting the
-  // beginning of the heap every time we want to index; basically
-  // it's the same with what we do with the card table.
-  _in_cset_fast_test = _in_cset_fast_test_base -
-               ((uintx) _g1_reserved.start() >> HeapRegion::LogOfHRGrainBytes);
-
-  // Clear the _cset_fast_test bitmap in anticipation of adding
-  // regions to the incremental collection set for the first
-  // evacuation pause.
-  clear_cset_fast_test();
+  _in_cset_fast_test.initialize(_g1_reserved.start(), _g1_reserved.end(), HeapRegion::GrainBytes);
 
   // Create the ConcurrentMark data structure and thread.
   // (Must do this late, so that "max_regions" is defined.)
@@ -2113,25 +2089,21 @@
   // Perform any initialization actions delegated to the policy.
   g1_policy()->init();
 
-  _refine_cte_cl =
-    new RefineCardTableEntryClosure(ConcurrentG1RefineThread::sts(),
-                                    g1_rem_set(),
-                                    concurrent_g1_refine());
-  JavaThread::dirty_card_queue_set().set_closure(_refine_cte_cl);
-
   JavaThread::satb_mark_queue_set().initialize(SATB_Q_CBL_mon,
                                                SATB_Q_FL_lock,
                                                G1SATBProcessCompletedThreshold,
                                                Shared_SATB_Q_lock);
 
-  JavaThread::dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
+  JavaThread::dirty_card_queue_set().initialize(_refine_cte_cl,
+                                                DirtyCardQ_CBL_mon,
                                                 DirtyCardQ_FL_lock,
                                                 concurrent_g1_refine()->yellow_zone(),
                                                 concurrent_g1_refine()->red_zone(),
                                                 Shared_DirtyCardQ_lock);
 
   if (G1DeferredRSUpdate) {
-    dirty_card_queue_set().initialize(DirtyCardQ_CBL_mon,
+    dirty_card_queue_set().initialize(NULL, // Should never be called by the Java code
+                                      DirtyCardQ_CBL_mon,
                                       DirtyCardQ_FL_lock,
                                       -1, // never trigger processing
                                       -1, // no limit on length
@@ -2141,7 +2113,8 @@
 
   // Initialize the card queue set used to hold cards containing
   // references into the collection set.
-  _into_cset_dirty_card_queue_set.initialize(DirtyCardQ_CBL_mon,
+  _into_cset_dirty_card_queue_set.initialize(NULL, // Should never be called by the Java code
+                                             DirtyCardQ_CBL_mon,
                                              DirtyCardQ_FL_lock,
                                              -1, // never trigger processing
                                              -1, // no limit on length
@@ -2178,6 +2151,23 @@
   return JNI_OK;
 }
 
+void G1CollectedHeap::stop() {
+#if 0
+  // Stopping concurrent worker threads is currently disabled until
+  // some bugs in concurrent mark has been resolve. Without fixing
+  // those bugs first we risk haning during VM exit when trying to
+  // stop these threads.
+
+  // Abort any ongoing concurrent root region scanning and stop all
+  // concurrent threads. We do this to make sure these threads do
+  // not continue to execute and access resources (e.g. gclog_or_tty)
+  // that are destroyed during shutdown.
+  _cm->root_regions()->abort();
+  _cm->root_regions()->wait_until_scan_finished();
+  stop_conc_gc_threads();
+#endif
+}
+
 size_t G1CollectedHeap::conservative_max_heap_alignment() {
   return HeapRegion::max_region_size();
 }
@@ -2963,21 +2953,16 @@
 
 
 Space* G1CollectedHeap::space_containing(const void* addr) const {
-  Space* res = heap_region_containing(addr);
-  return res;
+  return heap_region_containing(addr);
 }
 
 HeapWord* G1CollectedHeap::block_start(const void* addr) const {
   Space* sp = space_containing(addr);
-  if (sp != NULL) {
-    return sp->block_start(addr);
-  }
-  return NULL;
+  return sp->block_start(addr);
 }
 
 size_t G1CollectedHeap::block_size(const HeapWord* addr) const {
   Space* sp = space_containing(addr);
-  assert(sp != NULL, "block_size of address outside of heap");
   return sp->block_size(addr);
 }
 
@@ -3212,7 +3197,7 @@
     _young_ref_counter_closure.reset_count();
     k->oops_do(&_young_ref_counter_closure);
     if (_young_ref_counter_closure.count() > 0) {
-      guarantee(k->has_modified_oops(), err_msg("Klass %p, has young refs but is not dirty.", k));
+      guarantee(k->has_modified_oops(), err_msg("Klass " PTR_FORMAT ", has young refs but is not dirty.", k));
     }
   }
 };
@@ -3296,7 +3281,7 @@
       int *val;
       for (cur = start; cur < end; cur++) {
         val = (int *) cur;
-        gclog_or_tty->print("\t "PTR_FORMAT":"PTR_FORMAT"\n", val, *val);
+        gclog_or_tty->print("\t "PTR_FORMAT":%d\n", val, *val);
       }
     }
   }
@@ -4125,9 +4110,6 @@
         // Start a new incremental collection set for the next pause.
         g1_policy()->start_incremental_cset_building();
 
-        // Clear the _cset_fast_test bitmap in anticipation of adding
-        // regions to the incremental collection set for the next
-        // evacuation pause.
         clear_cset_fast_test();
 
         _young_list->reset_sampled_info();
@@ -4304,7 +4286,7 @@
     // this point does not assume that we are the only GC thread
     // running. Note: of course, the actual marking work will
     // not start until the safepoint itself is released in
-    // ConcurrentGCThread::safepoint_desynchronize().
+    // SuspendibleThreadSet::desynchronize().
     doConcurrentMark();
   }
 
@@ -4571,7 +4553,7 @@
 }
 
 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) :
-  ParGCAllocBuffer(gclab_word_size), _retired(false) { }
+  ParGCAllocBuffer(gclab_word_size), _retired(true) { }
 
 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp)
   : _g1h(g1h),
@@ -4694,30 +4676,19 @@
   _worker_id(par_scan_state->queue_num()) { }
 
 void G1ParCopyHelper::mark_object(oop obj) {
-#ifdef ASSERT
-  HeapRegion* hr = _g1->heap_region_containing(obj);
-  assert(hr != NULL, "sanity");
-  assert(!hr->in_collection_set(), "should not mark objects in the CSet");
-#endif // ASSERT
+  assert(!_g1->heap_region_containing(obj)->in_collection_set(), "should not mark objects in the CSet");
 
   // We know that the object is not moving so it's safe to read its size.
   _cm->grayRoot(obj, (size_t) obj->size(), _worker_id);
 }
 
 void G1ParCopyHelper::mark_forwarded_object(oop from_obj, oop to_obj) {
-#ifdef ASSERT
   assert(from_obj->is_forwarded(), "from obj should be forwarded");
   assert(from_obj->forwardee() == to_obj, "to obj should be the forwardee");
   assert(from_obj != to_obj, "should not be self-forwarded");
 
-  HeapRegion* from_hr = _g1->heap_region_containing(from_obj);
-  assert(from_hr != NULL, "sanity");
-  assert(from_hr->in_collection_set(), "from obj should be in the CSet");
-
-  HeapRegion* to_hr = _g1->heap_region_containing(to_obj);
-  assert(to_hr != NULL, "sanity");
-  assert(!to_hr->in_collection_set(), "should not mark objects in the CSet");
-#endif // ASSERT
+  assert(_g1->heap_region_containing(from_obj)->in_collection_set(), "from obj should be in the CSet");
+  assert(!_g1->heap_region_containing(to_obj)->in_collection_set(), "should not mark objects in the CSet");
 
   // The object might be in the process of being copied by another
   // worker so we cannot trust that its to-space image is
@@ -4935,8 +4906,6 @@
       pss->trim_queue();
     }
   } while (!offer_termination());
-
-  pss->retire_alloc_buffers();
 }
 
 class G1KlassScanClosure : public KlassClosure {
@@ -5273,11 +5242,25 @@
   }
 }
 
-class RedirtyLoggedCardTableEntryFastClosure : public CardTableEntryClosure {
-public:
-  bool do_card_ptr(jbyte* card_ptr, uint worker_i) {
-    *card_ptr = CardTableModRefBS::dirty_card_val();
-    return true;
+class G1RedirtyLoggedCardsTask : public AbstractGangTask {
+ private:
+  DirtyCardQueueSet* _queue;
+ public:
+  G1RedirtyLoggedCardsTask(DirtyCardQueueSet* queue) : AbstractGangTask("Redirty Cards"), _queue(queue) { }
+
+  virtual void work(uint worker_id) {
+    double start_time = os::elapsedTime();
+
+    RedirtyLoggedCardTableEntryClosure cl;
+    if (G1CollectedHeap::heap()->use_parallel_gc_threads()) {
+      _queue->par_apply_closure_to_all_completed_buffers(&cl);
+    } else {
+      _queue->apply_closure_to_all_completed_buffers(&cl);
+    }
+
+    G1GCPhaseTimes* timer = G1CollectedHeap::heap()->g1_policy()->phase_times();
+    timer->record_redirty_logged_cards_time_ms(worker_id, (os::elapsedTime() - start_time) * 1000.0);
+    timer->record_redirty_logged_cards_processed_cards(worker_id, cl.num_processed());
   }
 };
 
@@ -5285,9 +5268,18 @@
   guarantee(G1DeferredRSUpdate, "Must only be called when using deferred RS updates.");
   double redirty_logged_cards_start = os::elapsedTime();
 
-  RedirtyLoggedCardTableEntryFastClosure redirty;
-  dirty_card_queue_set().set_closure(&redirty);
-  dirty_card_queue_set().apply_closure_to_all_completed_buffers();
+  uint n_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
+                   _g1h->workers()->active_workers() : 1);
+
+  G1RedirtyLoggedCardsTask redirty_task(&dirty_card_queue_set());
+  dirty_card_queue_set().reset_for_par_iteration();
+  if (use_parallel_gc_threads()) {
+    set_par_threads(n_workers);
+    workers()->run_task(&redirty_task);
+    set_par_threads(0);
+  } else {
+    redirty_task.work(0);
+  }
 
   DirtyCardQueueSet& dcq = JavaThread::dirty_card_queue_set();
   dcq.merge_bufferlists(&dirty_card_queue_set());
@@ -5762,10 +5754,8 @@
   }
 
   _gc_tracer_stw->report_gc_reference_stats(stats);
-  // We have completed copying any necessary live referent objects
-  // (that were not copied during the actual pause) so we can
-  // retire any active alloc buffers
-  pss.retire_alloc_buffers();
+
+  // We have completed copying any necessary live referent objects.
   assert(pss.refs()->is_empty(), "both queue and overflow should be empty");
 
   double ref_proc_time = os::elapsedTime() - ref_proc_start;
@@ -6456,11 +6446,7 @@
 
 bool G1CollectedHeap::is_in_closed_subset(const void* p) const {
   HeapRegion* hr = heap_region_containing(p);
-  if (hr == NULL) {
-    return false;
-  } else {
-    return hr->is_in(p);
-  }
+  return hr->is_in(p);
 }
 
 // Methods for the mutator alloc region
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon May 05 12:49:13 2014 -0700
@@ -28,6 +28,7 @@
 #include "gc_implementation/g1/concurrentMark.hpp"
 #include "gc_implementation/g1/evacuationInfo.hpp"
 #include "gc_implementation/g1/g1AllocRegion.hpp"
+#include "gc_implementation/g1/g1BiasedArray.hpp"
 #include "gc_implementation/g1/g1HRPrinter.hpp"
 #include "gc_implementation/g1/g1MonitoringSupport.hpp"
 #include "gc_implementation/g1/g1RemSet.hpp"
@@ -197,6 +198,16 @@
   bool do_object_b(oop p);
 };
 
+// Instances of this class are used for quick tests on whether a reference points
+// into the collection set. Each of the array's elements denotes whether the
+// corresponding region is in the collection set.
+class G1FastCSetBiasedMappedArray : public G1BiasedMappedArray<bool> {
+ protected:
+  bool default_value() const { return false; }
+ public:
+  void clear() { G1BiasedMappedArray<bool>::clear(); }
+};
+
 class RefineCardTableEntryClosure;
 
 class G1CollectedHeap : public SharedHeap {
@@ -353,26 +364,10 @@
   // than the current allocation region.
   size_t _summary_bytes_used;
 
-  // This is used for a quick test on whether a reference points into
-  // the collection set or not. Basically, we have an array, with one
-  // byte per region, and that byte denotes whether the corresponding
-  // region is in the collection set or not. The entry corresponding
-  // the bottom of the heap, i.e., region 0, is pointed to by
-  // _in_cset_fast_test_base.  The _in_cset_fast_test field has been
-  // biased so that it actually points to address 0 of the address
-  // space, to make the test as fast as possible (we can simply shift
-  // the address to address into it, instead of having to subtract the
-  // bottom of the heap from the address before shifting it; basically
-  // it works in the same way the card table works).
-  bool* _in_cset_fast_test;
-
-  // The allocated array used for the fast test on whether a reference
-  // points into the collection set or not. This field is also used to
-  // free the array.
-  bool* _in_cset_fast_test_base;
-
-  // The length of the _in_cset_fast_test_base array.
-  uint _in_cset_fast_test_length;
+  // This array is used for a quick test on whether a reference points into
+  // the collection set or not. Each of the array's elements denotes whether the
+  // corresponding region is in the collection set or not.
+  G1FastCSetBiasedMappedArray _in_cset_fast_test;
 
   volatile unsigned _gc_time_stamp;
 
@@ -695,12 +690,7 @@
   // We register a region with the fast "in collection set" test. We
   // simply set to true the array slot corresponding to this region.
   void register_region_with_in_cset_fast_test(HeapRegion* r) {
-    assert(_in_cset_fast_test_base != NULL, "sanity");
-    assert(r->in_collection_set(), "invariant");
-    uint index = r->hrs_index();
-    assert(index < _in_cset_fast_test_length, "invariant");
-    assert(!_in_cset_fast_test_base[index], "invariant");
-    _in_cset_fast_test_base[index] = true;
+    _in_cset_fast_test.set_by_index(r->hrs_index(), true);
   }
 
   // This is a fast test on whether a reference points into the
@@ -709,9 +699,7 @@
   inline bool in_cset_fast_test(oop obj);
 
   void clear_cset_fast_test() {
-    assert(_in_cset_fast_test_base != NULL, "sanity");
-    memset(_in_cset_fast_test_base, false,
-           (size_t) _in_cset_fast_test_length * sizeof(bool));
+    _in_cset_fast_test.clear();
   }
 
   // This is called at the start of either a concurrent cycle or a Full
@@ -1077,6 +1065,8 @@
   // specified by the policy object.
   jint initialize();
 
+  virtual void stop();
+
   // Return the (conservative) maximum heap alignment for any G1 heap
   static size_t conservative_max_heap_alignment();
 
@@ -1390,17 +1380,15 @@
   // space containing a given address, or else returns NULL.
   virtual Space* space_containing(const void* addr) const;
 
-  // A G1CollectedHeap will contain some number of heap regions.  This
-  // finds the region containing a given address, or else returns NULL.
+  // Returns the HeapRegion that contains addr. addr must not be NULL.
+  template <class T>
+  inline HeapRegion* heap_region_containing_raw(const T addr) const;
+
+  // Returns the HeapRegion that contains addr. addr must not be NULL.
+  // If addr is within a humongous continues region, it returns its humongous start region.
   template <class T>
   inline HeapRegion* heap_region_containing(const T addr) const;
 
-  // Like the above, but requires "addr" to be in the heap (to avoid a
-  // null-check), and unlike the above, may return an continuing humongous
-  // region.
-  template <class T>
-  inline HeapRegion* heap_region_containing_raw(const T addr) const;
-
   // A CollectedHeap is divided into a dense sequence of "blocks"; that is,
   // each address in the (reserved) heap is a member of exactly
   // one block.  The defining characteristic of a block is that it is
@@ -1542,7 +1530,6 @@
   // the region to which the object belongs. An object is dead
   // iff a) it was not allocated since the last mark and b) it
   // is not marked.
-
   bool is_obj_dead(const oop obj, const HeapRegion* hr) const {
     return
       !hr->obj_allocated_since_prev_marking(obj) &&
@@ -1552,7 +1539,6 @@
   // This function returns true when an object has been
   // around since the previous marking and hasn't yet
   // been marked during this marking.
-
   bool is_obj_ill(const oop obj, const HeapRegion* hr) const {
     return
       !hr->obj_allocated_since_next_marking(obj) &&
@@ -1698,15 +1684,19 @@
 
 public:
   G1ParGCAllocBuffer(size_t gclab_word_size);
+  virtual ~G1ParGCAllocBuffer() {
+    guarantee(_retired, "Allocation buffer has not been retired");
+  }
 
-  void set_buf(HeapWord* buf) {
+  virtual void set_buf(HeapWord* buf) {
     ParGCAllocBuffer::set_buf(buf);
     _retired = false;
   }
 
-  void retire(bool end_of_gc, bool retain) {
-    if (_retired)
+  virtual void retire(bool end_of_gc, bool retain) {
+    if (_retired) {
       return;
+    }
     ParGCAllocBuffer::retire(end_of_gc, retain);
     _retired = true;
   }
@@ -1776,6 +1766,7 @@
   G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num, ReferenceProcessor* rp);
 
   ~G1ParScanThreadState() {
+    retire_alloc_buffers();
     FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC);
   }
 
@@ -1886,6 +1877,7 @@
     return _surviving_young_words;
   }
 
+private:
   void retire_alloc_buffers() {
     for (int ap = 0; ap < GCAllocPurposeCount; ++ap) {
       size_t waste = _alloc_buffers[ap]->words_remaining();
@@ -1895,8 +1887,8 @@
                                                  false /* retain */);
     }
   }
-private:
-  #define G1_PARTIAL_ARRAY_MASK 0x2
+
+#define G1_PARTIAL_ARRAY_MASK 0x2
 
   inline bool has_partial_array_mask(oop* ref) const {
     return ((uintptr_t)ref & G1_PARTIAL_ARRAY_MASK) == G1_PARTIAL_ARRAY_MASK;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.inline.hpp	Mon May 05 12:49:13 2014 -0700
@@ -42,21 +42,22 @@
 
 template <class T>
 inline HeapRegion*
-G1CollectedHeap::heap_region_containing(const T addr) const {
-  HeapRegion* hr = _hrs.addr_to_region((HeapWord*) addr);
-  // hr can be null if addr in perm_gen
-  if (hr != NULL && hr->continuesHumongous()) {
-    hr = hr->humongous_start_region();
-  }
-  return hr;
+G1CollectedHeap::heap_region_containing_raw(const T addr) const {
+  assert(addr != NULL, "invariant");
+  assert(_g1_reserved.contains((const void*) addr),
+      err_msg("Address "PTR_FORMAT" is outside of the heap ranging from ["PTR_FORMAT" to "PTR_FORMAT")",
+          (void*)addr, _g1_reserved.start(), _g1_reserved.end()));
+  return _hrs.addr_to_region((HeapWord*) addr);
 }
 
 template <class T>
 inline HeapRegion*
-G1CollectedHeap::heap_region_containing_raw(const T addr) const {
-  assert(_g1_reserved.contains((const void*) addr), "invariant");
-  HeapRegion* res = _hrs.addr_to_region_unsafe((HeapWord*) addr);
-  return res;
+G1CollectedHeap::heap_region_containing(const T addr) const {
+  HeapRegion* hr = heap_region_containing_raw(addr);
+  if (hr->continuesHumongous()) {
+    return hr->humongous_start_region();
+  }
+  return hr;
 }
 
 inline void G1CollectedHeap::old_set_remove(HeapRegion* hr) {
@@ -134,8 +135,7 @@
   // have to keep calling heap_region_containing_raw() in the
   // asserts below.
   DEBUG_ONLY(HeapRegion* containing_hr = heap_region_containing_raw(start);)
-  assert(containing_hr != NULL && start != NULL && word_size > 0,
-         "pre-condition");
+  assert(word_size > 0, "pre-condition");
   assert(containing_hr->is_in(start), "it should contain start");
   assert(containing_hr->is_young(), "it should be young");
   assert(!containing_hr->isHumongous(), "it should not be humongous");
@@ -164,12 +164,7 @@
 // collection set or not. Assume that the reference
 // points into the heap.
 inline bool G1CollectedHeap::in_cset_fast_test(oop obj) {
-  assert(_in_cset_fast_test != NULL, "sanity");
-  assert(_g1_committed.contains((HeapWord*) obj), err_msg("Given reference outside of heap, is "PTR_FORMAT, (HeapWord*)obj));
-  // no need to subtract the bottom of the heap from obj,
-  // _in_cset_fast_test is biased
-  uintx index = cast_from_oop<uintx>(obj) >> HeapRegion::LogOfHRGrainBytes;
-  bool ret = _in_cset_fast_test[index];
+  bool ret = _in_cset_fast_test.get_by_address((HeapWord*)obj);
   // let's make sure the result is consistent with what the slower
   // test returns
   assert( ret || !obj_in_cs(obj), "sanity");
@@ -251,8 +246,10 @@
 #endif  // #ifndef PRODUCT
 
 inline bool G1CollectedHeap::is_in_young(const oop obj) {
-  HeapRegion* hr = heap_region_containing(obj);
-  return hr != NULL && hr->is_young();
+  if (obj == NULL) {
+    return false;
+  }
+  return heap_region_containing(obj)->is_young();
 }
 
 // We don't need barriers for initializing stores to objects
@@ -265,21 +262,17 @@
 }
 
 inline bool G1CollectedHeap::is_obj_dead(const oop obj) const {
-  const HeapRegion* hr = heap_region_containing(obj);
-  if (hr == NULL) {
-    if (obj == NULL) return false;
-    else return true;
+  if (obj == NULL) {
+    return false;
   }
-  else return is_obj_dead(obj, hr);
+  return is_obj_dead(obj, heap_region_containing(obj));
 }
 
 inline bool G1CollectedHeap::is_obj_ill(const oop obj) const {
-  const HeapRegion* hr = heap_region_containing(obj);
-  if (hr == NULL) {
-    if (obj == NULL) return false;
-    else return true;
+  if (obj == NULL) {
+    return false;
   }
-  else return is_obj_ill(obj, hr);
+  return is_obj_ill(obj, heap_region_containing(obj));
 }
 
 template <class T> inline void G1ParScanThreadState::immediate_rs_update(HeapRegion* from, T* p, int tid) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Mon May 05 12:49:13 2014 -0700
@@ -170,6 +170,8 @@
   _last_gc_worker_end_times_ms(_max_gc_threads, "%.1lf", false),
   _last_gc_worker_times_ms(_max_gc_threads, "%.1lf"),
   _last_gc_worker_other_times_ms(_max_gc_threads, "%.1lf"),
+  _last_redirty_logged_cards_time_ms(_max_gc_threads, "%.1lf"),
+  _last_redirty_logged_cards_processed_cards(_max_gc_threads, SIZE_FORMAT),
   _cur_string_dedup_queue_fixup_worker_times_ms(_max_gc_threads, "%.1lf"),
   _cur_string_dedup_table_fixup_worker_times_ms(_max_gc_threads, "%.1lf")
 {
@@ -195,6 +197,10 @@
   _last_gc_worker_end_times_ms.reset();
   _last_gc_worker_times_ms.reset();
   _last_gc_worker_other_times_ms.reset();
+
+  _last_redirty_logged_cards_time_ms.reset();
+  _last_redirty_logged_cards_processed_cards.reset();
+
 }
 
 void G1GCPhaseTimes::note_gc_end() {
@@ -230,6 +236,9 @@
 
   _last_gc_worker_times_ms.verify();
   _last_gc_worker_other_times_ms.verify();
+
+  _last_redirty_logged_cards_time_ms.verify();
+  _last_redirty_logged_cards_processed_cards.verify();
 }
 
 void G1GCPhaseTimes::note_string_dedup_fixup_start() {
@@ -349,6 +358,10 @@
   print_stats(2, "Ref Enq", _cur_ref_enq_time_ms);
   if (G1DeferredRSUpdate) {
     print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms);
+    if (G1Log::finest()) {
+      _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty");
+      _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards");
+    }
   }
   print_stats(2, "Free CSet",
     (_recorded_young_free_cset_time_ms +
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Mon May 05 12:49:13 2014 -0700
@@ -151,6 +151,8 @@
   double _recorded_young_cset_choice_time_ms;
   double _recorded_non_young_cset_choice_time_ms;
 
+  WorkerDataArray<double> _last_redirty_logged_cards_time_ms;
+  WorkerDataArray<size_t> _last_redirty_logged_cards_processed_cards;
   double _recorded_redirty_logged_cards_time_ms;
 
   double _recorded_young_free_cset_time_ms;
@@ -293,6 +295,14 @@
     _recorded_non_young_cset_choice_time_ms = time_ms;
   }
 
+  void record_redirty_logged_cards_time_ms(uint worker_i, double time_ms) {
+    _last_redirty_logged_cards_time_ms.set(worker_i, time_ms);
+  }
+
+  void record_redirty_logged_cards_processed_cards(uint worker_i, size_t processed_buffers) {
+    _last_redirty_logged_cards_processed_cards.set(worker_i, processed_buffers);
+  }
+
   void record_redirty_logged_cards_time_ms(double time_ms) {
     _recorded_redirty_logged_cards_time_ms = time_ms;
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.inline.hpp	Mon May 05 12:49:13 2014 -0700
@@ -125,9 +125,7 @@
   if (!oopDesc::is_null(heap_oop)) {
     oop obj = oopDesc::decode_heap_oop_not_null(heap_oop);
     HeapRegion* hr = _g1h->heap_region_containing((HeapWord*) obj);
-    if (hr != NULL) {
-      _cm->grayRoot(obj, obj->size(), _worker_id, hr);
-    }
+    _cm->grayRoot(obj, obj->size(), _worker_id, hr);
   }
 }
 
@@ -154,57 +152,63 @@
 template <class T>
 inline void G1UpdateRSOrPushRefOopClosure::do_oop_nv(T* p) {
   oop obj = oopDesc::load_decode_heap_oop(p);
+  if (obj == NULL) {
+    return;
+  }
+
 #ifdef ASSERT
   // can't do because of races
   // assert(obj == NULL || obj->is_oop(), "expected an oop");
 
   // Do the safe subset of is_oop
-  if (obj != NULL) {
 #ifdef CHECK_UNHANDLED_OOPS
-    oopDesc* o = obj.obj();
+  oopDesc* o = obj.obj();
 #else
-    oopDesc* o = obj;
+  oopDesc* o = obj;
 #endif // CHECK_UNHANDLED_OOPS
-    assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
-    assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
-  }
+  assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
+  assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
 #endif // ASSERT
 
   assert(_from != NULL, "from region must be non-NULL");
   assert(_from->is_in_reserved(p), "p is not in from");
 
   HeapRegion* to = _g1->heap_region_containing(obj);
-  if (to != NULL && _from != to) {
-    // The _record_refs_into_cset flag is true during the RSet
-    // updating part of an evacuation pause. It is false at all
-    // other times:
-    //  * rebuilding the remembered sets after a full GC
-    //  * during concurrent refinement.
-    //  * updating the remembered sets of regions in the collection
-    //    set in the event of an evacuation failure (when deferred
-    //    updates are enabled).
+  if (_from == to) {
+    // Normally this closure should only be called with cross-region references.
+    // But since Java threads are manipulating the references concurrently and we
+    // reload the values things may have changed.
+    return;
+  }
 
-    if (_record_refs_into_cset && to->in_collection_set()) {
-      // We are recording references that point into the collection
-      // set and this particular reference does exactly that...
-      // If the referenced object has already been forwarded
-      // to itself, we are handling an evacuation failure and
-      // we have already visited/tried to copy this object
-      // there is no need to retry.
-      if (!self_forwarded(obj)) {
-        assert(_push_ref_cl != NULL, "should not be null");
-        // Push the reference in the refs queue of the G1ParScanThreadState
-        // instance for this worker thread.
-        _push_ref_cl->do_oop(p);
-      }
+  // The _record_refs_into_cset flag is true during the RSet
+  // updating part of an evacuation pause. It is false at all
+  // other times:
+  //  * rebuilding the remembered sets after a full GC
+  //  * during concurrent refinement.
+  //  * updating the remembered sets of regions in the collection
+  //    set in the event of an evacuation failure (when deferred
+  //    updates are enabled).
 
-      // Deferred updates to the CSet are either discarded (in the normal case),
-      // or processed (if an evacuation failure occurs) at the end
-      // of the collection.
-      // See G1RemSet::cleanup_after_oops_into_collection_set_do().
-      return;
+  if (_record_refs_into_cset && to->in_collection_set()) {
+    // We are recording references that point into the collection
+    // set and this particular reference does exactly that...
+    // If the referenced object has already been forwarded
+    // to itself, we are handling an evacuation failure and
+    // we have already visited/tried to copy this object
+    // there is no need to retry.
+    if (!self_forwarded(obj)) {
+      assert(_push_ref_cl != NULL, "should not be null");
+      // Push the reference in the refs queue of the G1ParScanThreadState
+      // instance for this worker thread.
+      _push_ref_cl->do_oop(p);
     }
 
+    // Deferred updates to the CSet are either discarded (in the normal case),
+    // or processed (if an evacuation failure occurs) at the end
+    // of the collection.
+    // See G1RemSet::cleanup_after_oops_into_collection_set_do().
+  } else {
     // We either don't care about pushing references that point into the
     // collection set (i.e. we're not during an evacuation pause) _or_
     // the reference doesn't point into the collection set. Either way
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Mon May 05 12:49:13 2014 -0700
@@ -36,6 +36,7 @@
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #include "memory/iterator.hpp"
 #include "oops/oop.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/intHisto.hpp"
 
 #define CARD_REPEAT_HISTO 0
@@ -163,7 +164,7 @@
   void printCard(HeapRegion* card_region, size_t card_index,
                  HeapWord* card_start) {
     gclog_or_tty->print_cr("T %u Region [" PTR_FORMAT ", " PTR_FORMAT ") "
-                           "RS names card %p: "
+                           "RS names card " SIZE_FORMAT_HEX ": "
                            "[" PTR_FORMAT ", " PTR_FORMAT ")",
                            _worker_i,
                            card_region->bottom(), card_region->end(),
@@ -209,7 +210,6 @@
 #endif
 
       HeapRegion* card_region = _g1h->heap_region_containing(card_start);
-      assert(card_region != NULL, "Yielding cards not in the heap?");
       _cards++;
 
       if (!card_region->is_on_dirty_cards_region_list()) {
@@ -404,7 +404,6 @@
     HeapWord* start = _ct_bs->addr_for(card_ptr);
     // And find the region containing it.
     HeapRegion* r = _g1->heap_region_containing(start);
-    assert(r != NULL, "unexpected null");
 
     // Scan oops in the card looking for references into the collection set
     // Don't use addr_for(card_ptr + 1) which can ask for
@@ -566,11 +565,6 @@
   HeapWord* start = _ct_bs->addr_for(card_ptr);
   // And find the region containing it.
   HeapRegion* r = _g1->heap_region_containing(start);
-  if (r == NULL) {
-    // Again no need to return that this card contains refs that
-    // point into the collection set.
-    return false;  // Not in the G1 heap (might be in perm, for example.)
-  }
 
   // Why do we have to check here whether a card is on a young region,
   // given that we dirty young regions and, as a result, the
@@ -623,10 +617,6 @@
 
     start = _ct_bs->addr_for(card_ptr);
     r = _g1->heap_region_containing(start);
-    if (r == NULL) {
-      // Not in the G1 heap
-      return false;
-    }
 
     // Checking whether the region we got back from the cache
     // is young here is inappropriate. The region could have been
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.inline.hpp	Mon May 05 12:49:13 2014 -0700
@@ -45,26 +45,28 @@
 template <class T>
 inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, int tid) {
   oop obj = oopDesc::load_decode_heap_oop(p);
+  if (obj == NULL) {
+    return;
+  }
+
 #ifdef ASSERT
   // can't do because of races
   // assert(obj == NULL || obj->is_oop(), "expected an oop");
 
   // Do the safe subset of is_oop
-  if (obj != NULL) {
 #ifdef CHECK_UNHANDLED_OOPS
-    oopDesc* o = obj.obj();
+  oopDesc* o = obj.obj();
 #else
-    oopDesc* o = obj;
+  oopDesc* o = obj;
 #endif // CHECK_UNHANDLED_OOPS
-    assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
-    assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
-  }
+  assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
+  assert(Universe::heap()->is_in_reserved(obj), "must be in heap");
 #endif // ASSERT
 
   assert(from == NULL || from->is_in_reserved(p), "p is not in from");
 
   HeapRegion* to = _g1->heap_region_containing(obj);
-  if (to != NULL && from != to) {
+  if (from != to) {
     assert(to->rem_set() != NULL, "Need per-region 'into' remsets.");
     to->rem_set()->add_reference(p, tid);
   }
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp	Mon May 05 12:49:13 2014 -0700
@@ -44,6 +44,11 @@
   }
 }
 
+void G1StringDedup::stop() {
+  assert(is_enabled(), "String deduplication not enabled");
+  G1StringDedupThread::stop();
+}
+
 bool G1StringDedup::is_candidate_from_mark(oop obj) {
   if (java_lang_String::is_instance(obj)) {
     bool from_young = G1CollectedHeap::heap()->heap_region_containing_raw(obj)->is_young();
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp	Mon May 05 12:49:13 2014 -0700
@@ -110,8 +110,12 @@
     return _enabled;
   }
 
+  // Initialize string deduplication.
   static void initialize();
 
+  // Stop the deduplication thread.
+  static void stop();
+
   // Immediately deduplicates the given String object, bypassing the
   // the deduplication queue.
   static void deduplicate(oop java_string);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.cpp	Mon May 05 12:49:13 2014 -0700
@@ -35,6 +35,7 @@
 
 G1StringDedupQueue::G1StringDedupQueue() :
   _cursor(0),
+  _cancel(false),
   _empty(true),
   _dropped(0) {
   _nqueues = MAX2(ParallelGCThreads, (size_t)1);
@@ -55,11 +56,17 @@
 
 void G1StringDedupQueue::wait() {
   MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
-  while (_queue->_empty) {
+  while (_queue->_empty && !_queue->_cancel) {
     ml.wait(Mutex::_no_safepoint_check_flag);
   }
 }
 
+void G1StringDedupQueue::cancel_wait() {
+  MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
+  _queue->_cancel = true;
+  ml.notify();
+}
+
 void G1StringDedupQueue::push(uint worker_id, oop java_string) {
   assert(SafepointSynchronize::is_at_safepoint(), "Must be at safepoint");
   assert(worker_id < _queue->_nqueues, "Invalid queue");
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupQueue.hpp	Mon May 05 12:49:13 2014 -0700
@@ -65,6 +65,7 @@
   G1StringDedupWorkerQueue*  _queues;
   size_t                     _nqueues;
   size_t                     _cursor;
+  bool                       _cancel;
   volatile bool              _empty;
 
   // Statistics counter, only used for logging.
@@ -81,6 +82,9 @@
   // Blocks and waits for the queue to become non-empty.
   static void wait();
 
+  // Wakes up any thread blocked waiting for the queue to become non-empty.
+  static void cancel_wait();
+
   // Pushes a deduplication candidate onto a specific GC worker queue.
   static void push(uint worker_id, oop java_string);
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.cpp	Mon May 05 12:49:13 2014 -0700
@@ -73,42 +73,60 @@
 
     // Wait for the queue to become non-empty
     G1StringDedupQueue::wait();
+    if (_should_terminate) {
+      break;
+    }
 
-    // Include this thread in safepoints
-    stsJoin();
+    {
+      // Include thread in safepoints
+      SuspendibleThreadSetJoiner sts;
 
-    stat.mark_exec();
+      stat.mark_exec();
 
-    // Process the queue
-    for (;;) {
-      oop java_string = G1StringDedupQueue::pop();
-      if (java_string == NULL) {
-        break;
+      // Process the queue
+      for (;;) {
+        oop java_string = G1StringDedupQueue::pop();
+        if (java_string == NULL) {
+          break;
+        }
+
+        G1StringDedupTable::deduplicate(java_string, stat);
+
+        // Safepoint this thread if needed
+        if (sts.should_yield()) {
+          stat.mark_block();
+          sts.yield();
+          stat.mark_unblock();
+        }
       }
 
-      G1StringDedupTable::deduplicate(java_string, stat);
+      G1StringDedupTable::trim_entry_cache();
 
-      // Safepoint this thread if needed
-      if (stsShouldYield()) {
-        stat.mark_block();
-        stsYield(NULL);
-        stat.mark_unblock();
-      }
-    }
+      stat.mark_done();
 
-    G1StringDedupTable::trim_entry_cache();
-
-    stat.mark_done();
-
-    // Print statistics
-    total_stat.add(stat);
-    print(gclog_or_tty, stat, total_stat);
-
-    // Exclude this thread from safepoints
-    stsLeave();
+      // Print statistics
+      total_stat.add(stat);
+      print(gclog_or_tty, stat, total_stat);
+    }
   }
 
-  ShouldNotReachHere();
+  terminate();
+}
+
+void G1StringDedupThread::stop() {
+  {
+    MonitorLockerEx ml(Terminator_lock);
+    _thread->_should_terminate = true;
+  }
+
+  G1StringDedupQueue::cancel_wait();
+
+  {
+    MonitorLockerEx ml(Terminator_lock);
+    while (!_thread->_has_terminated) {
+      ml.wait();
+    }
+  }
 }
 
 void G1StringDedupThread::print(outputStream* st, const G1StringDedupStat& last_stat, const G1StringDedupStat& total_stat) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupThread.hpp	Mon May 05 12:49:13 2014 -0700
@@ -47,6 +47,8 @@
 
 public:
   static void create();
+  static void stop();
+
   static G1StringDedupThread* thread();
 
   virtual void run();
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Mon May 05 12:49:13 2014 -0700
@@ -167,7 +167,7 @@
 
   // Mem size in bytes.
   size_t mem_size() const {
-    return sizeof(this) + _bm.size_in_words() * HeapWordSize;
+    return sizeof(PerRegionTable) + _bm.size_in_words() * HeapWordSize;
   }
 
   // Requires "from" to be in "hr()".
@@ -491,7 +491,7 @@
       } else {
         if (G1TraceHeapRegionRememberedSet) {
           gclog_or_tty->print_cr("   [tid %d] sparse table entry "
-                        "overflow(f: %d, t: %d)",
+                        "overflow(f: %d, t: %u)",
                         tid, from_hrs_ind, cur_hrs_ind);
         }
       }
@@ -610,7 +610,7 @@
     _n_coarse_entries++;
     if (G1TraceHeapRegionRememberedSet) {
       gclog_or_tty->print("Coarsened entry in region [" PTR_FORMAT "...] "
-                 "for region [" PTR_FORMAT "...] (%d coarse entries).\n",
+                 "for region [" PTR_FORMAT "...] (" SIZE_FORMAT " coarse entries).\n",
                  hr()->bottom(),
                  max->hr()->bottom(),
                  _n_coarse_entries);
@@ -733,7 +733,7 @@
   sum += (sizeof(PerRegionTable*) * _max_fine_entries);
   sum += (_coarse_map.size_in_words() * HeapWordSize);
   sum += (_sparse_table.mem_size());
-  sum += sizeof(*this) - sizeof(_sparse_table); // Avoid double counting above.
+  sum += sizeof(OtherRegionsTable) - sizeof(_sparse_table); // Avoid double counting above.
   return sum;
 }
 
@@ -768,30 +768,6 @@
   clear_fcc();
 }
 
-void OtherRegionsTable::clear_incoming_entry(HeapRegion* from_hr) {
-  MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
-  size_t hrs_ind = (size_t) from_hr->hrs_index();
-  size_t ind = hrs_ind & _mod_max_fine_entries_mask;
-  if (del_single_region_table(ind, from_hr)) {
-    assert(!_coarse_map.at(hrs_ind), "Inv");
-  } else {
-    _coarse_map.par_at_put(hrs_ind, 0);
-  }
-  // Check to see if any of the fcc entries come from here.
-  uint hr_ind = hr()->hrs_index();
-  for (uint tid = 0; tid < HeapRegionRemSet::num_par_rem_sets(); tid++) {
-    int fcc_ent = FromCardCache::at(tid, hr_ind);
-    if (fcc_ent != FromCardCache::InvalidCard) {
-      HeapWord* card_addr = (HeapWord*)
-        (uintptr_t(fcc_ent) << CardTableModRefBS::card_shift);
-      if (hr()->is_in_reserved(card_addr)) {
-        // Clear the from card cache.
-        FromCardCache::set(tid, hr_ind, FromCardCache::InvalidCard);
-      }
-    }
-  }
-}
-
 bool OtherRegionsTable::del_single_region_table(size_t ind,
                                                 HeapRegion* hr) {
   assert(0 <= ind && ind < _max_fine_entries, "Preconditions.");
@@ -821,7 +797,6 @@
 
 bool OtherRegionsTable::contains_reference_locked(OopOrNarrowOopStar from) const {
   HeapRegion* hr = _g1h->heap_region_containing_raw(from);
-  if (hr == NULL) return false;
   RegionIdx_t hr_ind = (RegionIdx_t) hr->hrs_index();
   // Is this region in the coarse map?
   if (_coarse_map.at(hr_ind)) return true;
@@ -903,10 +878,12 @@
   }
   if (iter.n_yielded() != occupied()) {
     gclog_or_tty->print_cr("Yielded disagrees with occupied:");
-    gclog_or_tty->print_cr("  %6d yielded (%6d coarse, %6d fine).",
+    gclog_or_tty->print_cr("  " SIZE_FORMAT_W(6) " yielded (" SIZE_FORMAT_W(6)
+                  " coarse, " SIZE_FORMAT_W(6) " fine).",
                   iter.n_yielded(),
                   iter.n_yielded_coarse(), iter.n_yielded_fine());
-    gclog_or_tty->print_cr("  %6d occ     (%6d coarse, %6d fine).",
+    gclog_or_tty->print_cr("  " SIZE_FORMAT_W(6) " occ     (" SIZE_FORMAT_W(6)
+                           " coarse, " SIZE_FORMAT_W(6) " fine).",
                   occupied(), occ_coarse(), occ_fine());
   }
   guarantee(iter.n_yielded() == occupied(),
@@ -1046,20 +1023,16 @@
   return _code_roots.mem_size();
 }
 
-//-------------------- Iteration --------------------
-
 HeapRegionRemSetIterator:: HeapRegionRemSetIterator(HeapRegionRemSet* hrrs) :
   _hrrs(hrrs),
   _g1h(G1CollectedHeap::heap()),
   _coarse_map(&hrrs->_other_regions._coarse_map),
-  _fine_grain_regions(hrrs->_other_regions._fine_grain_regions),
   _bosa(hrrs->bosa()),
   _is(Sparse),
   // Set these values so that we increment to the first region.
   _coarse_cur_region_index(-1),
   _coarse_cur_region_cur_card(HeapRegion::CardsPerRegion-1),
-  _cur_region_cur_card(0),
-  _fine_array_index(-1),
+  _cur_card_in_prt(HeapRegion::CardsPerRegion),
   _fine_cur_prt(NULL),
   _n_yielded_coarse(0),
   _n_yielded_fine(0),
@@ -1091,58 +1064,59 @@
   return true;
 }
 
-void HeapRegionRemSetIterator::fine_find_next_non_null_prt() {
-  // Otherwise, find the next bucket list in the array.
-  _fine_array_index++;
-  while (_fine_array_index < (int) OtherRegionsTable::_max_fine_entries) {
-    _fine_cur_prt = _fine_grain_regions[_fine_array_index];
-    if (_fine_cur_prt != NULL) return;
-    else _fine_array_index++;
-  }
-  assert(_fine_cur_prt == NULL, "Loop post");
-}
-
 bool HeapRegionRemSetIterator::fine_has_next(size_t& card_index) {
   if (fine_has_next()) {
-    _cur_region_cur_card =
-      _fine_cur_prt->_bm.get_next_one_offset(_cur_region_cur_card + 1);
+    _cur_card_in_prt =
+      _fine_cur_prt->_bm.get_next_one_offset(_cur_card_in_prt + 1);
   }
-  while (!fine_has_next()) {
-    if (_cur_region_cur_card == (size_t) HeapRegion::CardsPerRegion) {
-      _cur_region_cur_card = 0;
-      _fine_cur_prt = _fine_cur_prt->collision_list_next();
+  if (_cur_card_in_prt == HeapRegion::CardsPerRegion) {
+    // _fine_cur_prt may still be NULL in case if there are not PRTs at all for
+    // the remembered set.
+    if (_fine_cur_prt == NULL || _fine_cur_prt->next() == NULL) {
+      return false;
     }
-    if (_fine_cur_prt == NULL) {
-      fine_find_next_non_null_prt();
-      if (_fine_cur_prt == NULL) return false;
-    }
-    assert(_fine_cur_prt != NULL && _cur_region_cur_card == 0,
-           "inv.");
-    HeapWord* r_bot =
-      _fine_cur_prt->hr()->bottom();
-    _cur_region_card_offset = _bosa->index_for(r_bot);
-    _cur_region_cur_card = _fine_cur_prt->_bm.get_next_one_offset(0);
+    PerRegionTable* next_prt = _fine_cur_prt->next();
+    switch_to_prt(next_prt);
+    _cur_card_in_prt = _fine_cur_prt->_bm.get_next_one_offset(_cur_card_in_prt + 1);
   }
-  assert(fine_has_next(), "Or else we exited the loop via the return.");
-  card_index = _cur_region_card_offset + _cur_region_cur_card;
+
+  card_index = _cur_region_card_offset + _cur_card_in_prt;
+  guarantee(_cur_card_in_prt < HeapRegion::CardsPerRegion,
+            err_msg("Card index "SIZE_FORMAT" must be within the region", _cur_card_in_prt));
   return true;
 }
 
 bool HeapRegionRemSetIterator::fine_has_next() {
-  return
-    _fine_cur_prt != NULL &&
-    _cur_region_cur_card < HeapRegion::CardsPerRegion;
+  return _cur_card_in_prt != HeapRegion::CardsPerRegion;
+}
+
+void HeapRegionRemSetIterator::switch_to_prt(PerRegionTable* prt) {
+  assert(prt != NULL, "Cannot switch to NULL prt");
+  _fine_cur_prt = prt;
+
+  HeapWord* r_bot = _fine_cur_prt->hr()->bottom();
+  _cur_region_card_offset = _bosa->index_for(r_bot);
+
+  // The bitmap scan for the PRT always scans from _cur_region_cur_card + 1.
+  // To avoid special-casing this start case, and not miss the first bitmap
+  // entry, initialize _cur_region_cur_card with -1 instead of 0.
+  _cur_card_in_prt = (size_t)-1;
 }
 
 bool HeapRegionRemSetIterator::has_next(size_t& card_index) {
   switch (_is) {
-  case Sparse:
+  case Sparse: {
     if (_sparse_iter.has_next(card_index)) {
       _n_yielded_sparse++;
       return true;
     }
     // Otherwise, deliberate fall-through
     _is = Fine;
+    PerRegionTable* initial_fine_prt = _hrrs->_other_regions._first_all_fine_prts;
+    if (initial_fine_prt != NULL) {
+      switch_to_prt(_hrrs->_other_regions._first_all_fine_prts);
+    }
+  }
   case Fine:
     if (fine_has_next(card_index)) {
       _n_yielded_fine++;
@@ -1274,6 +1248,11 @@
 #ifndef PRODUCT
 void PerRegionTable::test_fl_mem_size() {
   PerRegionTable* dummy = alloc(NULL);
+
+  size_t min_prt_size = sizeof(void*) + dummy->bm()->size_in_words() * HeapWordSize;
+  assert(dummy->mem_size() > min_prt_size,
+         err_msg("PerRegionTable memory usage is suspiciously small, only has "SIZE_FORMAT" bytes. "
+                 "Should be at least "SIZE_FORMAT" bytes.", dummy->mem_size(), min_prt_size));
   free(dummy);
   guarantee(dummy->mem_size() == fl_mem_size(), "fl_mem_size() does not return the correct element size");
   // try to reset the state
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Mon May 05 12:49:13 2014 -0700
@@ -206,9 +206,6 @@
   // Specifically clear the from_card_cache.
   void clear_fcc();
 
-  // "from_hr" is being cleared; remove any entries from it.
-  void clear_incoming_entry(HeapRegion* from_hr);
-
   void do_cleanup_work(HRRSCleanupTask* hrrs_cleanup_task);
 
   // Declare the heap size (in # of regions) to the OtherRegionsTable.
@@ -338,20 +335,20 @@
     return _other_regions.mem_size()
       // This correction is necessary because the above includes the second
       // part.
-      + (sizeof(this) - sizeof(OtherRegionsTable))
+      + (sizeof(HeapRegionRemSet) - sizeof(OtherRegionsTable))
       + strong_code_roots_mem_size();
   }
 
   // Returns the memory occupancy of all static data structures associated
   // with remembered sets.
   static size_t static_mem_size() {
-    return OtherRegionsTable::static_mem_size() + G1CodeRootSet::static_mem_size();
+    return OtherRegionsTable::static_mem_size() + G1CodeRootSet::free_chunks_static_mem_size();
   }
 
   // Returns the memory occupancy of all free_list data structures associated
   // with remembered sets.
   static size_t fl_mem_size() {
-    return OtherRegionsTable::fl_mem_size() + G1CodeRootSet::fl_mem_size();
+    return OtherRegionsTable::fl_mem_size() + G1CodeRootSet::free_chunks_mem_size();
   }
 
   bool contains_reference(OopOrNarrowOopStar from) const {
@@ -396,7 +393,6 @@
   // Declare the heap size (in # of regions) to the HeapRegionRemSet(s).
   // (Uses it to initialize from_card_cache).
   static void init_heap(uint max_regions) {
-    G1CodeRootSet::initialize();
     OtherRegionsTable::init_from_card_cache(max_regions);
   }
 
@@ -429,26 +425,24 @@
 };
 
 class HeapRegionRemSetIterator : public StackObj {
-
-  // The region RSet over which we're iterating.
+ private:
+  // The region RSet over which we are iterating.
   HeapRegionRemSet* _hrrs;
 
   // Local caching of HRRS fields.
   const BitMap*             _coarse_map;
-  PerRegionTable**          _fine_grain_regions;
 
   G1BlockOffsetSharedArray* _bosa;
   G1CollectedHeap*          _g1h;
 
-  // The number yielded since initialization.
+  // The number of cards yielded since initialization.
   size_t _n_yielded_fine;
   size_t _n_yielded_coarse;
   size_t _n_yielded_sparse;
 
-  // Indicates what granularity of table that we're currently iterating over.
+  // Indicates what granularity of table that we are currently iterating over.
   // We start iterating over the sparse table, progress to the fine grain
   // table, and then finish with the coarse table.
-  // See HeapRegionRemSetIterator::has_next().
   enum IterState {
     Sparse,
     Fine,
@@ -456,38 +450,30 @@
   };
   IterState _is;
 
-  // In both kinds of iteration, heap offset of first card of current
-  // region.
+  // For both Coarse and Fine remembered set iteration this contains the
+  // first card number of the heap region we currently iterate over.
   size_t _cur_region_card_offset;
-  // Card offset within cur region.
-  size_t _cur_region_cur_card;
 
-  // Coarse table iteration fields:
-
-  // Current region index;
+  // Current region index for the Coarse remembered set iteration.
   int    _coarse_cur_region_index;
   size_t _coarse_cur_region_cur_card;
 
   bool coarse_has_next(size_t& card_index);
 
-  // Fine table iteration fields:
-
-  // Index of bucket-list we're working on.
-  int _fine_array_index;
+  // The PRT we are currently iterating over.
+  PerRegionTable* _fine_cur_prt;
+  // Card offset within the current PRT.
+  size_t _cur_card_in_prt;
 
-  // Per Region Table we're doing within current bucket list.
-  PerRegionTable* _fine_cur_prt;
-
-  /* SparsePRT::*/ SparsePRTIter _sparse_iter;
-
-  void fine_find_next_non_null_prt();
-
+  // Update internal variables when switching to the given PRT.
+  void switch_to_prt(PerRegionTable* prt);
   bool fine_has_next();
   bool fine_has_next(size_t& card_index);
 
-public:
-  // We require an iterator to be initialized before use, so the
-  // constructor does little.
+  // The Sparse remembered set iterator.
+  SparsePRTIter _sparse_iter;
+
+ public:
   HeapRegionRemSetIterator(HeapRegionRemSet* hrrs);
 
   // If there remains one or more cards to be yielded, returns true and
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp	Mon May 05 12:49:13 2014 -0700
@@ -240,7 +240,6 @@
       // Asserts will fire if i is >= _length
       HeapWord* addr = hr->bottom();
       guarantee(addr_to_region(addr) == hr, "sanity");
-      guarantee(addr_to_region_unsafe(addr) == hr, "sanity");
     } else {
       guarantee(hr->is_empty(), "sanity");
       guarantee(!hr->isHumongous(), "sanity");
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp	Mon May 05 12:49:13 2014 -0700
@@ -110,10 +110,6 @@
   // HeapRegion, otherwise return NULL.
   inline HeapRegion* addr_to_region(HeapWord* addr) const;
 
-  // Return the HeapRegion that corresponds to the given
-  // address. Assume the address is valid.
-  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 _committed_length; }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.inline.hpp	Mon May 05 12:49:13 2014 -0700
@@ -28,21 +28,17 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "gc_implementation/g1/heapRegionSeq.hpp"
 
-inline HeapRegion* HeapRegionSeq::addr_to_region_unsafe(HeapWord* addr) const {
+inline HeapRegion* HeapRegionSeq::addr_to_region(HeapWord* addr) const {
+  assert(addr < heap_end(),
+        err_msg("addr: "PTR_FORMAT" end: "PTR_FORMAT, addr, heap_end()));
+  assert(addr >= heap_bottom(),
+        err_msg("addr: "PTR_FORMAT" bottom: "PTR_FORMAT, addr, heap_bottom()));
+
   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()));
-    return addr_to_region_unsafe(addr);
-  }
-  return NULL;
-}
-
 inline HeapRegion* HeapRegionSeq::at(uint index) const {
   assert(index < length(), "pre-condition");
   HeapRegion* hr = _regions.get_by_index(index);
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp	Mon May 05 12:49:13 2014 -0700
@@ -370,7 +370,7 @@
 }
 
 size_t RSHashTable::mem_size() const {
-  return sizeof(this) +
+  return sizeof(RSHashTable) +
     capacity() * (SparsePRTEntry::size() + sizeof(int));
 }
 
@@ -472,7 +472,7 @@
 size_t SparsePRT::mem_size() const {
   // We ignore "_cur" here, because it either = _next, or else it is
   // on the deleted list.
-  return sizeof(this) + _next->mem_size();
+  return sizeof(SparsePRT) + _next->mem_size();
 }
 
 bool SparsePRT::add_card(RegionIdx_t region_id, CardIdx_t card_index) {
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp	Mon May 05 12:49:13 2014 -0700
@@ -187,10 +187,10 @@
 #ifndef PRODUCT
 void
 SurvRateGroup::print() {
-  gclog_or_tty->print_cr("Surv Rate Group: %s (%d entries)",
+  gclog_or_tty->print_cr("Surv Rate Group: %s (" SIZE_FORMAT " entries)",
                 _name, _region_num);
   for (size_t i = 0; i < _region_num; ++i) {
-    gclog_or_tty->print_cr("    age %4d   surv rate %6.2lf %%   pred %6.2lf %%",
+    gclog_or_tty->print_cr("    age " SIZE_FORMAT_W(4) "   surv rate %6.2lf %%   pred %6.2lf %%",
                   i, _surv_rate[i] * 100.0,
                   _g1p->get_new_prediction(_surv_rate_pred[i]) * 100.0);
   }
@@ -203,14 +203,15 @@
     return;
 
   gclog_or_tty->print_cr("");
-  gclog_or_tty->print_cr("%s Rate Summary (for up to age %d)", _name, length-1);
+  gclog_or_tty->print_cr("%s Rate Summary (for up to age " SIZE_FORMAT ")", _name, length-1);
   gclog_or_tty->print_cr("      age range     survival rate (avg)      samples (avg)");
   gclog_or_tty->print_cr("  ---------------------------------------------------------");
 
   size_t index = 0;
   size_t limit = MIN2((int) length, 10);
   while (index < limit) {
-    gclog_or_tty->print_cr("           %4d                 %6.2lf%%             %6.2lf",
+    gclog_or_tty->print_cr("           " SIZE_FORMAT_W(4)
+                  "                 %6.2lf%%             %6.2lf",
                   index, _summary_surv_rates[index]->avg() * 100.0,
                   (double) _summary_surv_rates[index]->num());
     ++index;
@@ -228,7 +229,8 @@
     ++index;
 
     if (index == length || num % 10 == 0) {
-      gclog_or_tty->print_cr("   %4d .. %4d                 %6.2lf%%             %6.2lf",
+      gclog_or_tty->print_cr("   " SIZE_FORMAT_W(4) " .. " SIZE_FORMAT_W(4)
+                    "                 %6.2lf%%             %6.2lf",
                     (index-1) / 10 * 10, index-1, sum / (double) num,
                     (double) samples / (double) num);
       sum = 0.0;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/adjoiningGenerations.cpp	Mon May 05 12:49:13 2014 -0700
@@ -143,7 +143,8 @@
 
   if (TraceAdaptiveGCBoundary) {
     gclog_or_tty->print_cr("Before expansion of old gen with boundary move");
-    gclog_or_tty->print_cr("  Requested change: 0x%x  Attempted change: 0x%x",
+    gclog_or_tty->print_cr("  Requested change: " SIZE_FORMAT_HEX
+                           "  Attempted change: " SIZE_FORMAT_HEX,
       expand_in_bytes, change_in_bytes);
     if (!PrintHeapAtGC) {
       Universe::print_on(gclog_or_tty);
@@ -201,7 +202,7 @@
 
   if (TraceAdaptiveGCBoundary) {
     gclog_or_tty->print_cr("Before expansion of young gen with boundary move");
-    gclog_or_tty->print_cr("  Requested change: 0x%x  Attempted change: 0x%x",
+    gclog_or_tty->print_cr("  Requested change: " SIZE_FORMAT_HEX "  Attempted change: " SIZE_FORMAT_HEX,
       expand_in_bytes, change_in_bytes);
     if (!PrintHeapAtGC) {
       Universe::print_on(gclog_or_tty);
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSOldGen.cpp	Mon May 05 12:49:13 2014 -0700
@@ -127,22 +127,22 @@
   size_t result_aligned = align_size_down(result, gen_alignment);
   if (PrintAdaptiveSizePolicy && Verbose) {
     gclog_or_tty->print_cr("\nASPSOldGen::available_for_contraction:"
-      " %d K / 0x%x", result_aligned/K, result_aligned);
-    gclog_or_tty->print_cr(" reserved().byte_size() %d K / 0x%x ",
+      " " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, result_aligned/K, result_aligned);
+    gclog_or_tty->print_cr(" reserved().byte_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
       reserved().byte_size()/K, reserved().byte_size());
     size_t working_promoted = (size_t) policy->avg_promoted()->padded_average();
-    gclog_or_tty->print_cr(" padded promoted %d K / 0x%x",
+    gclog_or_tty->print_cr(" padded promoted " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
       working_promoted/K, working_promoted);
-    gclog_or_tty->print_cr(" used %d K / 0x%x",
+    gclog_or_tty->print_cr(" used " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
       used_in_bytes()/K, used_in_bytes());
-    gclog_or_tty->print_cr(" min_gen_size() %d K / 0x%x",
+    gclog_or_tty->print_cr(" min_gen_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
       min_gen_size()/K, min_gen_size());
-    gclog_or_tty->print_cr(" max_contraction %d K / 0x%x",
+    gclog_or_tty->print_cr(" max_contraction " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
       max_contraction/K, max_contraction);
-    gclog_or_tty->print_cr("    without alignment %d K / 0x%x",
+    gclog_or_tty->print_cr("    without alignment " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
       policy->promo_increment(max_contraction)/K,
       policy->promo_increment(max_contraction));
-    gclog_or_tty->print_cr(" alignment 0x%x", gen_alignment);
+    gclog_or_tty->print_cr(" alignment " SIZE_FORMAT_HEX, gen_alignment);
   }
   assert(result_aligned <= max_contraction, "arithmetic is wrong");
   return result_aligned;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/asPSYoungGen.cpp	Mon May 05 12:49:13 2014 -0700
@@ -112,11 +112,11 @@
     size_t result = policy->eden_increment_aligned_down(max_contraction);
     size_t result_aligned = align_size_down(result, gen_alignment);
     if (PrintAdaptiveSizePolicy && Verbose) {
-      gclog_or_tty->print_cr("ASPSYoungGen::available_for_contraction: %d K",
+      gclog_or_tty->print_cr("ASPSYoungGen::available_for_contraction: " SIZE_FORMAT " K",
         result_aligned/K);
-      gclog_or_tty->print_cr("  max_contraction %d K", max_contraction/K);
-      gclog_or_tty->print_cr("  eden_avail %d K", eden_avail/K);
-      gclog_or_tty->print_cr("  gen_avail %d K", gen_avail/K);
+      gclog_or_tty->print_cr("  max_contraction " SIZE_FORMAT " K", max_contraction/K);
+      gclog_or_tty->print_cr("  eden_avail " SIZE_FORMAT " K", eden_avail/K);
+      gclog_or_tty->print_cr("  gen_avail " SIZE_FORMAT " K", gen_avail/K);
     }
     return result_aligned;
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Mon May 05 12:49:13 2014 -0700
@@ -487,7 +487,7 @@
   if (TraceDynamicGCThreads) {
     gclog_or_tty->print_cr("GCTaskManager::set_active_gang(): "
                            "all_workers_active()  %d  workers %d  "
-                           "active  %d  ParallelGCThreads %d ",
+                           "active  %d  ParallelGCThreads " UINTX_FORMAT,
                            all_workers_active(), workers(),  active_workers(),
                            ParallelGCThreads);
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/objectStartArray.hpp	Mon May 05 12:49:13 2014 -0700
@@ -128,8 +128,6 @@
     // When doing MT offsets, we can't assert this.
     //assert(offset > *block, "Found backwards allocation");
     *block = (jbyte)offset;
-
-    // tty->print_cr("[%p]", p);
   }
 
   // Optimized for finding the first object that crosses into
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Mon May 05 12:49:13 2014 -0700
@@ -264,7 +264,7 @@
   cm->set_region_stack(ParCompactionManager::region_list(which_stack_index));
   if (TraceDynamicGCThreads) {
     gclog_or_tty->print_cr("StealRegionCompactionTask::do_it "
-                           "region_stack_index %d region_stack = 0x%x "
+                           "region_stack_index %d region_stack = " PTR_FORMAT " "
                            " empty (%d) use all workers %d",
     which_stack_index, ParCompactionManager::region_list(which_stack_index),
     cm->region_stack()->is_empty(),
@@ -366,7 +366,7 @@
     if (TraceDynamicGCThreads) {
       void* old_region_stack = (void*) cm->region_stack();
       int old_region_stack_index = cm->region_stack_index();
-      gclog_or_tty->print_cr("Pushing region stack 0x%x/%d",
+      gclog_or_tty->print_cr("Pushing region stack " PTR_FORMAT "/%d",
         old_region_stack, old_region_stack_index);
     }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psAdaptiveSizePolicy.cpp	Mon May 05 12:49:13 2014 -0700
@@ -379,7 +379,7 @@
       gclog_or_tty->print_cr(
             "PSAdaptiveSizePolicy::compute_eden_space_size: gc time limit"
             " gc_cost: %f "
-            " GCTimeLimit: %d",
+            " GCTimeLimit: " UINTX_FORMAT,
             gc_cost(), GCTimeLimit);
     }
   }
@@ -586,7 +586,7 @@
       gclog_or_tty->print_cr(
             "PSAdaptiveSizePolicy::compute_old_gen_free_space: gc time limit"
             " gc_cost: %f "
-            " GCTimeLimit: %d",
+            " GCTimeLimit: " UINTX_FORMAT,
             gc_cost(), GCTimeLimit);
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Mon May 05 12:49:13 2014 -0700
@@ -270,7 +270,8 @@
         gclog_or_tty->print_cr(" collection: %d ",
                        heap->total_collections());
         if (Verbose) {
-          gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
+          gclog_or_tty->print("old_gen_capacity: " SIZE_FORMAT
+            " young_gen_capacity: " SIZE_FORMAT,
             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
         }
       }
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Mon May 05 12:49:13 2014 -0700
@@ -1428,7 +1428,7 @@
                   "space_cap=" SIZE_FORMAT,
                   space_live, space_used,
                   space_capacity);
-    tty->print_cr("dead_wood_limiter(%6.4f, %d)=%6.4f "
+    tty->print_cr("dead_wood_limiter(%6.4f, " SIZE_FORMAT ")=%6.4f "
                   "dead_wood_max=" SIZE_FORMAT " dead_wood_limit=" SIZE_FORMAT,
                   density, min_percent_free, limiter,
                   dead_wood_max, dead_wood_limit);
@@ -2106,7 +2106,8 @@
         gclog_or_tty->print_cr(" collection: %d ",
                        heap->total_collections());
         if (Verbose) {
-          gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
+          gclog_or_tty->print("old_gen_capacity: " SIZE_FORMAT
+            " young_gen_capacity: " SIZE_FORMAT,
             old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
         }
       }
@@ -2559,7 +2560,7 @@
 
   if (TraceParallelOldGCCompactionPhase) {
     if (Verbose && (fillable_regions & 7) != 0) gclog_or_tty->cr();
-    gclog_or_tty->print_cr("%u initially fillable regions", fillable_regions);
+    gclog_or_tty->print_cr(SIZE_FORMAT " initially fillable regions", fillable_regions);
   }
 }
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Mon May 05 12:49:13 2014 -0700
@@ -330,7 +330,7 @@
 
 #ifndef PRODUCT
   if (TraceScavenge) {
-    gclog_or_tty->print_cr("{%s %s 0x%x (%d)}",
+    gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " (%d)}",
                            "promotion-failure",
                            obj->klass()->internal_name(),
                            (void *)obj, obj->size());
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Mon May 05 12:49:13 2014 -0700
@@ -510,7 +510,8 @@
                          heap->total_collections());
 
           if (Verbose) {
-            gclog_or_tty->print("old_gen_capacity: %d young_gen_capacity: %d",
+            gclog_or_tty->print("old_gen_capacity: " SIZE_FORMAT
+              " young_gen_capacity: " SIZE_FORMAT,
               old_gen->capacity_in_bytes(), young_gen->capacity_in_bytes());
           }
         }
@@ -728,7 +729,7 @@
     young_gen->object_iterate(&unforward_closure);
 
     if (PrintGC && Verbose) {
-      gclog_or_tty->print_cr("Restoring %d marks", _preserved_oop_stack.size());
+      gclog_or_tty->print_cr("Restoring " SIZE_FORMAT " marks", _preserved_oop_stack.size());
     }
 
     // Restore any saved marks.
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.inline.hpp	Mon May 05 12:49:13 2014 -0700
@@ -31,6 +31,7 @@
 #include "gc_implementation/parallelScavenge/psPromotionManager.inline.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
 #include "memory/iterator.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 inline void PSScavenge::save_to_space_top_before_gc() {
   ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
@@ -178,7 +179,7 @@
 #ifndef PRODUCT
     if (TraceScavenge) {
       ResourceMark rm;
-      gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass %p, %s, dirty: %s",
+      gclog_or_tty->print_cr("PSScavengeKlassClosure::do_klass " PTR_FORMAT ", %s, dirty: %s",
                              klass,
                              klass->external_name(),
                              klass->has_modified_oops() ? "true" : "false");
--- a/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp	Mon May 05 12:49:13 2014 -0700
@@ -168,9 +168,9 @@
 
   if (TraceDynamicGCThreads) {
      gclog_or_tty->print_cr("GCTaskManager::calc_default_active_workers() : "
-       "active_workers(): %d  new_active_workers: %d  "
-       "prev_active_workers: %d\n"
-       " active_workers_by_JT: %d  active_workers_by_heap_size: %d",
+       "active_workers(): " UINTX_FORMAT "  new_active_workers: " UINTX_FORMAT "  "
+       "prev_active_workers: " UINTX_FORMAT "\n"
+       " active_workers_by_JT: " UINTX_FORMAT "  active_workers_by_heap_size: " UINTX_FORMAT,
        active_workers, new_active_workers, prev_active_workers,
        active_workers_by_JT, active_workers_by_heap_size);
   }
@@ -545,12 +545,12 @@
   if (UseGCOverheadLimit && PrintGCDetails && Verbose) {
     if (gc_overhead_limit_exceeded()) {
       gclog_or_tty->print_cr("      GC is exceeding overhead limit "
-        "of %d%%", GCTimeLimit);
+        "of " UINTX_FORMAT "%%", GCTimeLimit);
       reset_gc_overhead_limit_count();
     } else if (print_gc_overhead_limit_would_be_exceeded) {
       assert(gc_overhead_limit_count() > 0, "Should not be printing");
       gclog_or_tty->print_cr("      GC would exceed overhead limit "
-        "of %d%% %d consecutive time(s)",
+        "of " UINTX_FORMAT "%% %d consecutive time(s)",
         GCTimeLimit, gc_overhead_limit_count());
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/allocationStats.hpp	Mon May 05 12:49:13 2014 -0700
@@ -120,8 +120,9 @@
       float delta_ise = (CMSExtrapolateSweep ? intra_sweep_estimate : 0.0);
       _desired = (ssize_t)(new_rate * (inter_sweep_estimate + delta_ise));
       if (PrintFLSStatistics > 1) {
-        gclog_or_tty->print_cr("demand: %d, old_rate: %f, current_rate: %f, new_rate: %f, old_desired: %d, new_desired: %d",
-                                demand,     old_rate,     rate,             new_rate,     old_desired,     _desired);
+        gclog_or_tty->print_cr("demand: " SSIZE_FORMAT ", old_rate: %f, current_rate: %f, "
+                               "new_rate: %f, old_desired: " SSIZE_FORMAT ", new_desired: " SSIZE_FORMAT,
+                                demand, old_rate, rate, new_rate, old_desired, _desired);
       }
     }
   }
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp	Mon May 05 12:49:13 2014 -0700
@@ -37,21 +37,10 @@
 
 int  ConcurrentGCThread::_CGC_flag            = CGC_nil;
 
-SuspendibleThreadSet ConcurrentGCThread::_sts;
-
 ConcurrentGCThread::ConcurrentGCThread() :
   _should_terminate(false), _has_terminated(false) {
-  _sts.initialize();
 };
 
-void ConcurrentGCThread::safepoint_synchronize() {
-  _sts.suspend_all();
-}
-
-void ConcurrentGCThread::safepoint_desynchronize() {
-  _sts.resume_all();
-}
-
 void ConcurrentGCThread::create_and_start() {
   if (os::create_thread(this, os::cgc_thread)) {
     // XXX: need to set this to low priority
@@ -92,78 +81,6 @@
   ThreadLocalStorage::set_thread(NULL);
 }
 
-
-void SuspendibleThreadSet::initialize_work() {
-  MutexLocker x(STS_init_lock);
-  if (!_initialized) {
-    _m             = new Monitor(Mutex::leaf,
-                                 "SuspendibleThreadSetLock", true);
-    _async         = 0;
-    _async_stop    = false;
-    _async_stopped = 0;
-    _initialized   = true;
-  }
-}
-
-void SuspendibleThreadSet::join() {
-  initialize();
-  MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
-  while (_async_stop) _m->wait(Mutex::_no_safepoint_check_flag);
-  _async++;
-  assert(_async > 0, "Huh.");
-}
-
-void SuspendibleThreadSet::leave() {
-  assert(_initialized, "Must be initialized.");
-  MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
-  _async--;
-  assert(_async >= 0, "Huh.");
-  if (_async_stop) _m->notify_all();
-}
-
-void SuspendibleThreadSet::yield(const char* id) {
-  assert(_initialized, "Must be initialized.");
-  if (_async_stop) {
-    MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
-    if (_async_stop) {
-      _async_stopped++;
-      assert(_async_stopped > 0, "Huh.");
-      if (_async_stopped == _async) {
-        if (ConcGCYieldTimeout > 0) {
-          double now = os::elapsedTime();
-          guarantee((now - _suspend_all_start) * 1000.0 <
-                    (double)ConcGCYieldTimeout,
-                    "Long delay; whodunit?");
-        }
-      }
-      _m->notify_all();
-      while (_async_stop) _m->wait(Mutex::_no_safepoint_check_flag);
-      _async_stopped--;
-      assert(_async >= 0, "Huh");
-      _m->notify_all();
-    }
-  }
-}
-
-void SuspendibleThreadSet::suspend_all() {
-  initialize();  // If necessary.
-  if (ConcGCYieldTimeout > 0) {
-    _suspend_all_start = os::elapsedTime();
-  }
-  MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
-  assert(!_async_stop, "Only one at a time.");
-  _async_stop = true;
-  while (_async_stopped < _async) _m->wait(Mutex::_no_safepoint_check_flag);
-}
-
-void SuspendibleThreadSet::resume_all() {
-  assert(_initialized, "Must be initialized.");
-  MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
-  assert(_async_stopped == _async, "Huh.");
-  _async_stop = false;
-  _m->notify_all();
-}
-
 static void _sltLoop(JavaThread* thread, TRAPS) {
   SurrogateLockerThread* slt = (SurrogateLockerThread*)thread;
   slt->loop();
@@ -283,30 +200,3 @@
   }
   assert(!_monitor.owned_by_self(), "Should unlock before exit.");
 }
-
-
-// ===== STS Access From Outside CGCT =====
-
-void ConcurrentGCThread::stsYield(const char* id) {
-  assert( Thread::current()->is_ConcurrentGC_thread(),
-          "only a conc GC thread can call this" );
-  _sts.yield(id);
-}
-
-bool ConcurrentGCThread::stsShouldYield() {
-  assert( Thread::current()->is_ConcurrentGC_thread(),
-          "only a conc GC thread can call this" );
-  return _sts.should_yield();
-}
-
-void ConcurrentGCThread::stsJoin() {
-  assert( Thread::current()->is_ConcurrentGC_thread(),
-          "only a conc GC thread can call this" );
-  _sts.join();
-}
-
-void ConcurrentGCThread::stsLeave() {
-  assert( Thread::current()->is_ConcurrentGC_thread(),
-          "only a conc GC thread can call this" );
-  _sts.leave();
-}
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp	Mon May 05 12:49:13 2014 -0700
@@ -26,55 +26,8 @@
 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP
 
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
+#include "gc_implementation/shared/suspendibleThreadSet.hpp"
 #include "runtime/thread.hpp"
-#endif // INCLUDE_ALL_GCS
-
-class VoidClosure;
-
-// A SuspendibleThreadSet is (obviously) a set of threads that can be
-// suspended.  A thread can join and later leave the set, and periodically
-// yield.  If some thread (not in the set) requests, via suspend_all, that
-// the threads be suspended, then the requesting thread is blocked until
-// all the threads in the set have yielded or left the set.  (Threads may
-// not enter the set when an attempted suspension is in progress.)  The
-// suspending thread later calls resume_all, allowing the suspended threads
-// to continue.
-
-class SuspendibleThreadSet {
-  Monitor* _m;
-  int      _async;
-  bool     _async_stop;
-  int      _async_stopped;
-  bool     _initialized;
-  double   _suspend_all_start;
-
-  void initialize_work();
-
- public:
-  SuspendibleThreadSet() : _initialized(false) {}
-
-  // Add the current thread to the set.  May block if a suspension
-  // is in progress.
-  void join();
-  // Removes the current thread from the set.
-  void leave();
-  // Returns "true" iff an suspension is in progress.
-  bool should_yield() { return _async_stop; }
-  // Suspends the current thread if a suspension is in progress (for
-  // the duration of the suspension.)
-  void yield(const char* id);
-  // Return when all threads in the set are suspended.
-  void suspend_all();
-  // Allow suspended threads to resume.
-  void resume_all();
-  // Redundant initializations okay.
-  void initialize() {
-    // Double-check dirty read idiom.
-    if (!_initialized) initialize_work();
-  }
-};
-
 
 class ConcurrentGCThread: public NamedThread {
   friend class VMStructs;
@@ -96,9 +49,6 @@
   static int set_CGC_flag(int b)           { return _CGC_flag |= b; }
   static int reset_CGC_flag(int b)         { return _CGC_flag &= ~b; }
 
-  // All instances share this one set.
-  static SuspendibleThreadSet _sts;
-
   // Create and start the thread (setting it's priority high.)
   void create_and_start();
 
@@ -121,25 +71,6 @@
 
   // Tester
   bool is_ConcurrentGC_thread() const          { return true;       }
-
-  static void safepoint_synchronize();
-  static void safepoint_desynchronize();
-
-  // All overridings should probably do _sts::yield, but we allow
-  // overriding for distinguished debugging messages.  Default is to do
-  // nothing.
-  virtual void yield() {}
-
-  bool should_yield() { return _sts.should_yield(); }
-
-  // they are prefixed by sts since there are already yield() and
-  // should_yield() (non-static) methods in this class and it was an
-  // easy way to differentiate them.
-  static void stsYield(const char* id);
-  static bool stsShouldYield();
-  static void stsJoin();
-  static void stsLeave();
-
 };
 
 // The SurrogateLockerThread is used by concurrent GC threads for
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Mon May 05 12:49:13 2014 -0700
@@ -131,7 +131,7 @@
   assert(_preserved_oop_stack.size() == _preserved_mark_stack.size(),
          "inconsistent preserved oop stacks");
   if (PrintGC && Verbose) {
-    gclog_or_tty->print_cr("Restoring %d marks",
+    gclog_or_tty->print_cr("Restoring " SIZE_FORMAT " marks",
                            _preserved_count + _preserved_oop_stack.size());
   }
 
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Mon May 05 12:49:13 2014 -0700
@@ -888,7 +888,9 @@
       for (int i = 0; i < lgrp_spaces()->length(); i++) {
         lgrp_spaces()->at(i)->accumulate_statistics(page_size());
       }
-      st->print("    local/remote/unbiased/uncommitted: %dK/%dK/%dK/%dK, large/small pages: %d/%d\n",
+      st->print("    local/remote/unbiased/uncommitted: " SIZE_FORMAT "K/"
+                SIZE_FORMAT "K/" SIZE_FORMAT "K/" SIZE_FORMAT
+                "K, large/small pages: " SIZE_FORMAT "/" SIZE_FORMAT "\n",
                 ls->space_stats()->_local_space / K,
                 ls->space_stats()->_remote_space / K,
                 ls->space_stats()->_unbiased_space / K,
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp	Mon May 05 12:49:13 2014 -0700
@@ -27,6 +27,7 @@
 #include "memory/sharedHeap.hpp"
 #include "oops/arrayOop.hpp"
 #include "oops/oop.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
 
 ParGCAllocBuffer::ParGCAllocBuffer(size_t desired_plab_sz_) :
   _word_sz(desired_plab_sz_), _bottom(NULL), _top(NULL),
@@ -112,7 +113,7 @@
   }
   _used = _allocated - _wasted - _unused;
   size_t plab_sz = _used/(target_refills*no_of_gc_workers);
-  if (PrintPLAB) gclog_or_tty->print(" (plab_sz = %d ", plab_sz);
+  if (PrintPLAB) gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " ", plab_sz);
   // Take historical weighted average
   _filter.sample(plab_sz);
   // Clip from above and below, and align to object boundary
@@ -120,7 +121,7 @@
   plab_sz = MIN2(max_size(), plab_sz);
   plab_sz = align_object_size(plab_sz);
   // Latch the result
-  if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = %d) ", plab_sz);
+  if (PrintPLAB) gclog_or_tty->print(" desired_plab_sz = " SIZE_FORMAT ") ", plab_sz);
   _desired_plab_sz = plab_sz;
   // Now clear the accumulators for next round:
   // note this needs to be fixed in the case where we
@@ -132,8 +133,9 @@
 
 #ifndef PRODUCT
 void ParGCAllocBuffer::print() {
-  gclog_or_tty->print("parGCAllocBuffer: _bottom: %p  _top: %p  _end: %p  _hard_end: %p"
-             "_retained: %c _retained_filler: [%p,%p)\n",
+  gclog_or_tty->print("parGCAllocBuffer: _bottom: " PTR_FORMAT "  _top: " PTR_FORMAT
+             "  _end: " PTR_FORMAT "  _hard_end: " PTR_FORMAT " _retained: %c"
+             " _retained_filler: [" PTR_FORMAT "," PTR_FORMAT ")\n",
              _bottom, _top, _end, _hard_end,
              "FT"[_retained], _retained_filler.start(), _retained_filler.end());
 }
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp	Mon May 05 12:49:13 2014 -0700
@@ -60,6 +60,7 @@
   // Initializes the buffer to be empty, but with the given "word_sz".
   // Must get initialized with "set_buf" for an allocation to succeed.
   ParGCAllocBuffer(size_t word_sz);
+  virtual ~ParGCAllocBuffer() {}
 
   static const size_t min_size() {
     return ThreadLocalAllocBuffer::min_size();
@@ -113,7 +114,7 @@
   }
 
   // Sets the space of the buffer to be [buf, space+word_sz()).
-  void set_buf(HeapWord* buf) {
+  virtual void set_buf(HeapWord* buf) {
     _bottom   = buf;
     _top      = _bottom;
     _hard_end = _bottom + word_sz();
@@ -158,7 +159,7 @@
   // Fills in the unallocated portion of the buffer with a garbage object.
   // If "end_of_gc" is TRUE, is after the last use in the GC.  IF "retain"
   // is true, attempt to re-use the unused portion in the next GC.
-  void retire(bool end_of_gc, bool retain);
+  virtual void retire(bool end_of_gc, bool retain);
 
   void print() PRODUCT_RETURN;
 };
@@ -238,14 +239,14 @@
 
   void undo_allocation(HeapWord* obj, size_t word_sz);
 
-  void set_buf(HeapWord* buf_start) {
+  virtual void set_buf(HeapWord* buf_start) {
     ParGCAllocBuffer::set_buf(buf_start);
     _true_end = _hard_end;
     _bt.set_region(MemRegion(buf_start, word_sz()));
     _bt.initialize_threshold();
   }
 
-  void retire(bool end_of_gc, bool retain);
+  virtual void retire(bool end_of_gc, bool retain);
 
   MemRegion range() {
     return MemRegion(_top, _true_end);
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceDecorator.cpp	Mon May 05 12:49:13 2014 -0700
@@ -84,7 +84,7 @@
   assert(ZapUnusedHeapArea, "Mangling should not be in use");
 #ifdef ASSERT
   if(TraceZapUnusedHeapArea) {
-    gclog_or_tty->print("Mangling [0x%x to 0x%x)", mr.start(), mr.end());
+    gclog_or_tty->print("Mangling [" PTR_FORMAT " to " PTR_FORMAT ")", mr.start(), mr.end());
   }
   Copy::fill_to_words(mr.start(), mr.word_size(), badHeapWord);
   if(TraceZapUnusedHeapArea) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/suspendibleThreadSet.cpp	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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/shared/suspendibleThreadSet.hpp"
+#include "runtime/mutexLocker.hpp"
+#include "runtime/thread.inline.hpp"
+
+uint   SuspendibleThreadSet::_nthreads          = 0;
+uint   SuspendibleThreadSet::_nthreads_stopped  = 0;
+bool   SuspendibleThreadSet::_suspend_all       = false;
+double SuspendibleThreadSet::_suspend_all_start = 0.0;
+
+void SuspendibleThreadSet::join() {
+  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  while (_suspend_all) {
+    ml.wait(Mutex::_no_safepoint_check_flag);
+  }
+  _nthreads++;
+}
+
+void SuspendibleThreadSet::leave() {
+  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  assert(_nthreads > 0, "Invalid");
+  _nthreads--;
+  if (_suspend_all) {
+    ml.notify_all();
+  }
+}
+
+void SuspendibleThreadSet::yield() {
+  if (_suspend_all) {
+    MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+    if (_suspend_all) {
+      _nthreads_stopped++;
+      if (_nthreads_stopped == _nthreads) {
+        if (ConcGCYieldTimeout > 0) {
+          double now = os::elapsedTime();
+          guarantee((now - _suspend_all_start) * 1000.0 < (double)ConcGCYieldTimeout, "Long delay");
+        }
+      }
+      ml.notify_all();
+      while (_suspend_all) {
+        ml.wait(Mutex::_no_safepoint_check_flag);
+      }
+      assert(_nthreads_stopped > 0, "Invalid");
+      _nthreads_stopped--;
+      ml.notify_all();
+    }
+  }
+}
+
+void SuspendibleThreadSet::synchronize() {
+  assert(Thread::current()->is_VM_thread(), "Must be the VM thread");
+  if (ConcGCYieldTimeout > 0) {
+    _suspend_all_start = os::elapsedTime();
+  }
+  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  assert(!_suspend_all, "Only one at a time");
+  _suspend_all = true;
+  while (_nthreads_stopped < _nthreads) {
+    ml.wait(Mutex::_no_safepoint_check_flag);
+  }
+}
+
+void SuspendibleThreadSet::desynchronize() {
+  assert(Thread::current()->is_VM_thread(), "Must be the VM thread");
+  MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
+  assert(_nthreads_stopped == _nthreads, "Invalid");
+  _suspend_all = false;
+  ml.notify_all();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/shared/suspendibleThreadSet.hpp	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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_SHARED_SUSPENDIBLETHREADSET_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_SHARED_SUSPENDIBLETHREADSET_HPP
+
+#include "memory/allocation.hpp"
+
+// A SuspendibleThreadSet is a set of threads that can be suspended.
+// A thread can join and later leave the set, and periodically yield.
+// If some thread (not in the set) requests, via synchronize(), that
+// the threads be suspended, then the requesting thread is blocked
+// until all the threads in the set have yielded or left the set. Threads
+// may not enter the set when an attempted suspension is in progress. The
+// suspending thread later calls desynchronize(), allowing the suspended
+// threads to continue.
+class SuspendibleThreadSet : public AllStatic {
+private:
+  static uint   _nthreads;
+  static uint   _nthreads_stopped;
+  static bool   _suspend_all;
+  static double _suspend_all_start;
+
+public:
+  // Add the current thread to the set. May block if a suspension is in progress.
+  static void join();
+
+  // Removes the current thread from the set.
+  static void leave();
+
+  // Returns true if an suspension is in progress.
+  static bool should_yield() { return _suspend_all; }
+
+  // Suspends the current thread if a suspension is in progress.
+  static void yield();
+
+  // Returns when all threads in the set are suspended.
+  static void synchronize();
+
+  // Resumes all suspended threads in the set.
+  static void desynchronize();
+};
+
+class SuspendibleThreadSetJoiner : public StackObj {
+public:
+  SuspendibleThreadSetJoiner() {
+    SuspendibleThreadSet::join();
+  }
+
+  ~SuspendibleThreadSetJoiner() {
+    SuspendibleThreadSet::leave();
+  }
+
+  bool should_yield() {
+    return SuspendibleThreadSet::should_yield();
+  }
+
+  void yield() {
+    SuspendibleThreadSet::yield();
+  }
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_SUSPENDIBLETHREADSET_HPP
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp	Mon May 05 12:49:13 2014 -0700
@@ -208,6 +208,9 @@
   // This is the correct place to place such initialization methods.
   virtual void post_initialize() = 0;
 
+  // Stop any onging concurrent work and prepare for exit.
+  virtual void stop() {}
+
   MemRegion reserved_region() const { return _reserved; }
   address base() const { return (address)reserved_region().start(); }
 
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp	Mon May 05 12:49:13 2014 -0700
@@ -1205,13 +1205,13 @@
          "------------------------------------\n");
   size_t total_size = total_chunk_size(debug_only(NULL));
   size_t    free_blocks = num_free_blocks();
-  gclog_or_tty->print("Total Free Space: %d\n", total_size);
-  gclog_or_tty->print("Max   Chunk Size: %d\n", max_chunk_size());
-  gclog_or_tty->print("Number of Blocks: %d\n", free_blocks);
+  gclog_or_tty->print("Total Free Space: " SIZE_FORMAT "\n", total_size);
+  gclog_or_tty->print("Max   Chunk Size: " SIZE_FORMAT "\n", max_chunk_size());
+  gclog_or_tty->print("Number of Blocks: " SIZE_FORMAT "\n", free_blocks);
   if (free_blocks > 0) {
-    gclog_or_tty->print("Av.  Block  Size: %d\n", total_size/free_blocks);
+    gclog_or_tty->print("Av.  Block  Size: " SIZE_FORMAT "\n", total_size/free_blocks);
   }
-  gclog_or_tty->print("Tree      Height: %d\n", tree_height());
+  gclog_or_tty->print("Tree      Height: " SIZE_FORMAT "\n", tree_height());
 }
 
 // Print census information - counts, births, deaths, etc.
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Mon May 05 12:49:13 2014 -0700
@@ -44,6 +44,7 @@
 #include "runtime/java.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/stack.inline.hpp"
 
 //
@@ -131,7 +132,7 @@
 #ifndef PRODUCT
   if (TraceScavenge) {
     ResourceMark rm;
-    gclog_or_tty->print_cr("KlassScanClosure::do_klass %p, %s, dirty: %s",
+    gclog_or_tty->print_cr("KlassScanClosure::do_klass " PTR_FORMAT ", %s, dirty: %s",
                            klass,
                            klass->external_name(),
                            klass->has_modified_oops() ? "true" : "false");
@@ -511,7 +512,7 @@
 HeapWord* DefNewGeneration::allocate_from_space(size_t size) {
   HeapWord* result = NULL;
   if (Verbose && PrintGCDetails) {
-    gclog_or_tty->print("DefNewGeneration::allocate_from_space(%u):"
+    gclog_or_tty->print("DefNewGeneration::allocate_from_space(" SIZE_FORMAT "):"
                         "  will_fail: %s"
                         "  heap_lock: %s"
                         "  free: " SIZE_FORMAT,
@@ -756,7 +757,7 @@
 
 void DefNewGeneration::handle_promotion_failure(oop old) {
   if (PrintPromotionFailure && !_promotion_failed) {
-    gclog_or_tty->print(" (promotion failure size = " SIZE_FORMAT ") ",
+    gclog_or_tty->print(" (promotion failure size = %d) ",
                         old->size());
   }
   _promotion_failed = true;
--- a/hotspot/src/share/vm/memory/generation.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/memory/generation.cpp	Mon May 05 12:49:13 2014 -0700
@@ -573,8 +573,8 @@
                       maximum_desired_capacity / (double) K);
         gclog_or_tty->print_cr("  "
                       "  shrink_bytes: %.1fK"
-                      "  current_shrink_factor: %d"
-                      "  new shrink factor: %d"
+                      "  current_shrink_factor: " SIZE_FORMAT
+                      "  new shrink factor: " SIZE_FORMAT
                       "  _min_heap_delta_bytes: %.1fK",
                       shrink_bytes / (double) K,
                       current_shrink_factor,
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Mon May 05 12:49:13 2014 -0700
@@ -257,7 +257,7 @@
                                        size_t bytes_before,
                                        size_t bytes_after,
                                        size_t capacity) {
-  out->print(" %d%s->%d%s(%d%s)",
+  out->print(" " SIZE_FORMAT "%s->" SIZE_FORMAT "%s(" SIZE_FORMAT "%s)",
              byte_size_in_proper_unit(bytes_before),
              proper_unit_for_byte_size(bytes_before),
              byte_size_in_proper_unit(bytes_after),
--- a/hotspot/src/share/vm/oops/methodData.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Mon May 05 12:49:13 2014 -0700
@@ -1012,6 +1012,11 @@
   static ByteSize argument_type_offset(int i) {
     return in_ByteSize(argument_type_local_offset(i) * DataLayout::cell_size);
   }
+
+  static ByteSize return_only_size() {
+    return ReturnTypeEntry::size() + in_ByteSize(header_cell_count() * DataLayout::cell_size);
+  }
+
 };
 
 // CallTypeData
@@ -2143,7 +2148,6 @@
 
   static bool profile_jsr292(methodHandle m, int bci);
   static int profile_arguments_flag();
-  static bool profile_arguments_jsr292_only();
   static bool profile_all_arguments();
   static bool profile_arguments_for_invoke(methodHandle m, int bci);
   static int profile_return_flag();
@@ -2442,6 +2446,7 @@
 
   static bool profile_parameters_for_method(methodHandle m);
   static bool profile_arguments();
+  static bool profile_arguments_jsr292_only();
   static bool profile_return();
   static bool profile_parameters();
   static bool profile_return_jsr292_only();
--- a/hotspot/src/share/vm/opto/superword.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/opto/superword.cpp	Mon May 05 12:49:13 2014 -0700
@@ -1266,8 +1266,9 @@
     memops.clear();
     for (DUIterator i = upper_insert_pt->outs(); upper_insert_pt->has_out(i); i++) {
       Node* use = upper_insert_pt->out(i);
-      if (!use->is_Store())
+      if (use->is_Mem() && !use->is_Store()) {
         memops.push(use);
+      }
     }
 
     MemNode* lower_insert_pt = last;
--- a/hotspot/src/share/vm/runtime/globals.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon May 05 12:49:13 2014 -0700
@@ -1931,6 +1931,10 @@
           "not just one of the generations (e.g., G1). A value of 0 "       \
           "denotes 'do constant GC cycles'.")                               \
                                                                             \
+  manageable(intx, CMSTriggerInterval, -1,                                  \
+          "Commence a CMS collection cycle (at least) every so many "       \
+          "milliseconds (0 permanently, -1 disabled)")                      \
+                                                                            \
   product(bool, UseCMSInitiatingOccupancyOnly, false,                       \
           "Only use occupancy as a criterion for starting a CMS collection")\
                                                                             \
--- a/hotspot/src/share/vm/runtime/java.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/runtime/java.cpp	Mon May 05 12:49:13 2014 -0700
@@ -499,6 +499,9 @@
     os::infinite_sleep();
   }
 
+  // Stop any ongoing concurrent GC work
+  Universe::heap()->stop();
+
   // Terminate watcher thread - must before disenrolling any periodic task
   if (PeriodicTask::num_tasks() > 0)
     WatcherThread::stop();
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Mon May 05 12:49:13 2014 -0700
@@ -69,7 +69,7 @@
 Monitor* SerializePage_lock           = NULL;
 Monitor* Threads_lock                 = NULL;
 Monitor* CGC_lock                     = NULL;
-Mutex*   STS_init_lock                = NULL;
+Monitor* STS_lock                     = NULL;
 Monitor* SLT_lock                     = NULL;
 Monitor* iCMS_lock                    = NULL;
 Monitor* FullGCCount_lock             = NULL;
@@ -173,7 +173,7 @@
   def(tty_lock                     , Mutex  , event,       true ); // allow to lock in VM
 
   def(CGC_lock                   , Monitor, special,     true ); // coordinate between fore- and background GC
-  def(STS_init_lock              , Mutex,   leaf,        true );
+  def(STS_lock                   , Monitor, leaf,        true );
   if (UseConcMarkSweepGC) {
     def(iCMS_lock                  , Monitor, special,     true ); // CMS incremental mode start/stop notification
   }
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp	Mon May 05 12:49:13 2014 -0700
@@ -79,7 +79,7 @@
                                                  // (also used by Safepoints too to block threads creation/destruction)
 extern Monitor* CGC_lock;                        // used for coordination between
                                                  // fore- & background GC threads.
-extern Mutex*   STS_init_lock;                   // coordinate initialization of SuspendibleThreadSets.
+extern Monitor* STS_lock;                        // used for joining/leaving SuspendibleThreadSet.
 extern Monitor* SLT_lock;                        // used in CMS GC for acquiring PLL
 extern Monitor* iCMS_lock;                       // CMS incremental mode start/stop notification
 extern Monitor* FullGCCount_lock;                // in support of "concurrent" full gc
--- a/hotspot/src/share/vm/runtime/safepoint.cpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp	Mon May 05 12:49:13 2014 -0700
@@ -75,7 +75,7 @@
 #endif
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
-#include "gc_implementation/shared/concurrentGCThread.hpp"
+#include "gc_implementation/shared/suspendibleThreadSet.hpp"
 #endif // INCLUDE_ALL_GCS
 #ifdef COMPILER1
 #include "c1/c1_globals.hpp"
@@ -110,7 +110,7 @@
     // more-general mechanism below.  DLD (01/05).
     ConcurrentMarkSweepThread::synchronize(false);
   } else if (UseG1GC) {
-    ConcurrentGCThread::safepoint_synchronize();
+    SuspendibleThreadSet::synchronize();
   }
 #endif // INCLUDE_ALL_GCS
 
@@ -486,7 +486,7 @@
   if (UseConcMarkSweepGC) {
     ConcurrentMarkSweepThread::desynchronize(false);
   } else if (UseG1GC) {
-    ConcurrentGCThread::safepoint_desynchronize();
+    SuspendibleThreadSet::desynchronize();
   }
 #endif // INCLUDE_ALL_GCS
   // record this time so VMThread can keep track how much time has elapsed
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp	Mon May 05 12:49:13 2014 -0700
@@ -1324,10 +1324,12 @@
 #define PTR_FORMAT    "0x%08"  PRIxPTR
 #endif  // _LP64
 
-#define SSIZE_FORMAT          "%" PRIdPTR
-#define SIZE_FORMAT           "%" PRIuPTR
-#define SSIZE_FORMAT_W(width) "%" #width PRIdPTR
-#define SIZE_FORMAT_W(width)  "%" #width PRIuPTR
+#define SSIZE_FORMAT             "%"   PRIdPTR
+#define SIZE_FORMAT              "%"   PRIuPTR
+#define SIZE_FORMAT_HEX          "0x%" PRIxPTR
+#define SSIZE_FORMAT_W(width)    "%"   #width PRIdPTR
+#define SIZE_FORMAT_W(width)     "%"   #width PRIuPTR
+#define SIZE_FORMAT_HEX_W(width) "0x%" #width PRIxPTR
 
 #define INTX_FORMAT           "%" PRIdPTR
 #define UINTX_FORMAT          "%" PRIuPTR
--- a/hotspot/test/TEST.groups	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/test/TEST.groups	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -127,10 +127,12 @@
   gc/6581734/Test6581734.java \
   gc/7072527/TestFullGCCount.java \
   gc/g1/TestHumongousAllocInitialMark.java \
+  gc/g1/TestHumongousShrinkHeap.java \
   gc/arguments/TestG1HeapRegionSize.java \
   gc/metaspace/TestMetaspaceMemoryPool.java \
   gc/arguments/TestDynMinHeapFreeRatio.java \
   gc/arguments/TestDynMaxHeapFreeRatio.java \
+  gc/parallelScavenge/TestDynShrinkHeap.java \
   runtime/InternalApi/ThreadCpuTimesDeadlock.java \
   serviceability/threads/TestFalseDeadLock.java \
   compiler/tiered/NonTieredLevelsTest.java \
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Mon May 05 09:41:41 2014 -0700
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Mon May 05 12:49:13 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test TestPrintGCDetails
- * @bug 8035406 8027295 8035398
+ * @bug 8035406 8027295 8035398 8019342
  * @summary Ensure that the PrintGCDetails output for a minor GC with G1
  * includes the expected necessary messages.
  * @key gc
@@ -48,6 +48,8 @@
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
 
     output.shouldNotContain("[Redirty Cards");
+    output.shouldNotContain("[Parallel Redirty");
+    output.shouldNotContain("[Redirtied Cards");
     output.shouldNotContain("[Code Root Purge");
     output.shouldNotContain("[String Dedup Fixup");
     output.shouldNotContain("[Young Free CSet");
@@ -63,6 +65,8 @@
     output = new OutputAnalyzer(pb.start());
 
     output.shouldContain("[Redirty Cards");
+    output.shouldNotContain("[Parallel Redirty");
+    output.shouldNotContain("[Redirtied Cards");
     output.shouldContain("[Code Root Purge");
     output.shouldContain("[String Dedup Fixup");
     output.shouldNotContain("[Young Free CSet");
@@ -80,6 +84,8 @@
     output = new OutputAnalyzer(pb.start());
 
     output.shouldContain("[Redirty Cards");
+    output.shouldContain("[Parallel Redirty");
+    output.shouldContain("[Redirtied Cards");
     output.shouldContain("[Code Root Purge");
     output.shouldContain("[String Dedup Fixup");
     output.shouldContain("[Young Free CSet");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 TestHumongousShrinkHeap
+ * @bug 8036025
+ * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects
+ * @library /testlibrary
+ * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap
+ */
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryUsage;
+import java.util.ArrayList;
+import java.util.List;
+import sun.management.ManagementFactoryHelper;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class TestHumongousShrinkHeap {
+
+    public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
+    public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
+
+    private static final ArrayList<ArrayList<byte[]>> garbage = new ArrayList<>();
+    private static final int PAGE_SIZE = 1024 * 1024; // 1M
+    private static final int PAGES_NUM = 5;
+
+
+    public static void main(String[] args) {
+        new TestHumongousShrinkHeap().test();
+    }
+
+    private final void test() {
+        System.gc();
+        MemoryUsagePrinter.printMemoryUsage("init");
+
+        eat();
+        MemoryUsagePrinter.printMemoryUsage("eaten");
+        MemoryUsage muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+
+        free();
+        MemoryUsagePrinter.printMemoryUsage("free");
+        MemoryUsage muFree = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+
+        assertLessThan(muFree.getCommitted(), muFull.getCommitted(), String.format(
+                "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
+                + "%s = %s%n%s = %s",
+                MIN_FREE_RATIO_FLAG_NAME,
+                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
+                MAX_FREE_RATIO_FLAG_NAME,
+                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
+        ));
+    }
+
+    private void eat() {
+        int HumongousObjectSize = Math.round(.9f * PAGE_SIZE);
+        System.out.println("Will allocate objects of size=" +
+                MemoryUsagePrinter.humanReadableByteCount(HumongousObjectSize, true));
+
+        for (int i = 0; i < PAGES_NUM; i++) {
+            ArrayList<byte[]> stuff = new ArrayList<>();
+            eatList(stuff, 100, HumongousObjectSize);
+            MemoryUsagePrinter.printMemoryUsage("eat #" + i);
+            garbage.add(stuff);
+        }
+    }
+
+    private void free() {
+        // do not free last one list
+        garbage.subList(0, garbage.size() - 1).clear();
+
+        // do not free last one element from last list
+        ArrayList stuff = garbage.get(garbage.size() - 1);
+        stuff.subList(0, stuff.size() - 1).clear();
+        System.gc();
+    }
+
+    private static void eatList(List garbage, int count, int size) {
+        for (int i = 0; i < count; i++) {
+            garbage.add(new byte[size]);
+        }
+    }
+}
+
+/**
+ * Prints memory usage to standard output
+ */
+class MemoryUsagePrinter {
+
+    public static String humanReadableByteCount(long bytes, boolean si) {
+        int unit = si ? 1000 : 1024;
+        if (bytes < unit) {
+            return bytes + " B";
+        }
+        int exp = (int) (Math.log(bytes) / Math.log(unit));
+        String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
+        return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
+    }
+
+    public static void printMemoryUsage(String label) {
+        MemoryUsage memusage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+        float freeratio = 1f - (float) memusage.getUsed() / memusage.getCommitted();
+        System.out.format("[%-24s] init: %-7s, used: %-7s, comm: %-7s, freeRatio ~= %.1f%%%n",
+                label,
+                humanReadableByteCount(memusage.getInit(), true),
+                humanReadableByteCount(memusage.getUsed(), true),
+                humanReadableByteCount(memusage.getCommitted(), true),
+                freeratio * 100
+        );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 TestDynShrinkHeap
+ * @bug 8016479
+ * @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags
+ * @library /testlibrary
+ * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -verbose:gc TestDynShrinkHeap
+ */
+
+import com.oracle.java.testlibrary.TestDynamicVMOption;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryUsage;
+import java.util.ArrayList;
+import sun.management.ManagementFactoryHelper;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class TestDynShrinkHeap {
+
+    public static final String MIN_FREE_RATIO_FLAG_NAME = "MinHeapFreeRatio";
+    public static final String MAX_FREE_RATIO_FLAG_NAME = "MaxHeapFreeRatio";
+
+    private static ArrayList<byte[]> list = new ArrayList<>(0);
+    private static final int M = 1024 * 1024; // to make heap more manageable by test code
+
+    private final TestDynamicVMOption maxRatioOption;
+    private final TestDynamicVMOption minRatioOption;
+
+    public TestDynShrinkHeap() {
+        minRatioOption = new TestDynamicVMOption(MIN_FREE_RATIO_FLAG_NAME);
+        maxRatioOption = new TestDynamicVMOption(MAX_FREE_RATIO_FLAG_NAME);
+    }
+
+    private final void test() {
+        System.gc();
+        MemoryUsagePrinter.printMemoryUsage("init");
+
+        eat();
+        MemoryUsagePrinter.printMemoryUsage("eaten");
+        MemoryUsage muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+
+        free();
+        MemoryUsagePrinter.printMemoryUsage("free");
+        MemoryUsage muFree = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+
+        assertLessThan(muFree.getCommitted(), muFull.getCommitted(), String.format(
+                "committed free heap size is not less than committed full heap size, heap hasn't been shrunk?%n"
+                + "%s = %s%n%s = %s",
+                MIN_FREE_RATIO_FLAG_NAME,
+                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MIN_FREE_RATIO_FLAG_NAME).getValue(),
+                MAX_FREE_RATIO_FLAG_NAME,
+                ManagementFactoryHelper.getDiagnosticMXBean().getVMOption(MAX_FREE_RATIO_FLAG_NAME).getValue()
+        ));
+    }
+
+    private void eat() {
+        for (int i = 0; i < M; i++) {
+            list.add(new byte[1024]);
+        }
+        MemoryUsagePrinter.printMemoryUsage("allocated " + M + " arrays");
+
+        list.subList(0, M / 2).clear();
+        System.gc();
+        MemoryUsagePrinter.printMemoryUsage("array halved");
+    }
+
+    private void free() {
+        maxRatioOption.setIntValue(minRatioOption.getIntValue() + 1);
+        System.gc();
+        MemoryUsagePrinter.printMemoryUsage("under pressure");
+    }
+
+    public static void main(String[] args) {
+        new TestDynShrinkHeap().test();
+    }
+}
+
+/**
+ * Prints memory usage to standard output
+ */
+class MemoryUsagePrinter {
+
+    public static String humanReadableByteCount(long bytes, boolean si) {
+        int unit = si ? 1000 : 1024;
+        if (bytes < unit) {
+            return bytes + " B";
+        }
+        int exp = (int) (Math.log(bytes) / Math.log(unit));
+        String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp - 1) + (si ? "" : "i");
+        return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre);
+    }
+
+    public static void printMemoryUsage(String label) {
+        MemoryUsage memusage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+        float freeratio = 1f - (float) memusage.getUsed() / memusage.getCommitted();
+        System.out.format("[%-24s] init: %-7s, used: %-7s, comm: %-7s, freeRatio ~= %.1f%%%n",
+                label,
+                humanReadableByteCount(memusage.getInit(), true),
+                humanReadableByteCount(memusage.getUsed(), true),
+                humanReadableByteCount(memusage.getCommitted(), true),
+                freeratio * 100
+        );
+    }
+}
--- a/hotspot/test/runtime/6925573/SortMethodsTest.java	Mon May 05 09:41:41 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Vector;
-
-import javax.tools.Diagnostic;
-import javax.tools.DiagnosticCollector;
-import javax.tools.FileObject;
-import javax.tools.ForwardingJavaFileManager;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaCompiler.CompilationTask;
-import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
-import javax.tools.JavaFileObject.Kind;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-/*
- * @ignore 6959423
- * @test SortMethodsTest
- * @bug 6925573
- * @summary verify that class loading does not need quadratic time with regard to the number of class
-methods.
- * @run main SortMethodsTest
- * @author volker.simonis@gmail.com
-*/
-
-public class SortMethodsTest {
-
-  static String createClass(String name, int nrOfMethods) {
-    StringWriter sw = new StringWriter();
-    PrintWriter pw = new PrintWriter(sw);
-    pw.println("public class " + name + "{");
-    for (int i = 0; i < nrOfMethods; i++) {
-      pw.println("  public void m" + i + "() {}");
-    }
-    pw.println("  public static String sayHello() {");
-    pw.println("    return \"Hello from class \" + " + name +
-               ".class.getName() + \" with \" + " + name +
-               ".class.getDeclaredMethods().length + \" methods\";");
-    pw.println("  }");
-    pw.println("}");
-    pw.close();
-    return sw.toString();
-  }
-
-  public static void main(String args[]) {
-
-    JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
-    DiagnosticCollector<JavaFileObject> diags = new DiagnosticCollector<JavaFileObject>();
-    final String cName = new String("ManyMethodsClass");
-    Vector<Long> results = new Vector<Long>();
-
-    for (int i = 6; i < 600000; i*=10) {
-      String klass =  createClass(cName, i);
-      JavaMemoryFileObject file = new JavaMemoryFileObject(cName, klass);
-      MemoryFileManager mfm = new MemoryFileManager(comp.getStandardFileManager(diags, null, null), file);
-      CompilationTask task = comp.getTask(null, mfm, diags, null, null, Arrays.asList(file));
-
-      if (task.call()) {
-        try {
-          MemoryClassLoader mcl = new MemoryClassLoader(file);
-          long start = System.nanoTime();
-          Class<? extends Object> c = Class.forName(cName, true, mcl);
-          long end = System.nanoTime();
-          results.add(end - start);
-          Method m = c.getDeclaredMethod("sayHello", new Class[0]);
-          String ret = (String)m.invoke(null, new Object[0]);
-          System.out.println(ret + " (loaded and resloved in " + (end - start) + "ns)");
-        } catch (Exception e) {
-          System.err.println(e);
-        }
-      }
-      else {
-        System.out.println(klass);
-        System.out.println();
-        for (Diagnostic diag : diags.getDiagnostics()) {
-          System.out.println(diag.getCode() + "\n" + diag.getKind() + "\n" + diag.getPosition());
-          System.out.println(diag.getSource() + "\n" + diag.getMessage(null));
-        }
-      }
-    }
-
-    long lastRatio = 0;
-    for (int i = 2; i < results.size(); i++) {
-      long normalized1 = Math.max(results.get(i-1) - results.get(0), 1);
-      long normalized2 = Math.max(results.get(i) - results.get(0), 1);
-      long ratio = normalized2/normalized1;
-      lastRatio = ratio;
-      System.out.println("10 x more methods requires " + ratio + " x more time");
-    }
-    // The following is just vague estimation but seems to work on current x86_64 and sparcv9 machines
-    if (lastRatio > 80) {
-      throw new RuntimeException("ATTENTION: it seems that class loading needs quadratic time with regard to the number of class methods!!!");
-    }
-  }
-}
-
-class JavaMemoryFileObject extends SimpleJavaFileObject {
-
-  private final String code;
-  private ByteArrayOutputStream byteCode;
-
-  JavaMemoryFileObject(String name, String code) {
-    super(URI.create("string:///" + name.replace('.','/') + Kind.SOURCE.extension), Kind.SOURCE);
-    this.code = code;
-  }
-
-  @Override
-  public CharSequence getCharContent(boolean ignoreEncodingErrors) {
-    return code;
-  }
-
-  @Override
-  public OutputStream openOutputStream() {
-    byteCode = new ByteArrayOutputStream();
-    return byteCode;
-  }
-
-  byte[] getByteCode() {
-    return byteCode.toByteArray();
-   }
-}
-
-class MemoryClassLoader extends ClassLoader {
-
-  private final JavaMemoryFileObject jfo;
-
-  public MemoryClassLoader(JavaMemoryFileObject jfo) {
-    this.jfo = jfo;
-  }
-
-  public Class findClass(String name) {
-    byte[] b = jfo.getByteCode();
-    return defineClass(name, b, 0, b.length);
-  }
-}
-
-class MemoryFileManager extends ForwardingJavaFileManager<JavaFileManager> {
-
-  private final JavaFileObject jfo;
-
-  public MemoryFileManager(StandardJavaFileManager jfm, JavaFileObject jfo) {
-    super(jfm);
-    this.jfo = jfo;
-  }
-
-  @Override
-  public FileObject getFileForInput(Location location, String packageName,
-                                    String relativeName) throws IOException {
-    return jfo;
-  }
-
-  @Override
-  public JavaFileObject getJavaFileForOutput(Location location, String qualifiedName,
-                                             Kind kind, FileObject outputFile) throws IOException {
-    return jfo;
-  }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8040018
+ * @library /testlibrary
+ * @summary Check for exception instead of assert.
+ * @run main ClassFileParserBug
+ */
+
+import java.io.File;
+import com.oracle.java.testlibrary.*;
+
+public class ClassFileParserBug {
+    public static void main(String args[]) throws Throwable {
+
+        System.out.println("Regression test for bug 8040018");
+        String testsrc = System.getProperty("test.src") + "/";
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+            "-jar", testsrc + File.separator + "test.jar");
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        output.shouldContain("java.lang.ClassFormatError: Bad length on BootstrapMethods");
+        output.shouldHaveExitValue(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/runtime/classFileParserBug/LambdaMath.jcod	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,609 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 test contains a BootstrapMethods attribute with a fuzzied
+ * attribute_length field that is larger than it should be.  This
+ * should cause a java.lang.ClassFormatError exception to be thrown.
+ */
+class LambdaMath {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [162] { // Constant Pool
+    ; // first element is empty
+    Method #31 #69; // #1     at 0x0A
+    class #70; // #2     at 0x0F
+    Method #2 #71; // #3     at 0x12
+    Method #72 #73; // #4     at 0x17
+    Field #74 #75; // #5     at 0x1C
+    String #76; // #6     at 0x21
+    Method #77 #78; // #7     at 0x24
+    InvokeDynamic 0s #84; // #8     at 0x29
+    Method #30 #85; // #9     at 0x2E
+    String #86; // #10     at 0x33
+    InvokeDynamic 1s #84; // #11     at 0x36
+    String #88; // #12     at 0x3B
+    InvokeDynamic 2s #84; // #13     at 0x3E
+    String #90; // #14     at 0x43
+    InvokeDynamic 3s #84; // #15     at 0x46
+    String #92; // #16     at 0x4B
+    InvokeDynamic 4s #84; // #17     at 0x4E
+    InterfaceMethod #94 #95; // #18     at 0x53
+    InterfaceMethod #96 #97; // #19     at 0x58
+    InterfaceMethod #96 #98; // #20     at 0x5D
+    InterfaceMethod #99 #100; // #21     at 0x62
+    class #101; // #22     at 0x67
+    Method #22 #69; // #23     at 0x6A
+    Method #22 #102; // #24     at 0x6F
+    String #103; // #25     at 0x74
+    Method #22 #104; // #26     at 0x77
+    Method #22 #105; // #27     at 0x7C
+    class #106; // #28     at 0x81
+    Method #2 #107; // #29     at 0x84
+    class #108; // #30     at 0x89
+    class #109; // #31     at 0x8C
+    Utf8 "<init>"; // #32     at 0x8F
+    Utf8 "()V"; // #33     at 0x98
+    Utf8 "Code"; // #34     at 0x9E
+    Utf8 "LineNumberTable"; // #35     at 0xA5
+    Utf8 "LocalVariableTable"; // #36     at 0xB7
+    Utf8 "this"; // #37     at 0xCC
+    Utf8 "LLambdaMath;"; // #38     at 0xD3
+    Utf8 "main"; // #39     at 0xE2
+    Utf8 "([Ljava/lang/String;)V"; // #40     at 0xE9
+    Utf8 "a"; // #41     at 0x0102
+    Utf8 "[Ljava/lang/String;"; // #42     at 0x0106
+    Utf8 "list"; // #43     at 0x011C
+    Utf8 "Ljava/util/List;"; // #44     at 0x0123
+    Utf8 "LocalVariableTypeTable"; // #45     at 0x0136
+    Utf8 "Ljava/util/List<Ljava/lang/Integer;>;"; // #46     at 0x014F
+    Utf8 "evaluate"; // #47     at 0x0177
+    Utf8 "(Ljava/util/List;Ljava/util/function/Predicate;)V"; // #48     at 0x0182
+    Utf8 "n"; // #49     at 0x01B6
+    Utf8 "Ljava/lang/Integer;"; // #50     at 0x01BA
+    Utf8 "e"; // #51     at 0x01D0
+    Utf8 "Ljava/lang/Throwable;"; // #52     at 0x01D4
+    Utf8 "predicate"; // #53     at 0x01EC
+    Utf8 "Ljava/util/function/PrediCate;"; // #54     at 0x01F8
+    Utf8 "Ljava/util/function/Predicate<Ljava/lang/Integer;>;"; // #55     at 0x0219
+    Utf8 "StackMapTable"; // #56     at 0x024F
+    class #110; // #57     at 0x025F
+    class #106; // #58     at 0x0262
+    Utf8 "Signature"; // #59     at 0x0265
+    Utf8 "(Ljava/util/List<Ljava/lang/Integer;>;Ljava/util/function/Predicate<Ljava/lang/Integer;>;)V"; // #60     at 0x0271
+    Utf8 "lambda$main$4"; // #61     at 0x02CF
+    Utf8 "(Ljava/lang/Integer;)Z"; // #62     at 0x02DF
+    Utf8 "lambda$main$3"; // #63     at 0x02F8
+    Utf8 "lambda$main$2"; // #64     at 0x0308
+    Utf8 "lambda$main$1"; // #65     at 0x0318
+    Utf8 "lambda$main$0"; // #66     at 0x0328
+    Utf8 "SourceFile"; // #67     at 0x0338
+    Utf8 "LambdaMath.java"; // #68     at 0x0345
+    NameAndType #32 #33; // #69     at 0x0357
+    Utf8 "java/lang/Integer"; // #70     at 0x035C
+    NameAndType #111 #112; // #71     at 0x0370
+    class #113; // #72     at 0x0375
+    NameAndType #114 #115; // #73     at 0x0378
+    class #116; // #74     at 0x037D
+    NameAndType #117 #118; // #75     at 0x0380
+    Utf8 "Print all numbers:"; // #76     at 0x0385
+    class #119; // #77     at 0x039A
+    NameAndType #120 #121; // #78     at 0x039D
+    Utf8 "BootstrapMethods"; // #79     at 0x03A2
+    MethodHandle 6b #122; // #80     at 0x03B5
+    MethodType #123; // #81     at 0x03B9
+    MethodHandle 6b #124; // #82     at 0x03BC
+    MethodType #62; // #83     at 0x03C0
+    NameAndType #125 #126; // #84     at 0x03C3
+    NameAndType #47 #48; // #85     at 0x03C8
+    Utf8 "Print no numbers:"; // #86     at 0x03CD
+    MethodHandle 6b #127; // #87     at 0x03E1
+    Utf8 "Print even numbers:"; // #88     at 0x03E5
+    MethodHandle 6b #128; // #89     at 0x03FB
+    Utf8 "Print odd numbers:"; // #90     at 0x03FF
+    MethodHandle 6b #129; // #91     at 0x0414
+    Utf8 "Print numbers greater than 5:"; // #92     at 0x0418
+    MethodHandle 6b #130; // #93     at 0x0438
+    class #131; // #94     at 0x043C
+    NameAndType #132 #133; // #95     at 0x043F
+    class #110; // #96     at 0x0444
+    NameAndType #134 #135; // #97     at 0x0447
+    NameAndType #136 #137; // #98     at 0x044C
+    class #138; // #99     at 0x0451
+    NameAndType #125 #123; // #100     at 0x0454
+    Utf8 "java/lang/StringFuilder"; // #101     at 0x0459
+    NameAndType #139 #140; // #102     at 0x0473
+    Utf8 " "; // #103     at 0x0478
+    NameAndType #139 #141; // #104     at 0x047C
+    NameAndType #142 #143; // #105     at 0x0481
+    Utf8 "java/lang/Throwable"; // #106     at 0x0486
+    NameAndType #144 #145; // #107     at 0x049C
+    Utf8 "LambdaMath"; // #108     at 0x04A1
+    Utf8 "java/lang/Object"; // #109     at 0x04AE
+    Utf8 "java/util/Iterator"; // #110     at 0x04C1
+    Utf8 "valueOf"; // #111     at 0x04D6
+    Utf8 "(I)Ljava/lang/Integer;"; // #112     at 0x04E0
+    Utf8 "java/util/Arrays"; // #113     at 0x04F9
+    Utf8 "asList"; // #114     at 0x050C
+    Utf8 "([Ljava/lang/Object;)Ljava/util/List;"; // #115     at 0x0515
+    Utf8 "java/lang/System"; // #116     at 0x053D
+    Utf8 "out"; // #117     at 0x0550
+    Utf8 "Ljava/io/PrintStream;"; // #118     at 0x0556
+    Utf8 "java/io/PrintStream"; // #119     at 0x056E
+    Utf8 "println"; // #120     at 0x0584
+    Utf8 "(Ljava/lang/String;)V"; // #121     at 0x058E
+    Method #146 #147; // #122     at 0x05A6
+    Utf8 "(Ljava/lang/Object;)Z"; // #123     at 0x05AB
+    Method #30 #148; // #124     at 0x05C3
+    Utf8 "test"; // #125     at 0x05C8
+    Utf8 "()Ljava/util/function/Predicate;"; // #126     at 0x05CF
+    Method #30 #149; // #127     at 0x05F2
+    Method #30 #150; // #128     at 0x05F7
+    Method #30 #151; // #129     at 0x05FC
+    Method #30 #152; // #130     at 0x0601
+    Utf8 "java/util/List"; // #131     at 0x0606
+    Utf8 "iterator"; // #132     at 0x0617
+    Utf8 "()Ljava/util/Iterator;"; // #133     at 0x0622
+    Utf8 "hasNext"; // #134     at 0x063B
+    Utf8 "()Z"; // #135     at 0x0645
+    Utf8 "next"; // #136     at 0x064B
+    Utf8 "()Ljava/lang/Object;"; // #137     at 0x0652
+    Utf8 "java/util/function/Predicate"; // #138     at 0x0669
+    Utf8 "append"; // #139     at 0x0688
+    Utf8 "(Ljava/lang/Object;)Ljava/lang/StringBuilder;"; // #140     at 0x0691
+    Utf8 "(Ljava/lang/String;)Ljava/lang/StringBuilder;"; // #141     at 0x06C1
+    Utf8 "toString"; // #142     at 0x06F1
+    Utf8 "()Ljava/lang/String;"; // #143     at 0x06FC
+    Utf8 "intValue"; // #144     at 0x0713
+    Utf8 "()I"; // #145     at 0x071E
+    class #153; // #146     at 0x0724
+    NameAndType #154 #158; // #147     at 0x0727
+    NameAndType #66 #62; // #148     at 0x072C
+    NameAndType #65 #62; // #149     at 0x0731
+    NameAndType #64 #62; // #150     at 0x0736
+    NameAndType #63 #62; // #151     at 0x073B
+    NameAndType #61 #62; // #152     at 0x0740
+    Utf8 "java/lang/invoke/LambdaMetafactory"; // #153     at 0x0745
+    Utf8 "metafactory"; // #154     at 0x076A
+    class #160; // #155     at 0x0778
+    Utf8 "Lookup"; // #156     at 0x077B
+    Utf8 "InnerClasses"; // #157     at 0x0784
+    Utf8 "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;"; // #158     at 0x0793
+    class #161; // #159     at 0x0862
+    Utf8 "java/lang/invoke/MethodHandles$Lookup"; // #160     at 0x0865
+    Utf8 "java/lang/invoke/MethodHandles"; // #161     at 0x088D
+  } // Constant Pool
+
+  0x0021; // access
+  #30;// this_cpx
+  #31;// super_cpx
+
+  [0] { // Interfaces
+  } // Interfaces
+
+  [0] { // fields
+  } // fields
+
+  [8] { // methods
+    { // Member at 0x08BA
+      0x0001; // access
+      #32; // name_cpx
+      #33; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 47) { // Code at 0x08C2
+          1; // max_stack
+          1; // max_locals
+          Bytes[5]{
+            0x2AB70001B1;
+          };
+          [0] { // Traps
+          } // end Traps
+          [2] { // Attributes
+            Attr(#35, 6) { // LineNumberTable at 0x08D9
+              [1] { // LineNumberTable
+                0  5; //  at 0x08E5
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 12) { // LocalVariableTable at 0x08E5
+              [1] { // LocalVariableTable
+                0 5 37 38 0; //  at 0x08F7
+              }
+            } // end LocalVariableTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x08F7
+      0x0009; // access
+      #39; // name_cpx
+      #40; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 261) { // Code at 0x08FF
+          4; // max_stack
+          2; // max_locals
+          Bytes[147]{
+            0x1007BD0002590304;
+            0xB8000353590405B8;
+            0x000353590506B800;
+            0x0353590607B80003;
+            0x53590708B8000353;
+            0x59081006B8000353;
+            0x5910061007B80003;
+            0x53B800044CB20005;
+            0x1206B600072BBA00;
+            0x080000B80009B200;
+            0x05120AB600072BBA;
+            0x000B0000B80009B2;
+            0x0005120CB600072B;
+            0xBA000D0000B80009;
+            0xB20005120EB60007;
+            0x2BBA000F0000B800;
+            0x09B200051210B600;
+            0x072BBA00110000B8;
+            0x0009B1;
+          };
+          [0] { // Traps
+          } // end Traps
+          [3] { // Attributes
+            Attr(#35, 50) { // LineNumberTable at 0x09A4
+              [12] { // LineNumberTable
+                0  9; //  at 0x09B0
+                61  11; //  at 0x09B4
+                69  12; //  at 0x09B8
+                78  14; //  at 0x09BC
+                86  15; //  at 0x09C0
+                95  17; //  at 0x09C4
+                103  18; //  at 0x09C8
+                112  20; //  at 0x09CC
+                120  21; //  at 0x09D0
+                129  23; //  at 0x09D4
+                137  24; //  at 0x09D8
+                146  26; //  at 0x09DC
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 22) { // LocalVariableTable at 0x09DC
+              [2] { // LocalVariableTable
+                0 147 41 42 0; //  at 0x09EE
+                61 86 43 44 1; //  at 0x09F8
+              }
+            } // end LocalVariableTable
+            ;
+            Attr(#45, 12) { // LocalVariableTypeTable at 0x09F8
+              [1] { // LocalVariableTypeTable
+                61 86 43 46 1; //  at 0x0A0A
+              }
+            } // end LocalVariableTypeTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0A0A
+      0x0009; // access
+      #47; // name_cpx
+      #48; // sig_cpx
+      [2] { // Attributes
+        Attr(#34, 224) { // Code at 0x0A12
+          3; // max_stack
+          4; // max_locals
+          Bytes[69]{
+            0x2AB9001201004D2C;
+            0xB900130100990033;
+            0x2CB900140100C200;
+            0x024E2B2DB9001502;
+            0x0099001CB20005BB;
+            0x001659B700172DB6;
+            0x00181219B6001AB6;
+            0x001BB60007A7FFCA;
+            0xA700044DB1;
+          };
+          [1] { // Traps
+            0 64 67 28; //  at 0x0A6F
+          } // end Traps
+          [4] { // Attributes
+            Attr(#35, 30) { // LineNumberTable at 0x0A71
+              [7] { // LineNumberTable
+                0  30; //  at 0x0A7D
+                26  31; //  at 0x0A81
+                36  32; //  at 0x0A85
+                61  34; //  at 0x0A89
+                64  38; //  at 0x0A8D
+                67  37; //  at 0x0A91
+                68  39; //  at 0x0A95
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 42) { // LocalVariableTable at 0x0A95
+              [4] { // LocalVariableTable
+                26 35 49 50 3; //  at 0x0AA7
+                68 0 51 52 2; //  at 0x0AB1
+                0 69 43 44 0; //  at 0x0ABB
+                0 69 53 54 1; //  at 0x0AC5
+              }
+            } // end LocalVariableTable
+            ;
+            Attr(#45, 22) { // LocalVariableTypeTable at 0x0AC5
+              [2] { // LocalVariableTypeTable
+                0 69 43 46 0; //  at 0x0AD7
+                0 69 53 55 1; //  at 0x0AE1
+              }
+            } // end LocalVariableTypeTable
+            ;
+            Attr(#56, 17) { // StackMapTable at 0x0AE1
+              [5] { // 
+                252b, 7, [1]z{7b,57}; // append_frame 1
+                53b; // same_frame
+                250b, 2; // chop_frame 1
+                66b, [1]z{7b,58}; // same_locals_1_stack_item_frame
+                0b; // same_frame
+              }
+            } // end StackMapTable
+          } // Attributes
+        } // end Code
+        ;
+        Attr(#59, 2) { // Signature at 0x0AF8
+          #60;
+        } // end Signature
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0B00
+      0x100A; // access
+      #61; // name_cpx
+      #62; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 67) { // Code at 0x0B08
+          2; // max_stack
+          1; // max_locals
+          Bytes[14]{
+            0x2AB6001D08A40007;
+            0x04A7000403AC;
+          };
+          [0] { // Traps
+          } // end Traps
+          [3] { // Attributes
+            Attr(#35, 6) { // LineNumberTable at 0x0B28
+              [1] { // LineNumberTable
+                0  24; //  at 0x0B34
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 12) { // LocalVariableTable at 0x0B34
+              [1] { // LocalVariableTable
+                0 14 49 50 0; //  at 0x0B46
+              }
+            } // end LocalVariableTable
+            ;
+            Attr(#56, 5) { // StackMapTable at 0x0B46
+              [2] { // 
+                12b; // same_frame
+                64b, [1]z{1b}; // same_locals_1_stack_item_frame
+              }
+            } // end StackMapTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0B51
+      0x100A; // access
+      #63; // name_cpx
+      #62; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 69) { // Code at 0x0B59
+          2; // max_stack
+          1; // max_locals
+          Bytes[16]{
+            0x2AB6001D057004A0;
+            0x000704A7000403AC;
+          };
+          [0] { // Traps
+          } // end Traps
+          [3] { // Attributes
+            Attr(#35, 6) { // LineNumberTable at 0x0B7B
+              [1] { // LineNumberTable
+                0  21; //  at 0x0B87
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 12) { // LocalVariableTable at 0x0B87
+              [1] { // LocalVariableTable
+                0 16 49 50 0; //  at 0x0B99
+              }
+            } // end LocalVariableTable
+            ;
+            Attr(#56, 5) { // StackMapTable at 0x0B99
+              [2] { // 
+                14b; // same_frame
+                64b, [1]z{1b}; // same_locals_1_stack_item_frame
+              }
+            } // end StackMapTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0BA4
+      0x100A; // access
+      #64; // name_cpx
+      #62; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 68) { // Code at 0x0BAC
+          2; // max_stack
+          1; // max_locals
+          Bytes[15]{
+            0x2AB6001D05709A00;
+            0x0704A7000403AC;
+          };
+          [0] { // Traps
+          } // end Traps
+          [3] { // Attributes
+            Attr(#35, 6) { // LineNumberTable at 0x0BCD
+              [1] { // LineNumberTable
+                0  18; //  at 0x0BD9
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 12) { // LocalVariableTable at 0x0BD9
+              [1] { // LocalVariableTable
+                0 15 49 50 0; //  at 0x0BEB
+              }
+            } // end LocalVariableTable
+            ;
+            Attr(#56, 5) { // StackMapTable at 0x0BEB
+              [2] { // 
+                13b; // same_frame
+                64b, [1]z{1b}; // same_locals_1_stack_item_frame
+              }
+            } // end StackMapTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0BF6
+      0x100A; // access
+      #65; // name_cpx
+      #62; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 44) { // Code at 0x0BFE
+          1; // max_stack
+          1; // max_locals
+          Bytes[2]{
+            0x03AC;
+          };
+          [0] { // Traps
+          } // end Traps
+          [2] { // Attributes
+            Attr(#35, 6) { // LineNumberTable at 0x0C12
+              [1] { // LineNumberTable
+                0  15; //  at 0x0C1E
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 12) { // LocalVariableTable at 0x0C1E
+              [1] { // LocalVariableTable
+                0 2 49 50 0; //  at 0x0C30
+              }
+            } // end LocalVariableTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member at 0x0C30
+      0x100A; // access
+      #66; // name_cpx
+      #62; // sig_cpx
+      [1] { // Attributes
+        Attr(#34, 44) { // Code at 0x0C38
+          1; // max_stack
+          1; // max_locals
+          Bytes[2]{
+            0x04AC;
+          };
+          [0] { // Traps
+          } // end Traps
+          [2] { // Attributes
+            Attr(#35, 6) { // LineNumberTable at 0x0C4C
+              [1] { // LineNumberTable
+                0  12; //  at 0x0C58
+              }
+            } // end LineNumberTable
+            ;
+            Attr(#36, 12) { // LocalVariableTable at 0x0C58
+              [1] { // LocalVariableTable
+                0 2 49 50 0; //  at 0x0C6A
+              }
+            } // end LocalVariableTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [3] { // Attributes
+    Attr(#67, 2) { // SourceFile at 0x0C6C
+      #68;
+    } // end SourceFile
+    ;
+    Attr(#157, 10) { // InnerClasses at 0x0C74
+      [1] { // InnerClasses
+        #155 #159 #156 25; //  at 0x0C84
+      }
+    } // end InnerClasses
+    ;
+    Attr(#79, 52) { // BootstrapMethods at 0x0C84
+      [5] { // bootstrap_methods
+        {  //  bootstrap_method
+          #80; // bootstrap_method_ref
+          [3] { // bootstrap_arguments
+            #81; //  at 0x0C92
+            #82; //  at 0x0C94
+            #83; //  at 0x0C96
+          }  //  bootstrap_arguments
+        }  //  bootstrap_method
+        ;
+        {  //  bootstrap_method
+          #80; // bootstrap_method_ref
+          [3] { // bootstrap_arguments
+            #81; //  at 0x0C9C
+            #87; //  at 0x0C9E
+            #83; //  at 0x0CA0
+          }  //  bootstrap_arguments
+        }  //  bootstrap_method
+        ;
+        {  //  bootstrap_method
+          #80; // bootstrap_method_ref
+          [3] { // bootstrap_arguments
+            #81; //  at 0x0CA6
+            #89; //  at 0x0CA8
+            #83; //  at 0x0CAA
+          }  //  bootstrap_arguments
+        }  //  bootstrap_method
+        ;
+        {  //  bootstrap_method
+          #80; // bootstrap_method_ref
+          [3] { // bootstrap_arguments
+            #81; //  at 0x0CB0
+            #91; //  at 0x0CB2
+            #83; //  at 0x0CB4
+          }  //  bootstrap_arguments
+        }  //  bootstrap_method
+        ;
+        {  //  bootstrap_method
+          #80; // bootstrap_method_ref
+          [1] { // bootstrap_arguments
+            #81; //  at 0x0CBA
+          }  //  bootstrap_arguments
+        }  //  bootstrap_method
+      }
+// ======== attribute array started  at 0x0C84 has 4 bytes more:
+      0x005D0053;
+    } // end BootstrapMethods
+  } // Attributes
+} // end class LambdaMath
Binary file hotspot/test/runtime/classFileParserBug/test.jar has changed
--- a/jaxp/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/jaxp/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -253,3 +253,4 @@
 3b360a77658e6b3ac150dd7cdbff1a7abe855afc jdk9-b08
 f93a792fe37279d4d37aea86a99f3abbdc6fe79b jdk9-b09
 4ce98701efe3b28f6ce3ab23385445731e968af7 jdk9-b10
+6b4280dceb00642f54d5bc1c2cb7d34c99a04992 jdk9-b11
--- a/jaxws/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/jaxws/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -256,3 +256,4 @@
 2d9f4166e0be68aa43c5f4fd0f8d34768e11f652 jdk9-b08
 c9e8bb8c1144a966ca7b481142c6b5e55d14a29c jdk9-b09
 9af43f4d215f6f19b1767f6ac66da931b8ee9535 jdk9-b10
+1f953ba7db2b535e19f0354abfee6d67605e0684 jdk9-b11
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java	Mon May 05 09:41:41 2014 -0700
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/soap/StaxBridge.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,12 @@
 
 package com.sun.xml.internal.messaging.saaj.soap;
 
+import com.sun.xml.internal.messaging.saaj.util.stax.SaajStaxWriter;
+
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter;
 import com.sun.xml.internal.org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter;
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxReaderEx.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.messaging.saaj.util.stax;
+
+import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
+import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
+import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
+import com.sun.xml.internal.org.jvnet.staxex.util.DOMStreamReader;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import javax.xml.soap.SOAPElement;
+import javax.xml.stream.XMLStreamException;
+import java.util.Iterator;
+
+/**
+ * SaajStaxReaderEx
+ *
+ * @author shih-chang.chen@oracle.com
+ */
+public class SaajStaxReaderEx extends DOMStreamReader implements XMLStreamReaderEx {
+    //TODO extends com.sun.xml.internal.ws.streaming.DOMStreamReader
+    private BinaryText binaryText = null;
+    private Base64Data base64AttData = null;
+
+    public SaajStaxReaderEx(SOAPElement se) {
+        super(se);
+    }
+
+    @Override
+    public int next() throws XMLStreamException {
+        binaryText = null;
+        base64AttData = null;
+        while(true) {
+            int r = _next();
+            switch (r) {
+            case CHARACTERS:
+                if (_current instanceof BinaryText) {
+                    binaryText = (BinaryText) _current;
+                    base64AttData = new Base64Data();
+                    base64AttData.set(binaryText.getDataHandler());
+//System.out.println("--------------- debug SaajStaxReaderEx binaryText " + binaryText);
+                } else {
+                    // if we are currently at text node, make sure that this is a meaningful text node.
+                    Node prev = _current.getPreviousSibling();
+                    if(prev!=null && prev.getNodeType()==Node.TEXT_NODE)
+                        continue;   // nope. this is just a continuation of previous text that should be invisible
+
+                    Text t = (Text)_current;
+                    wholeText = t.getWholeText();
+                    if(wholeText.length()==0)
+                        continue;   // nope. this is empty text.
+                }
+                return CHARACTERS;
+            case START_ELEMENT:
+                splitAttributes();
+                return START_ELEMENT;
+            default:
+                return r;
+            }
+        }
+    }
+
+    @Override
+    public String getElementTextTrim() throws XMLStreamException {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public CharSequence getPCDATA() throws XMLStreamException {
+        return (binaryText != null) ? base64AttData : getText();
+    }
+
+    @Override
+    public com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx getNamespaceContext() {
+        return new com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx() {
+
+            @Override
+            public String getNamespaceURI(String prefix) {
+                return _current.lookupNamespaceURI(prefix);
+            }
+
+            @Override
+            public String getPrefix(String uri) {
+                return _current.lookupPrefix(uri);
+            }
+
+            @Override
+            public Iterator getPrefixes(String arg0) {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+            @Override
+            public Iterator<Binding> iterator() {
+                // TODO Auto-generated method stub
+                return null;
+            }
+
+        };
+    }
+
+
+    @Override
+    public int getTextLength() {
+        return (binaryText != null) ? base64AttData.length() : super.getTextLength();
+    }
+
+    @Override
+    public int getTextStart() {
+        return (binaryText != null) ? 0: super.getTextStart();
+    }
+
+    @Override
+    public char[] getTextCharacters() {
+        if (binaryText != null) {
+            char[] chars = new char[base64AttData.length()];
+            base64AttData.writeTo(chars, 0);
+            return chars;
+        }
+        return super.getTextCharacters();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.messaging.saaj.util.stax;
+
+import java.util.Arrays;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Comment;
+import org.w3c.dom.Node;
+
+/**
+ * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
+ *
+ * @author shih-chang.chen@oracle.com
+ */
+public class SaajStaxWriter implements XMLStreamWriter {
+
+    protected SOAPMessage soap;
+    protected String envURI;
+    protected SOAPElement currentElement;
+
+    static final protected String Envelope = "Envelope";
+    static final protected String Header = "Header";
+    static final protected String Body = "Body";
+    static final protected String xmlns = "xmlns";
+
+    private boolean isHeaderSeen = false;
+
+    public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
+        soap = msg;
+        this.envURI = uri;
+    }
+
+    public SOAPMessage getSOAPMessage() {
+        return soap;
+    }
+
+    protected SOAPElement getEnvelope() throws SOAPException {
+        return soap.getSOAPPart().getEnvelope();
+    }
+
+    @Override
+    public void writeStartElement(final String localName) throws XMLStreamException {
+        try {
+            currentElement = currentElement.addChildElement(localName);
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public void writeStartElement(final String ns, final String ln) throws XMLStreamException {
+        writeStartElement(null, ln, ns);
+    }
+
+    @Override
+    public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException {
+        try {
+            if (envURI.equals(ns)) {
+                if (Envelope.equals(ln)) {
+                    currentElement = getEnvelope();
+                    fixPrefix(prefix);
+                    return;
+                } else if (Header.equals(ln)) {
+                    isHeaderSeen = true;
+                    currentElement = soap.getSOAPHeader();
+                    fixPrefix(prefix);
+                    return;
+                } else if (Body.equals(ln)) {
+                    currentElement = soap.getSOAPBody();
+                    fixPrefix(prefix);
+                    return;
+                }
+            }
+            currentElement = (prefix == null) ?
+                    currentElement.addChildElement(new QName(ns, ln)) :
+                    currentElement.addChildElement(ln, prefix, ns);
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    private void fixPrefix(final String prfx) throws XMLStreamException {
+        fixPrefix(prfx, currentElement);
+    }
+
+    private void fixPrefix(final String prfx, SOAPElement element) throws XMLStreamException {
+        String oldPrfx = element.getPrefix();
+        if (prfx != null && !prfx.equals(oldPrfx)) {
+            element.setPrefix(prfx);
+        }
+    }
+
+    @Override
+    public void writeEmptyElement(final String uri, final String ln) throws XMLStreamException {
+        writeStartElement(null, ln, uri);
+    }
+
+    @Override
+    public void writeEmptyElement(final String prefix, final String ln, final String uri) throws XMLStreamException {
+        writeStartElement(prefix, ln, uri);
+    }
+
+    @Override
+    public void writeEmptyElement(final String ln) throws XMLStreamException {
+        writeStartElement(null, ln, null);
+    }
+
+    @Override
+    public void writeEndElement() throws XMLStreamException {
+        if (currentElement != null) currentElement = currentElement.getParentElement();
+    }
+
+    @Override
+    public void writeEndDocument() throws XMLStreamException {
+        try {
+            if (!isHeaderSeen) {
+                SOAPElement header = soap.getSOAPHeader();
+                if (header != null) {
+                    String prefixAtHeader = header.getPrefix();
+                    SOAPElement env = getEnvelope();
+                    header.detachNode();
+                    if (prefixAtHeader != null && !prefixAtHeader.equals(env.getPrefix())) {
+                        env.removeNamespaceDeclaration(prefixAtHeader);
+                    }
+                }
+            }
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public void close() throws XMLStreamException {
+    }
+
+    @Override
+    public void flush() throws XMLStreamException {
+    }
+
+    @Override
+    public void writeAttribute(final String ln, final String val) throws XMLStreamException {
+        writeAttribute(null, null, ln, val);
+    }
+
+    @Override
+    public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException {
+        try {
+            if (ns == null) {
+                if (prefix == null && xmlns.equals(ln)) {
+                    currentElement.addNamespaceDeclaration("", value);
+                } else {
+                    currentElement.setAttributeNS("", ln, value);
+                }
+            } else {
+                QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix);
+                currentElement.addAttribute(name, value);
+            }
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public void writeAttribute(final String ns, final String ln, final String val) throws XMLStreamException {
+        writeAttribute(null, ns, ln, val);
+    }
+
+    @Override
+    public void writeNamespace(String prefix, final String uri) throws XMLStreamException {
+
+        // make prefix default if null or "xmlns" (according to javadoc)
+        if (prefix == null || "xmlns".equals(prefix)) {
+            prefix = "";
+        }
+
+        try {
+            currentElement.addNamespaceDeclaration(prefix, uri);
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public void writeDefaultNamespace(final String uri) throws XMLStreamException {
+        writeNamespace("", uri);
+    }
+
+    @Override
+    public void writeComment(final String data) throws XMLStreamException {
+        Comment c = soap.getSOAPPart().createComment(data);
+        currentElement.appendChild(c);
+    }
+
+    @Override
+    public void writeProcessingInstruction(final String target) throws XMLStreamException {
+        Node n = soap.getSOAPPart().createProcessingInstruction(target, "");
+        currentElement.appendChild(n);
+    }
+
+    @Override
+    public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException {
+        Node n = soap.getSOAPPart().createProcessingInstruction(target, data);
+        currentElement.appendChild(n);
+    }
+
+    @Override
+    public void writeCData(final String data) throws XMLStreamException {
+        Node n = soap.getSOAPPart().createCDATASection(data);
+        currentElement.appendChild(n);
+    }
+
+    @Override
+    public void writeDTD(final String dtd) throws XMLStreamException {
+        //TODO ... Don't do anything here
+    }
+
+    @Override
+    public void writeEntityRef(final String name) throws XMLStreamException {
+        Node n = soap.getSOAPPart().createEntityReference(name);
+        currentElement.appendChild(n);
+    }
+
+    @Override
+    public void writeStartDocument() throws XMLStreamException {
+    }
+
+    @Override
+    public void writeStartDocument(final String version) throws XMLStreamException {
+        if (version != null) soap.getSOAPPart().setXmlVersion(version);
+    }
+
+    @Override
+    public void writeStartDocument(final String encoding, final String version) throws XMLStreamException {
+        if (version != null) soap.getSOAPPart().setXmlVersion(version);
+        if (encoding != null) {
+            try {
+                soap.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding);
+            } catch (SOAPException e) {
+                throw new XMLStreamException(e);
+            }
+        }
+    }
+
+    @Override
+    public void writeCharacters(final String text) throws XMLStreamException {
+        try {
+            currentElement.addTextNode(text);
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException {
+        char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len);
+        try {
+            currentElement.addTextNode(new String(chr));
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public String getPrefix(final String uri) throws XMLStreamException {
+        return currentElement.lookupPrefix(uri);
+    }
+
+    @Override
+    public void setPrefix(final String prefix, final String uri) throws XMLStreamException {
+        try {
+            this.currentElement.addNamespaceDeclaration(prefix, uri);
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
+    }
+
+    @Override
+    public void setDefaultNamespace(final String uri) throws XMLStreamException {
+        setPrefix("", uri);
+    }
+
+    @Override
+    public void setNamespaceContext(final NamespaceContext context)throws XMLStreamException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Object getProperty(final String name) throws IllegalArgumentException {
+        //TODO the following line is to make eclipselink happy ... they are aware of this problem -
+        if (javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES.equals(name)) return Boolean.FALSE;
+        return null;
+    }
+
+    @Override
+    public NamespaceContext getNamespaceContext() {
+        return new NamespaceContext() {
+            public String getNamespaceURI(final String prefix) {
+                return currentElement.getNamespaceURI(prefix);
+            }
+            public String getPrefix(final String namespaceURI) {
+                return currentElement.lookupPrefix(namespaceURI);
+            }
+            public Iterator getPrefixes(final String namespaceURI) {
+                return new Iterator() {
+                    String prefix = getPrefix(namespaceURI);
+                    public boolean hasNext() {
+                        return (prefix != null);
+                    }
+                    public Object next() {
+                        if (!hasNext()) throw new java.util.NoSuchElementException();
+                        String next = prefix;
+                        prefix = null;
+                        return next;
+                    }
+                    public void remove() {}
+                };
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/messaging/saaj/util/stax/SaajStaxWriterEx.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.xml.internal.messaging.saaj.util.stax;
+
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.UUID;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.attachment.AttachmentMarshaller;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.stream.XMLStreamException;
+
+import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
+import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
+import com.sun.xml.internal.org.jvnet.staxex.MtomEnabled;
+import com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx;
+import com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler;
+import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
+import com.sun.xml.internal.org.jvnet.staxex.util.MtomStreamWriter;
+//
+//import com.sun.xml.internal.ws.api.message.saaj.SaajStaxWriter;
+//import com.sun.xml.internal.ws.developer.StreamingDataHandler;
+//import com.sun.xml.internal.ws.streaming.MtomStreamWriter;
+
+/**
+ * SaajStaxWriterEx converts XMLStreamWriterEx calls to build an orasaaj SOAPMessage with BinaryTextImpl.
+ *
+ * @author shih-chang.chen@oracle.com
+ */
+public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterEx, MtomStreamWriter {
+
+    static final protected String xopNS = "http://www.w3.org/2004/08/xop/include";
+    static final protected String Include = "Include";
+    static final protected String href = "href";
+
+    private enum State {xopInclude, others};
+    private State state = State.others;
+    private BinaryText binaryText;
+
+    public SaajStaxWriterEx(SOAPMessage msg, String uri) throws SOAPException {
+        super(msg, uri);
+    }
+
+    public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException {
+        if (xopNS.equals(ns) && Include.equals(ln)) {
+            state = State.xopInclude;
+            return;
+        } else {
+            super.writeStartElement(prefix, ln, ns);
+        }
+    }
+
+    @Override
+    public void writeEndElement() throws XMLStreamException {
+        if (state.equals(State.xopInclude)) {
+            state = State.others;
+        } else {
+            super.writeEndElement();
+        }
+    }
+
+    @Override
+    public void writeAttribute(String prefix, String ns, String ln, String value) throws XMLStreamException {
+        if (binaryText != null && href.equals(ln)) {
+            return;
+        } else {
+            super.writeAttribute(prefix, ns, ln, value);
+        }
+    }
+
+//    @Override
+//    public void writeComment(String data) throws XMLStreamException {
+//        ((ElementImpl)currentElement).addCommentNode(data);
+//    }
+//
+//    @Override
+//    public void writeCData(String data) throws XMLStreamException {
+//      CDataTextImpl cdt = new CDataTextImpl(soap.getSOAPPart(), data);
+//        currentElement.appendChild(cdt);
+//    }
+
+    @Override
+    public NamespaceContextEx getNamespaceContext() {
+        return new NamespaceContextEx() {
+            public String getNamespaceURI(String prefix) {
+                return currentElement.getNamespaceURI(prefix);
+            }
+            public String getPrefix(String namespaceURI) {
+                return currentElement.lookupPrefix(namespaceURI);
+            }
+            public Iterator getPrefixes(final String namespaceURI) {
+                return new Iterator() {
+                    String prefix = getPrefix(namespaceURI);
+                    public boolean hasNext() {
+                        return (prefix != null);
+                    }
+                    public Object next() {
+                        if (prefix == null) throw new java.util.NoSuchElementException();
+                        String next = prefix;
+                        prefix = null;
+                        return next;
+                    }
+                    public void remove() {}
+                };
+            }
+            public Iterator<Binding> iterator() {
+                return new Iterator<Binding>() {
+                    public boolean hasNext() { return false; }
+                    public Binding next() { return null; }
+                    public void remove() {}
+                };
+            }
+        };
+    }
+
+    @Override
+    public void writeBinary(DataHandler data) throws XMLStreamException {
+//      binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl)soap, null, currentElement.getOwnerDocument(), data);
+//      currentElement.appendChild(binaryText);
+        addBinaryText(data);
+    }
+
+    @Override
+    public OutputStream writeBinary(String arg0) throws XMLStreamException {
+        return null;
+    }
+
+    @Override
+    public void writeBinary(byte[] data, int offset, int length, String contentType) throws XMLStreamException {
+//        if (mtomThreshold == -1 || mtomThreshold > length) return null;
+        byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
+        if (currentElement instanceof MtomEnabled) {
+            binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
+        } else {
+            throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
+        }
+    }
+
+    @Override
+    public void writePCDATA(CharSequence arg0) throws XMLStreamException {
+        if (arg0 instanceof Base64Data) {
+            // The fix of StreamReaderBufferCreator preserves this dataHandler
+            addBinaryText(((Base64Data) arg0).getDataHandler());
+        } else {
+            // We should not normally get here as we expect a DataHandler,
+            // but this is the most general solution.  If we do get
+            // something other than a Data Handler, create a Text node with
+            // the data.  Another alternative would be to throw an exception,
+            // but in the most general case, we don't know whether this input
+            // is expected.
+            try {
+                currentElement.addTextNode(arg0.toString());
+            } catch (SOAPException e) {
+                throw new XMLStreamException("Cannot add Text node", e);
+            }
+        }
+    }
+
+    static private String encodeCid() {
+        String cid = "example.jaxws.sun.com";
+        String name = UUID.randomUUID() + "@";
+        return name + cid;
+    }
+
+    private String addBinaryText(DataHandler data) {
+        String hrefOrCid = null;
+        if (data instanceof StreamingDataHandler) {
+            hrefOrCid = ((StreamingDataHandler) data).getHrefCid();
+        }
+        if (hrefOrCid == null) hrefOrCid = encodeCid();
+
+        String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid;
+        // Should we do the threshold processing on DataHandler ? But that would be
+        // expensive as DataHolder need to read the data again from its source
+      //binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data);
+      //currentElement.appendChild(binaryText);
+        if (currentElement instanceof MtomEnabled) {
+            binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data);
+        } else {
+            throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
+        }
+        return hrefOrCid;
+    }
+
+    public AttachmentMarshaller getAttachmentMarshaller() {
+        return new AttachmentMarshaller() {
+            @Override
+            public String addMtomAttachment(DataHandler data, String ns, String ln) {
+//                if (mtomThreshold == -1) return null;
+                String hrefOrCid = addBinaryText(data);
+//                return binaryText.getHref();
+                return hrefOrCid;
+            }
+
+            @Override
+            public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String ns, String ln) {
+//                if (mtomThreshold == -1 || mtomThreshold > length) return null;
+                byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
+//                binaryText = (BinaryTextImpl) ((ElementImpl) currentElement).addAsBase64TextNode(bytes);
+                if (currentElement instanceof MtomEnabled) {
+                    binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
+                } else {
+                    throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
+                }
+                return binaryText.getHref();
+            }
+
+            @Override
+            public String addSwaRefAttachment(DataHandler data) {
+                return "cid:"+encodeCid();
+            }
+
+            @Override
+            public boolean isXOPPackage() {
+                return true;
+            }
+        };
+    }
+}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java	Mon May 05 09:41:41 2014 -0700
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,15 +26,13 @@
 package com.sun.xml.internal.org.jvnet.staxex;
 
 import javax.activation.DataHandler;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.Text;
 
 /**
  * BinaryText represents a MTOM attachment.
  *
  * @author shih-chang.chen@oracle.com
  */
-public interface BinaryText extends Text {
+public interface BinaryText {
     public String getHref();
-    public DataHandler getDataHandler() throws SOAPException;
+    public DataHandler getDataHandler();
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java	Mon May 05 09:41:41 2014 -0700
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,6 @@
 package com.sun.xml.internal.org.jvnet.staxex;
 
 import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -46,7 +45,6 @@
         /**
          * Retrieve payload qname without materializing its contents
          * @return
-         * @throws SOAPException
          */
        public QName getPayloadQName();
 
@@ -58,7 +56,7 @@
         * Retrieve payload attribute value without materializing its contents
         * @param localName
         * @return
-        * @throws SOAPException
+        * @throws XMLStreamException
         */
        public String getPayloadAttributeValue(String localName) throws XMLStreamException;
 
@@ -66,16 +64,16 @@
         * Retrieve payload attribute value without materializing its contents
         * @param qName
         * @return
-        * @throws SOAPException
+        * @throws XMLStreamException
         */
        public String getPayloadAttributeValue(QName qName) throws XMLStreamException;
 
-       public void materialize() throws SOAPException;
+       public void materialize() throws XMLStreamException;
     }
 
-    public void setPayload(Payload src) throws SOAPException;
+    public void setPayload(Payload src) throws XMLStreamException;
 
-    public Payload getPayload()throws SOAPException;
+    public Payload getPayload()throws XMLStreamException;
 
     public boolean hasStaxPayload();
  }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxReaderEx.java	Mon May 05 09:41:41 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.xml.internal.org.jvnet.staxex.util;
-
-import java.util.Iterator;
-
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.stream.XMLStreamException;
-
-import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
-import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx;
-import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-/**
- * SaajStaxReaderEx
- *
- * @author shih-chang.chen@oracle.com
- */
-public class SaajStaxReaderEx extends DOMStreamReader implements XMLStreamReaderEx {
-    //TODO extends com.sun.xml.internal.ws.streaming.DOMStreamReader
-    private BinaryText binaryText = null;
-    private Base64Data base64AttData = null;
-
-    public SaajStaxReaderEx(SOAPElement se) {
-        super(se);
-    }
-
-    @Override
-    public int next() throws XMLStreamException {
-        binaryText = null;
-        base64AttData = null;
-        while(true) {
-            int r = _next();
-            switch (r) {
-            case CHARACTERS:
-                if (_current instanceof BinaryText) {
-                    binaryText = (BinaryText) _current;
-                    base64AttData = new Base64Data();
-                    try {
-                        base64AttData.set(binaryText.getDataHandler());
-//System.out.println("--------------- debug SaajStaxReaderEx binaryText " + binaryText);
-                    } catch (SOAPException e) {
-                        throw new XMLStreamException(e);
-                    }
-                } else {
-                    // if we are currently at text node, make sure that this is a meaningful text node.
-                    Node prev = _current.getPreviousSibling();
-                    if(prev!=null && prev.getNodeType()==Node.TEXT_NODE)
-                        continue;   // nope. this is just a continuation of previous text that should be invisible
-
-                    Text t = (Text)_current;
-                    wholeText = t.getWholeText();
-                    if(wholeText.length()==0)
-                        continue;   // nope. this is empty text.
-                }
-                return CHARACTERS;
-            case START_ELEMENT:
-                splitAttributes();
-                return START_ELEMENT;
-            default:
-                return r;
-            }
-        }
-    }
-
-    @Override
-    public String getElementTextTrim() throws XMLStreamException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public CharSequence getPCDATA() throws XMLStreamException {
-        return (binaryText != null) ? base64AttData : getText();
-    }
-
-    @Override
-    public com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx getNamespaceContext() {
-        return new com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx() {
-
-            @Override
-            public String getNamespaceURI(String prefix) {
-                return _current.lookupNamespaceURI(prefix);
-            }
-
-            @Override
-            public String getPrefix(String uri) {
-                return _current.lookupPrefix(uri);
-            }
-
-            @Override
-            public Iterator getPrefixes(String arg0) {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-            @Override
-            public Iterator<Binding> iterator() {
-                // TODO Auto-generated method stub
-                return null;
-            }
-
-        };
-    }
-
-
-    @Override
-    public int getTextLength() {
-        return (binaryText != null) ? base64AttData.length() : super.getTextLength();
-    }
-
-    @Override
-    public int getTextStart() {
-        return (binaryText != null) ? 0: super.getTextStart();
-    }
-
-    @Override
-    public char[] getTextCharacters() {
-        if (binaryText != null) {
-            char[] chars = new char[base64AttData.length()];
-            base64AttData.writeTo(chars, 0);
-            return chars;
-        }
-        return super.getTextCharacters();
-    }
-}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriter.java	Mon May 05 09:41:41 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,330 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.xml.internal.org.jvnet.staxex.util;
-
-import java.util.Arrays;
-import java.util.Iterator;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.w3c.dom.Comment;
-import org.w3c.dom.Node;
-
-/**
- * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
- *
- * @author shih-chang.chen@oracle.com
- */
-public class SaajStaxWriter implements XMLStreamWriter {
-
-    protected SOAPMessage soap;
-    protected String envURI;
-    protected SOAPElement currentElement;
-
-    static final protected String Envelope = "Envelope";
-    static final protected String Header = "Header";
-    static final protected String Body = "Body";
-    static final protected String xmlns = "xmlns";
-
-    public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
-        soap = msg;
-        this.envURI = uri;
-    }
-
-    public SOAPMessage getSOAPMessage() {
-        return soap;
-    }
-
-    protected SOAPElement getEnvelope() throws SOAPException {
-        return soap.getSOAPPart().getEnvelope();
-    }
-
-    @Override
-    public void writeStartElement(final String localName) throws XMLStreamException {
-        try {
-            currentElement = currentElement.addChildElement(localName);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeStartElement(final String ns, final String ln) throws XMLStreamException {
-        writeStartElement(null, ln, ns);
-    }
-
-    @Override
-    public void writeStartElement(final String prefix, final String ln, final String ns) throws XMLStreamException {
-        try {
-            if (envURI.equals(ns)) {
-                if (Envelope.equals(ln)) {
-                    currentElement = getEnvelope();
-                    fixPrefix(prefix);
-                    return;
-                } else if (Header.equals(ln)) {
-                    currentElement = soap.getSOAPHeader();
-                    fixPrefix(prefix);
-                    return;
-                } else if (Body.equals(ln)) {
-                    currentElement = soap.getSOAPBody();
-                    fixPrefix(prefix);
-                    return;
-                }
-            }
-            currentElement = (prefix == null) ?
-                    currentElement.addChildElement(new QName(ns, ln)) :
-                    currentElement.addChildElement(ln, prefix, ns);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    private void fixPrefix(final String prfx) throws XMLStreamException {
-        String oldPrfx = currentElement.getPrefix();
-        if (prfx != null && !prfx.equals(oldPrfx)) {
-            currentElement.setPrefix(prfx);
-        }
-    }
-
-    @Override
-    public void writeEmptyElement(final String uri, final String ln) throws XMLStreamException {
-        writeStartElement(null, ln, uri);
-    }
-
-    @Override
-    public void writeEmptyElement(final String prefix, final String ln, final String uri) throws XMLStreamException {
-        writeStartElement(prefix, ln, uri);
-    }
-
-    @Override
-    public void writeEmptyElement(final String ln) throws XMLStreamException {
-        writeStartElement(null, ln, null);
-    }
-
-    @Override
-    public void writeEndElement() throws XMLStreamException {
-        if (currentElement != null) currentElement = currentElement.getParentElement();
-    }
-
-    @Override
-    public void writeEndDocument() throws XMLStreamException {
-    }
-
-    @Override
-    public void close() throws XMLStreamException {
-    }
-
-    @Override
-    public void flush() throws XMLStreamException {
-    }
-
-    @Override
-    public void writeAttribute(final String ln, final String val) throws XMLStreamException {
-        writeAttribute(null, null, ln, val);
-    }
-
-    @Override
-    public void writeAttribute(final String prefix, final String ns, final String ln, final String value) throws XMLStreamException {
-        try {
-            if (ns == null) {
-                if (prefix == null && xmlns.equals(ln)) {
-                    currentElement.addNamespaceDeclaration("", value);
-                } else {
-                    currentElement.setAttributeNS("", ln, value);
-                }
-            } else {
-                QName name = (prefix == null) ? new QName(ns, ln) : new QName(ns, ln, prefix);
-                currentElement.addAttribute(name, value);
-            }
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeAttribute(final String ns, final String ln, final String val) throws XMLStreamException {
-        writeAttribute(null, ns, ln, val);
-    }
-
-    @Override
-    public void writeNamespace(String prefix, final String uri) throws XMLStreamException {
-
-        // make prefix default if null or "xmlns" (according to javadoc)
-        if (prefix == null || "xmlns".equals(prefix)) {
-            prefix = "";
-        }
-
-        try {
-            currentElement.addNamespaceDeclaration(prefix, uri);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeDefaultNamespace(final String uri) throws XMLStreamException {
-        writeNamespace("", uri);
-    }
-
-    @Override
-    public void writeComment(final String data) throws XMLStreamException {
-        Comment c = soap.getSOAPPart().createComment(data);
-        currentElement.appendChild(c);
-    }
-
-    @Override
-    public void writeProcessingInstruction(final String target) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createProcessingInstruction(target, "");
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeProcessingInstruction(final String target, final String data) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createProcessingInstruction(target, data);
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeCData(final String data) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createCDATASection(data);
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeDTD(final String dtd) throws XMLStreamException {
-        //TODO ... Don't do anything here
-    }
-
-    @Override
-    public void writeEntityRef(final String name) throws XMLStreamException {
-        Node n = soap.getSOAPPart().createEntityReference(name);
-        currentElement.appendChild(n);
-    }
-
-    @Override
-    public void writeStartDocument() throws XMLStreamException {
-    }
-
-    @Override
-    public void writeStartDocument(final String version) throws XMLStreamException {
-        if (version != null) soap.getSOAPPart().setXmlVersion(version);
-    }
-
-    @Override
-    public void writeStartDocument(final String encoding, final String version) throws XMLStreamException {
-        if (version != null) soap.getSOAPPart().setXmlVersion(version);
-        if (encoding != null) {
-            try {
-                soap.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, encoding);
-            } catch (SOAPException e) {
-                throw new XMLStreamException(e);
-            }
-        }
-    }
-
-    @Override
-    public void writeCharacters(final String text) throws XMLStreamException {
-        try {
-            currentElement.addTextNode(text);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void writeCharacters(final char[] text, final int start, final int len) throws XMLStreamException {
-        char[] chr = (start == 0 && len == text.length) ? text : Arrays.copyOfRange(text, start, start + len);
-        try {
-            currentElement.addTextNode(new String(chr));
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public String getPrefix(final String uri) throws XMLStreamException {
-        return currentElement.lookupPrefix(uri);
-    }
-
-    @Override
-    public void setPrefix(final String prefix, final String uri) throws XMLStreamException {
-        try {
-            this.currentElement.addNamespaceDeclaration(prefix, uri);
-        } catch (SOAPException e) {
-            throw new XMLStreamException(e);
-        }
-    }
-
-    @Override
-    public void setDefaultNamespace(final String uri) throws XMLStreamException {
-        setPrefix("", uri);
-    }
-
-    @Override
-    public void setNamespaceContext(final NamespaceContext context)throws XMLStreamException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Object getProperty(final String name) throws IllegalArgumentException {
-        //TODO the following line is to make eclipselink happy ... they are aware of this problem -
-        if (javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES.equals(name)) return Boolean.FALSE;
-        return null;
-    }
-
-    @Override
-    public NamespaceContext getNamespaceContext() {
-        return new NamespaceContext() {
-            public String getNamespaceURI(final String prefix) {
-                return currentElement.getNamespaceURI(prefix);
-            }
-            public String getPrefix(final String namespaceURI) {
-                return currentElement.lookupPrefix(namespaceURI);
-            }
-            public Iterator getPrefixes(final String namespaceURI) {
-                return new Iterator() {
-                    String prefix = getPrefix(namespaceURI);
-                    public boolean hasNext() {
-                        return (prefix != null);
-                    }
-                    public Object next() {
-                        if (!hasNext()) throw new java.util.NoSuchElementException();
-                        String next = prefix;
-                        prefix = null;
-                        return next;
-                    }
-                    public void remove() {}
-                };
-            }
-        };
-    }
-}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/util/SaajStaxWriterEx.java	Mon May 05 09:41:41 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute 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.xml.internal.org.jvnet.staxex.util;
-
-import java.io.OutputStream;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.UUID;
-
-import javax.activation.DataHandler;
-import javax.xml.bind.attachment.AttachmentMarshaller;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.stream.XMLStreamException;
-
-import com.sun.xml.internal.org.jvnet.staxex.Base64Data;
-import com.sun.xml.internal.org.jvnet.staxex.BinaryText;
-import com.sun.xml.internal.org.jvnet.staxex.MtomEnabled;
-import com.sun.xml.internal.org.jvnet.staxex.NamespaceContextEx;
-import com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler;
-import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx;
-//
-//import com.sun.xml.internal.ws.api.message.saaj.SaajStaxWriter;
-//import com.sun.xml.internal.ws.developer.StreamingDataHandler;
-//import com.sun.xml.internal.ws.streaming.MtomStreamWriter;
-
-/**
- * SaajStaxWriterEx converts XMLStreamWriterEx calls to build an orasaaj SOAPMessage with BinaryTextImpl.
- *
- * @author shih-chang.chen@oracle.com
- */
-public class SaajStaxWriterEx extends SaajStaxWriter implements XMLStreamWriterEx, MtomStreamWriter {
-
-    static final protected String xopNS = "http://www.w3.org/2004/08/xop/include";
-    static final protected String Include = "Include";
-    static final protected String href = "href";
-
-    private enum State {xopInclude, others};
-    private State state = State.others;
-    private BinaryText binaryText;
-
-    public SaajStaxWriterEx(SOAPMessage msg, String uri) throws SOAPException {
-        super(msg, uri);
-    }
-
-    public void writeStartElement(String prefix, String ln, String ns) throws XMLStreamException {
-        if (xopNS.equals(ns) && Include.equals(ln)) {
-            state = State.xopInclude;
-            return;
-        } else {
-            super.writeStartElement(prefix, ln, ns);
-        }
-    }
-
-    @Override
-    public void writeEndElement() throws XMLStreamException {
-        if (state.equals(State.xopInclude)) {
-            state = State.others;
-        } else {
-            super.writeEndElement();
-        }
-    }
-
-    @Override
-    public void writeAttribute(String prefix, String ns, String ln, String value) throws XMLStreamException {
-        if (binaryText != null && href.equals(ln)) {
-            return;
-        } else {
-            super.writeAttribute(prefix, ns, ln, value);
-        }
-    }
-
-//    @Override
-//    public void writeComment(String data) throws XMLStreamException {
-//        ((ElementImpl)currentElement).addCommentNode(data);
-//    }
-//
-//    @Override
-//    public void writeCData(String data) throws XMLStreamException {
-//      CDataTextImpl cdt = new CDataTextImpl(soap.getSOAPPart(), data);
-//        currentElement.appendChild(cdt);
-//    }
-
-    @Override
-    public NamespaceContextEx getNamespaceContext() {
-        return new NamespaceContextEx() {
-            public String getNamespaceURI(String prefix) {
-                return currentElement.getNamespaceURI(prefix);
-            }
-            public String getPrefix(String namespaceURI) {
-                return currentElement.lookupPrefix(namespaceURI);
-            }
-            public Iterator getPrefixes(final String namespaceURI) {
-                return new Iterator() {
-                    String prefix = getPrefix(namespaceURI);
-                    public boolean hasNext() {
-                        return (prefix != null);
-                    }
-                    public Object next() {
-                        if (prefix == null) throw new java.util.NoSuchElementException();
-                        String next = prefix;
-                        prefix = null;
-                        return next;
-                    }
-                    public void remove() {}
-                };
-            }
-            public Iterator<Binding> iterator() {
-                return new Iterator<Binding>() {
-                    public boolean hasNext() { return false; }
-                    public Binding next() { return null; }
-                    public void remove() {}
-                };
-            }
-        };
-    }
-
-    @Override
-    public void writeBinary(DataHandler data) throws XMLStreamException {
-//      binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl)soap, null, currentElement.getOwnerDocument(), data);
-//      currentElement.appendChild(binaryText);
-        addBinaryText(data);
-    }
-
-    @Override
-    public OutputStream writeBinary(String arg0) throws XMLStreamException {
-        return null;
-    }
-
-    @Override
-    public void writeBinary(byte[] data, int offset, int length, String contentType) throws XMLStreamException {
-//        if (mtomThreshold == -1 || mtomThreshold > length) return null;
-        byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
-        if (currentElement instanceof MtomEnabled) {
-            binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
-        } else {
-            throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
-        }
-    }
-
-    @Override
-    public void writePCDATA(CharSequence arg0) throws XMLStreamException {
-        if (arg0 instanceof Base64Data) {
-            // The fix of StreamReaderBufferCreator preserves this dataHandler
-            addBinaryText(((Base64Data) arg0).getDataHandler());
-        } else {
-            // We should not normally get here as we expect a DataHandler,
-            // but this is the most general solution.  If we do get
-            // something other than a Data Handler, create a Text node with
-            // the data.  Another alternative would be to throw an exception,
-            // but in the most general case, we don't know whether this input
-            // is expected.
-            try {
-                currentElement.addTextNode(arg0.toString());
-            } catch (SOAPException e) {
-                throw new XMLStreamException("Cannot add Text node", e);
-            }
-        }
-    }
-
-    static private String encodeCid() {
-        String cid = "example.jaxws.sun.com";
-        String name = UUID.randomUUID() + "@";
-        return name + cid;
-    }
-
-    private String addBinaryText(DataHandler data) {
-        String hrefOrCid = null;
-        if (data instanceof StreamingDataHandler) {
-            hrefOrCid = ((StreamingDataHandler) data).getHrefCid();
-        }
-        if (hrefOrCid == null) hrefOrCid = encodeCid();
-
-        String prefixedCid = (hrefOrCid.startsWith("cid:")) ? hrefOrCid : "cid:" + hrefOrCid;
-        // Should we do the threshold processing on DataHandler ? But that would be
-        // expensive as DataHolder need to read the data again from its source
-      //binaryText = BinaryTextImpl.createBinaryTextFromDataHandler((MessageImpl) soap, prefixedCid, currentElement.getOwnerDocument(), data);
-      //currentElement.appendChild(binaryText);
-        if (currentElement instanceof MtomEnabled) {
-            binaryText = ((MtomEnabled) currentElement).addBinaryText(prefixedCid, data);
-        } else {
-            throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
-        }
-        return hrefOrCid;
-    }
-
-    public AttachmentMarshaller getAttachmentMarshaller() {
-        return new AttachmentMarshaller() {
-            @Override
-            public String addMtomAttachment(DataHandler data, String ns, String ln) {
-//                if (mtomThreshold == -1) return null;
-                String hrefOrCid = addBinaryText(data);
-//                return binaryText.getHref();
-                return hrefOrCid;
-            }
-
-            @Override
-            public String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String ns, String ln) {
-//                if (mtomThreshold == -1 || mtomThreshold > length) return null;
-                byte[] bytes = (offset == 0 && length == data.length) ? data : Arrays.copyOfRange(data, offset, offset + length);
-//                binaryText = (BinaryTextImpl) ((ElementImpl) currentElement).addAsBase64TextNode(bytes);
-                if (currentElement instanceof MtomEnabled) {
-                    binaryText = ((MtomEnabled) currentElement).addBinaryText(bytes);
-                } else {
-                    throw new IllegalStateException("The currentElement is not MtomEnabled " + currentElement);
-                }
-                return binaryText.getHref();
-            }
-
-            @Override
-            public String addSwaRefAttachment(DataHandler data) {
-                return "cid:"+encodeCid();
-            }
-
-            @Override
-            public boolean isXOPPackage() {
-                return true;
-            }
-        };
-    }
-}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java	Mon May 05 09:41:41 2014 -0700
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SAAJFactory.java	Mon May 05 12:49:13 2014 -0700
@@ -36,7 +36,6 @@
 import javax.xml.stream.XMLStreamException;
 
 import org.xml.sax.SAXException;
-import com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter;
 
 import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
 import com.sun.xml.internal.ws.api.SOAPVersion;
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/message/saaj/SaajStaxWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +42,6 @@
 /**
  * SaajStaxWriter builds a SAAJ SOAPMessage by using XMLStreamWriter interface.
  *
- * @deprecated use com.sun.xml.internal.org.jvnet.staxex.util.SaajStaxWriter
- *
  * @author shih-chang.chen@oracle.com
  */
 public class SaajStaxWriter implements XMLStreamWriter {
@@ -57,16 +55,21 @@
     static final protected String Body = "Body";
     static final protected String xmlns = "xmlns";
 
-    public SaajStaxWriter(final SOAPMessage msg) throws SOAPException {
+    private boolean isHeaderSeen = false;
+
+    public SaajStaxWriter(final SOAPMessage msg, String uri) throws SOAPException {
         soap = msg;
-        currentElement = soap.getSOAPPart().getEnvelope();
-        envURI = currentElement.getNamespaceURI();
+        this.envURI = uri;
     }
 
     public SOAPMessage getSOAPMessage() {
         return soap;
     }
 
+    protected SOAPElement getEnvelope() throws SOAPException {
+        return soap.getSOAPPart().getEnvelope();
+    }
+
     @Override
     public void writeStartElement(final String localName) throws XMLStreamException {
         try {
@@ -86,10 +89,11 @@
         try {
             if (envURI.equals(ns)) {
                 if (Envelope.equals(ln)) {
-                    currentElement = soap.getSOAPPart().getEnvelope();
+                    currentElement = getEnvelope();
                     fixPrefix(prefix);
                     return;
                 } else if (Header.equals(ln)) {
+                    isHeaderSeen = true;
                     currentElement = soap.getSOAPHeader();
                     fixPrefix(prefix);
                     return;
@@ -108,9 +112,13 @@
     }
 
     private void fixPrefix(final String prfx) throws XMLStreamException {
-        String oldPrfx = currentElement.getPrefix();
+        fixPrefix(prfx, currentElement);
+    }
+
+    private void fixPrefix(final String prfx, SOAPElement element) throws XMLStreamException {
+        String oldPrfx = element.getPrefix();
         if (prfx != null && !prfx.equals(oldPrfx)) {
-            currentElement.setPrefix(prfx);
+            element.setPrefix(prfx);
         }
     }
 
@@ -136,6 +144,21 @@
 
     @Override
     public void writeEndDocument() throws XMLStreamException {
+        try {
+            if (!isHeaderSeen) {
+                SOAPElement header = soap.getSOAPHeader();
+                if (header != null) {
+                    String prefixAtHeader = header.getPrefix();
+                    SOAPElement env = getEnvelope();
+                    header.detachNode();
+                    if (prefixAtHeader != null && !prefixAtHeader.equals(env.getPrefix())) {
+                        env.removeNamespaceDeclaration(prefixAtHeader);
+                    }
+                }
+            }
+        } catch (SOAPException e) {
+            throw new XMLStreamException(e);
+        }
     }
 
     @Override
--- a/jdk/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -253,3 +253,4 @@
 9e7bd44ea85c72318130379c34b98716b9c7c248 jdk9-b08
 2cef452ba711b17950da275fd15931925799f07c jdk9-b09
 ab06ba2894313a47e4969ca37792ff119c49e711 jdk9-b10
+47feccd164b7187a0147693a922ee47c6629643c jdk9-b11
--- a/jdk/make/data/jdwp/jdwp.spec	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/make/data/jdwp/jdwp.spec	Mon May 05 12:49:13 2014 -0700
@@ -1147,7 +1147,8 @@
         (ErrorSet
             (Error INVALID_CLASS     "clazz is not the ID of a class.")
             (Error INVALID_OBJECT    "clazz is not a known ID.")
-            (Error INVALID_METHODID  "methodID is not the ID of a method.")
+            (Error INVALID_METHODID  "methodID is not the ID of a static method in "
+                                     "this class type or one of its superclasses.")
             (Error INVALID_THREAD)
             (Error THREAD_NOT_SUSPENDED)
             (Error VM_DEAD)
@@ -1250,6 +1251,83 @@
     )
 )
 (CommandSet InterfaceType=5
+    (Command InvokeMethod=1
+        "Invokes a static method. "
+        "The method must not be a static initializer. "
+        "The method must be a member of the interface type. "
+        "<p>Since JDWP version 1.8 "
+        "<p>"
+        "The method invocation will occur in the specified thread. "
+        "Method invocation can occur only if the specified thread "
+        "has been suspended by an event. "
+        "Method invocation is not supported "
+        "when the target VM has been suspended by the front-end. "
+        "<p>"
+        "The specified method is invoked with the arguments in the specified "
+        "argument list. "
+        "The method invocation is synchronous; the reply packet is not "
+        "sent until the invoked method returns in the target VM. "
+        "The return value (possibly the void value) is "
+        "included in the reply packet. "
+        "If the invoked method throws an exception, the "
+        "exception object ID is set in the reply packet; otherwise, the "
+        "exception object ID is null. "
+        "<p>"
+        "For primitive arguments, the argument value's type must match the "
+        "argument's type exactly. For object arguments, there must exist a "
+        "widening reference conversion from the argument value's type to the "
+        "argument's type and the argument's type must be loaded. "
+        "<p>"
+        "By default, all threads in the target VM are resumed while "
+        "the method is being invoked if they were previously "
+        "suspended by an event or by a command. "
+        "This is done to prevent the deadlocks "
+        "that will occur if any of the threads own monitors "
+        "that will be needed by the invoked method. It is possible that "
+        "breakpoints or other events might occur during the invocation. "
+        "Note, however, that this implicit resume acts exactly like "
+        "the ThreadReference resume command, so if the thread's suspend "
+        "count is greater than 1, it will remain in a suspended state "
+        "during the invocation. By default, when the invocation completes, "
+        "all threads in the target VM are suspended, regardless their state "
+        "before the invocation. "
+        "<p>"
+        "The resumption of other threads during the invoke can be prevented "
+        "by specifying the INVOKE_SINGLE_THREADED "
+        "bit flag in the <code>options</code> field; however, "
+        "there is no protection against or recovery from the deadlocks "
+        "described above, so this option should be used with great caution. "
+        "Only the specified thread will be resumed (as described for all "
+        "threads above). Upon completion of a single threaded invoke, the invoking thread "
+        "will be suspended once again. Note that any threads started during "
+        "the single threaded invocation will not be suspended when the "
+        "invocation completes. "
+        "<p>"
+        "If the target VM is disconnected during the invoke (for example, through "
+        "the VirtualMachine dispose command) the method invocation continues. "
+        (Out
+            (interfaceType clazz "The interface type ID.")
+            (threadObject thread "The thread in which to invoke.")
+            (method methodID "The method to invoke.")
+            (Repeat arguments
+                (value arg "The argument value.")
+            )
+            (int options "Invocation <a href=\"#JDWP_InvokeOptions\">options</a>")
+        )
+        (Reply
+            (value returnValue "The returned value.")
+            (tagged-object exception "The thrown exception.")
+        )
+        (ErrorSet
+            (Error INVALID_CLASS     "clazz is not the ID of an interface.")
+            (Error INVALID_OBJECT    "clazz is not a known ID.")
+            (Error INVALID_METHODID  "methodID is not the ID of a static method in this "
+                                     "interface type or is the ID of a static initializer.")
+            (Error INVALID_THREAD)
+            (Error THREAD_NOT_SUSPENDED)
+            (Error VM_DEAD)
+        )
+    )
 )
 (CommandSet Method=6
     (Command LineTable=1
@@ -1543,7 +1621,7 @@
         "<p>"
         "By default, all threads in the target VM are resumed while "
         "the method is being invoked if they were previously "
-        "suspended by an event or by command. "
+        "suspended by an event or by a command. "
         "This is done to prevent the deadlocks "
         "that will occur if any of the threads own monitors "
         "that will be needed by the invoked method. It is possible that "
@@ -1586,7 +1664,9 @@
             (Error INVALID_OBJECT)
             (Error INVALID_CLASS     "clazz is not the ID of a reference "
                                      "type.")
-            (Error INVALID_METHODID  "methodID is not the ID of a method.")
+            (Error INVALID_METHODID  "methodID is not the ID of an instance method "
+                                     "in this object's type or one of its superclasses, "
+                                     "superinterfaces, or implemented interfaces.")
             (Error INVALID_THREAD)
             (Error THREAD_NOT_SUSPENDED)
             (Error VM_DEAD)
--- a/jdk/make/lib/Awt2dLibraries.gmk	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Mon May 05 12:49:13 2014 -0700
@@ -815,6 +815,10 @@
   BUILD_LIBFONTMANAGER_ExtensionSubtables.cpp_CXXFLAGS := -fno-strict-aliasing
 endif
 
+# Libfontmanager doesn't actually need X_LIBS to link, but if building
+# on a Solaris machine without X installed, using a devkit, linking
+# to libawt_xawt will fail without the -L parameters from X_LIBS. Filter
+# out the -R parameters since they aren't needed.
 $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
     LIBRARY := fontmanager, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
@@ -833,7 +837,8 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
     LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
-    LDFLAGS_SUFFIX_solaris := -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
+    LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
+        -lawt -lawt_xawt -lc $(LIBM) $(LIBCXX) -ljava -ljvm, \
     LDFLAGS_SUFFIX_aix := -lawt -lawt_xawt $(LIBM) $(LIBCXX) -ljava -ljvm,\
     LDFLAGS_SUFFIX_macosx := -lawt $(LIBM) $(LIBCXX) -undefined dynamic_lookup \
         -ljava -ljvm, \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/back/InterfaceTypeImpl.c	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 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.
+ */
+
+#include "util.h"
+#include "InterfaceTypeImpl.h"
+#include "inStream.h"
+#include "outStream.h"
+
+static jboolean
+invokeStatic(PacketInputStream *in, PacketOutputStream *out)
+{
+    return sharedInvoke(in, out);
+}
+
+void *InterfaceType_Cmds[] = { (void *)0x1
+    , (void *)invokeStatic
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/back/InterfaceTypeImpl.h	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.
+ */
+extern void *InterfaceType_Cmds[];
--- a/jdk/src/share/back/VirtualMachineImpl.c	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/back/VirtualMachineImpl.c	Mon May 05 12:49:13 2014 -0700
@@ -36,7 +36,7 @@
 
 static char *versionName = "Java Debug Wire Protocol (Reference Implementation)";
 static int majorVersion = 1;  /* JDWP major version */
-static int minorVersion = 6;  /* JDWP minor version */
+static int minorVersion = 8;  /* JDWP minor version */
 
 static jboolean
 version(PacketInputStream *in, PacketOutputStream *out)
--- a/jdk/src/share/back/debugDispatch.c	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/back/debugDispatch.c	Mon May 05 12:49:13 2014 -0700
@@ -29,6 +29,7 @@
 #include "VirtualMachineImpl.h"
 #include "ReferenceTypeImpl.h"
 #include "ClassTypeImpl.h"
+#include "InterfaceTypeImpl.h"
 #include "ArrayTypeImpl.h"
 #include "FieldImpl.h"
 #include "MethodImpl.h"
@@ -67,6 +68,7 @@
     l1Array[JDWP_COMMAND_SET(VirtualMachine)] = (void *)VirtualMachine_Cmds;
     l1Array[JDWP_COMMAND_SET(ReferenceType)] = (void *)ReferenceType_Cmds;
     l1Array[JDWP_COMMAND_SET(ClassType)] = (void *)ClassType_Cmds;
+    l1Array[JDWP_COMMAND_SET(InterfaceType)] = (void *)InterfaceType_Cmds;
     l1Array[JDWP_COMMAND_SET(ArrayType)] = (void *)ArrayType_Cmds;
 
     l1Array[JDWP_COMMAND_SET(Field)] = (void *)Field_Cmds;
--- a/jdk/src/share/back/util.c	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/back/util.c	Mon May 05 12:49:13 2014 -0700
@@ -591,6 +591,8 @@
         invokeType = INVOKE_CONSTRUCTOR;
     } else if (inStream_command(in) == JDWP_COMMAND(ClassType, InvokeMethod)) {
         invokeType = INVOKE_STATIC;
+    } else if (inStream_command(in) == JDWP_COMMAND(InterfaceType, InvokeMethod)) {
+        invokeType = INVOKE_STATIC;
     } else if (inStream_command(in) == JDWP_COMMAND(ObjectReference, InvokeMethod)) {
         invokeType = INVOKE_INSTANCE;
     } else {
--- a/jdk/src/share/classes/com/sun/jdi/ClassType.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ClassType.java	Mon May 05 12:49:13 2014 -0700
@@ -103,7 +103,7 @@
      * <p>
      * Object values must be assignment compatible with the field type
      * (This implies that the field type must be loaded through the
-     * enclosing class's class loader). Primitive values must be
+     * enclosing class' class loader). Primitive values must be
      * either assignment compatible with the field type or must be
      * convertible to the field type without loss of information.
      * See JLS section 5.2 for more information on assignment
@@ -153,7 +153,7 @@
      * <p>
      * Object arguments must be assignment compatible with the argument type
      * (This implies that the argument type must be loaded through the
-     * enclosing class's class loader). Primitive arguments must be
+     * enclosing class' class loader). Primitive arguments must be
      * either assignment compatible with the argument type or must be
      * convertible to the argument type without loss of information.
      * If the method being called accepts a variable number of arguments,
@@ -216,7 +216,7 @@
      * @return a {@link Value} mirror of the invoked method's return value.
      * @throws java.lang.IllegalArgumentException if the method is not
      * a member of this class or a superclass, if the size of the argument list
-     * does not match the number of declared arguemnts for the method, or
+     * does not match the number of declared arguments for the method, or
      * if the method is an initializer, constructor or static intializer.
      * @throws {@link InvalidTypeException} if any argument in the
      * argument list is not assignable to the corresponding method argument
@@ -230,7 +230,7 @@
      * @throws InvalidTypeException If the arguments do not meet this requirement --
      *         Object arguments must be assignment compatible with the argument
      *         type.  This implies that the argument type must be
-     *         loaded through the enclosing class's class loader.
+     *         loaded through the enclosing class' class loader.
      *         Primitive arguments must be either assignment compatible with the
      *         argument type or must be convertible to the argument type without loss
      *         of information. See JLS section 5.2 for more information on assignment
@@ -267,7 +267,7 @@
      * <p>
      * Object arguments must be assignment compatible with the argument type
      * (This implies that the argument type must be loaded through the
-     * enclosing class's class loader). Primitive arguments must be
+     * enclosing class' class loader). Primitive arguments must be
      * either assignment compatible with the argument type or must be
      * convertible to the argument type without loss of information.
      * If the method being called accepts a variable number of arguments,
@@ -335,7 +335,7 @@
      * @throws InvalidTypeException If the arguments do not meet this requirement --
      *         Object arguments must be assignment compatible with the argument
      *         type.  This implies that the argument type must be
-     *         loaded through the enclosing class's class loader.
+     *         loaded through the enclosing class' class loader.
      *         Primitive arguments must be either assignment compatible with the
      *         argument type or must be convertible to the argument type without loss
      *         of information. See JLS section 5.2 for more information on assignment
--- a/jdk/src/share/classes/com/sun/jdi/InterfaceType.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/InterfaceType.java	Mon May 05 12:49:13 2014 -0700
@@ -79,4 +79,123 @@
      * If none exist, returns a zero length List.
      */
     List<ClassType> implementors();
+
+    /**
+     * Invokes the specified static {@link Method} in the
+     * target VM. The
+     * specified method must be defined in this interface.
+     * The method must be a static method
+     * but not a static initializer.
+     * <p>
+     * The method invocation will occur in the specified thread.
+     * Method invocation can occur only if the specified thread
+     * has been suspended by an event which occurred in that thread.
+     * Method invocation is not supported
+     * when the target VM has been suspended through
+     * {@link VirtualMachine#suspend} or when the specified thread
+     * is suspended through {@link ThreadReference#suspend}.
+     * <p>
+     * The specified method is invoked with the arguments in the specified
+     * argument list.  The method invocation is synchronous; this method
+     * does not return until the invoked method returns in the target VM.
+     * If the invoked method throws an exception, this method will throw
+     * an {@link InvocationException} which contains a mirror to the exception
+     * object thrown.
+     * <p>
+     * Object arguments must be assignment compatible with the argument type
+     * (This implies that the argument type must be loaded through the
+     * enclosing class' class loader). Primitive arguments must be
+     * either assignment compatible with the argument type or must be
+     * convertible to the argument type without loss of information.
+     * If the method being called accepts a variable number of arguments,
+     * then the last argument type is an array of some component type.
+     * The argument in the matching position can be omitted, or can be null,
+     * an array of the same component type, or an argument of the
+     * component type followed by any number of other arguments of the same
+     * type. If the argument is omitted, then a 0 length array of the
+     * component type is passed.  The component type can be a primitive type.
+     * Autoboxing is not supported.
+     *
+     * See Section 5.2 of
+     * <cite>The Java&trade; Language Specification</cite>
+     * for more information on assignment compatibility.
+     * <p>
+     * By default, all threads in the target VM are resumed while
+     * the method is being invoked if they were previously
+     * suspended by an event or by {@link VirtualMachine#suspend} or
+     * {@link ThreadReference#suspend}. This is done to prevent the deadlocks
+     * that will occur if any of the threads own monitors
+     * that will be needed by the invoked method.
+     * Note, however, that this implicit resume acts exactly like
+     * {@link ThreadReference#resume}, so if the thread's suspend
+     * count is greater than 1, it will remain in a suspended state
+     * during the invocation and thus a deadlock could still occur.
+     * By default, when the invocation completes,
+     * all threads in the target VM are suspended, regardless their state
+     * before the invocation.
+     * It is possible that
+     * breakpoints or other events might occur during the invocation.
+     * This can cause deadlocks as described above. It can also cause a deadlock
+     * if invokeMethod is called from the client's event handler thread.  In this
+     * case, this thread will be waiting for the invokeMethod to complete and
+     * won't read the EventSet that comes in for the new event.  If this
+     * new EventSet is SUSPEND_ALL, then a deadlock will occur because no
+     * one will resume the EventSet.  To avoid this, all EventRequests should
+     * be disabled before doing the invokeMethod, or the invokeMethod should
+     * not be done from the client's event handler thread.
+     * <p>
+     * The resumption of other threads during the invocation can be prevented
+     * by specifying the {@link #INVOKE_SINGLE_THREADED}
+     * bit flag in the <code>options</code> argument; however,
+     * there is no protection against or recovery from the deadlocks
+     * described above, so this option should be used with great caution.
+     * Only the specified thread will be resumed (as described for all
+     * threads above). Upon completion of a single threaded invoke, the invoking thread
+     * will be suspended once again. Note that any threads started during
+     * the single threaded invocation will not be suspended when the
+     * invocation completes.
+     * <p>
+     * If the target VM is disconnected during the invoke (for example, through
+     * {@link VirtualMachine#dispose}) the method invocation continues.
+     *
+     * @param thread the thread in which to invoke.
+     * @param method the {@link Method} to invoke.
+     * @param arguments the list of {@link Value} arguments bound to the
+     * invoked method. Values from the list are assigned to arguments
+     * in the order they appear in the method signature.
+     * @param options the integer bit flag options.
+     * @return a {@link Value} mirror of the invoked method's return value.
+     * @throws java.lang.IllegalArgumentException if the method is not
+     * a member of this interface, if the size of the argument list
+     * does not match the number of declared arguments for the method, or
+     * if the method is not static or is a static initializer.
+     * @throws {@link InvalidTypeException} if any argument in the
+     * argument list is not assignable to the corresponding method argument
+     * type.
+     * @throws ClassNotLoadedException if any argument type has not yet been loaded
+     * through the appropriate class loader.
+     * @throws IncompatibleThreadStateException if the specified thread has not
+     * been suspended by an event.
+     * @throws InvocationException if the method invocation resulted in
+     * an exception in the target VM.
+     * @throws InvalidTypeException If the arguments do not meet this requirement --
+     *         Object arguments must be assignment compatible with the argument
+     *         type.  This implies that the argument type must be
+     *         loaded through the enclosing class' class loader.
+     *         Primitive arguments must be either assignment compatible with the
+     *         argument type or must be convertible to the argument type without loss
+     *         of information. See JLS section 5.2 for more information on assignment
+     *         compatibility.
+     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+     *
+     * @since 1.8
+     */
+    default Value invokeMethod(ThreadReference thread, Method method,
+                       List<? extends Value> arguments, int options)
+            throws InvalidTypeException,
+            ClassNotLoadedException,
+            IncompatibleThreadStateException,
+            InvocationException {
+        throw new UnsupportedOperationException();
+    }
 }
--- a/jdk/src/share/classes/com/sun/jdi/Method.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/Method.java	Mon May 05 12:49:13 2014 -0700
@@ -138,6 +138,18 @@
     boolean isAbstract();
 
     /**
+     * Determine if this method is a default method
+     *
+     * @return <code>true</code> if the method is declared default;
+     * false otherwise
+     *
+     * @since 1.8
+     */
+    default boolean isDefault() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
      * Determine if this method is synchronized.
      *
      * @return <code>true</code> if the method is declared synchronized;
--- a/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/jdi/ObjectReference.java	Mon May 05 12:49:13 2014 -0700
@@ -194,10 +194,10 @@
      * {@link #INVOKE_NONVIRTUAL} bit flag in the <code>options</code>
      * argument. If this flag is set, the specified method is invoked
      * whether or not it is overridden for this object's runtime type.
-     * The method, in this case, must not belong to an interface and
-     * must not be abstract. This option is useful for performing method
-     * invocations like those done with the <code>super</code> keyword in
-     * the Java programming language.
+     * The method, in this case, must have an implementation, either in a class
+     * or an interface. This option is useful for performing method invocations
+     * like those done with the <code>super</code> keyword in the Java programming
+     * language.
      * <p>
      * By default, all threads in the target VM are resumed while
      * the method is being invoked if they were previously
@@ -246,10 +246,10 @@
      * @return a {@link Value} mirror of the invoked method's return value.
      * @throws java.lang.IllegalArgumentException if the method is not
      * a member of this object's class, if the size of the argument list
-     * does not match the number of declared arguemnts for the method,
+     * does not match the number of declared arguments for the method,
      * if the method is a constructor or static intializer, or
      * if {@link #INVOKE_NONVIRTUAL} is specified and the method is
-     * either abstract or an interface member.
+     * either abstract or a non-default interface member.
      * @throws {@link InvalidTypeException} if any argument in the
      * argument list is not assignable to the corresponding method argument
      * type.
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java	Mon May 05 12:49:13 2014 -0700
@@ -87,6 +87,10 @@
             new Algorithm("", "SHA1withDSA", "Signature")
         );
         algorithmsMap.put(
+            XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256,
+            new Algorithm("", "SHA256withDSA", "Signature")
+        );
+        algorithmsMap.put(
             XMLSignature.ALGO_ID_SIGNATURE_NOT_RECOMMENDED_RSA_MD5,
             new Algorithm("", "MD5withRSA", "Signature")
         );
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java	Mon May 05 12:49:13 2014 -0700
@@ -380,7 +380,12 @@
      * This method registers the default algorithms.
      */
     public static void registerDefaultAlgorithms() {
-        algorithmHash.put(SignatureDSA.URI, SignatureDSA.class);
+        algorithmHash.put(
+            XMLSignature.ALGO_ID_SIGNATURE_DSA, SignatureDSA.class
+        );
+        algorithmHash.put(
+            XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256, SignatureDSA.SHA256.class
+        );
         algorithmHash.put(
             XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1, SignatureBaseRSA.SignatureRSASHA1.class
         );
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureDSA.java	Mon May 05 12:49:13 2014 -0700
@@ -31,13 +31,15 @@
 import java.security.SecureRandom;
 import java.security.Signature;
 import java.security.SignatureException;
+import java.security.interfaces.DSAKey;
 import java.security.spec.AlgorithmParameterSpec;
 
 import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper;
 import com.sun.org.apache.xml.internal.security.algorithms.SignatureAlgorithmSpi;
+import com.sun.org.apache.xml.internal.security.signature.XMLSignature;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureException;
 import com.sun.org.apache.xml.internal.security.utils.Base64;
-import com.sun.org.apache.xml.internal.security.utils.Constants;
+import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
 
 public class SignatureDSA extends SignatureAlgorithmSpi {
 
@@ -45,19 +47,19 @@
     private static java.util.logging.Logger log =
         java.util.logging.Logger.getLogger(SignatureDSA.class.getName());
 
-    /** Field URI */
-    public static final String URI = Constants.SignatureSpecNS + "dsa-sha1";
-
     /** Field algorithm */
     private java.security.Signature signatureAlgorithm = null;
 
+    /** size of Q */
+    private int size;
+
     /**
      * Method engineGetURI
      *
      * @inheritDoc
      */
     protected String engineGetURI() {
-        return SignatureDSA.URI;
+        return XMLSignature.ALGO_ID_SIGNATURE_DSA;
     }
 
     /**
@@ -66,7 +68,7 @@
      * @throws XMLSignatureException
      */
     public SignatureDSA() throws XMLSignatureException {
-        String algorithmID = JCEMapper.translateURItoJCEID(SignatureDSA.URI);
+        String algorithmID = JCEMapper.translateURItoJCEID(engineGetURI());
         if (log.isLoggable(java.util.logging.Level.FINE)) {
             log.log(java.util.logging.Level.FINE, "Created SignatureDSA using " + algorithmID);
         }
@@ -110,7 +112,8 @@
                 log.log(java.util.logging.Level.FINE, "Called DSA.verify() on " + Base64.encode(signature));
             }
 
-            byte[] jcebytes = SignatureDSA.convertXMLDSIGtoASN1(signature);
+            byte[] jcebytes = JavaUtils.convertDsaXMLDSIGtoASN1(signature,
+                                                                size/8);
 
             return this.signatureAlgorithm.verify(jcebytes);
         } catch (SignatureException ex) {
@@ -150,6 +153,7 @@
             }
             throw new XMLSignatureException("empty", ex);
         }
+        size = ((DSAKey)publicKey).getParams().getQ().bitLength();
     }
 
     /**
@@ -159,7 +163,7 @@
         try {
             byte jcebytes[] = this.signatureAlgorithm.sign();
 
-            return SignatureDSA.convertASN1toXMLDSIG(jcebytes);
+            return JavaUtils.convertDsaASN1toXMLDSIG(jcebytes, size/8);
         } catch (IOException ex) {
             throw new XMLSignatureException("empty", ex);
         } catch (SignatureException ex) {
@@ -185,6 +189,7 @@
         } catch (InvalidKeyException ex) {
             throw new XMLSignatureException("empty", ex);
         }
+        size = ((DSAKey)privateKey).getParams().getQ().bitLength();
     }
 
     /**
@@ -204,6 +209,7 @@
         } catch (InvalidKeyException ex) {
             throw new XMLSignatureException("empty", ex);
         }
+        size = ((DSAKey)privateKey).getParams().getQ().bitLength();
     }
 
     /**
@@ -258,100 +264,6 @@
     }
 
     /**
-     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param asn1Bytes
-     * @return the decode bytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[]) throws IOException {
-
-        byte rLength = asn1Bytes[3];
-        int i;
-
-        for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
-
-        byte sLength = asn1Bytes[5 + rLength];
-        int j;
-
-        for (j = sLength;
-            (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
-
-        if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
-            || (asn1Bytes[2] != 2) || (i > 20)
-            || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
-            throw new IOException("Invalid ASN.1 format of DSA signature");
-        }
-        byte xmldsigBytes[] = new byte[40];
-
-        System.arraycopy(asn1Bytes, (4 + rLength) - i, xmldsigBytes, 20 - i, i);
-        System.arraycopy(asn1Bytes, (6 + rLength + sLength) - j, xmldsigBytes,
-                         40 - j, j);
-
-        return xmldsigBytes;
-    }
-
-    /**
-     * Converts a XML Signature DSA Value to an ASN.1 DSA value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param xmldsigBytes
-     * @return the encoded ASN.1 bytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[]) throws IOException {
-
-        if (xmldsigBytes.length != 40) {
-            throw new IOException("Invalid XMLDSIG format of DSA signature");
-        }
-
-        int i;
-
-        for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
-
-        int j = i;
-
-        if (xmldsigBytes[20 - i] < 0) {
-            j += 1;
-        }
-
-        int k;
-
-        for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
-
-        int l = k;
-
-        if (xmldsigBytes[40 - k] < 0) {
-            l += 1;
-        }
-
-        byte asn1Bytes[] = new byte[6 + j + l];
-
-        asn1Bytes[0] = 48;
-        asn1Bytes[1] = (byte) (4 + j + l);
-        asn1Bytes[2] = 2;
-        asn1Bytes[3] = (byte) j;
-
-        System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
-
-        asn1Bytes[4 + j] = 2;
-        asn1Bytes[5 + j] = (byte) l;
-
-        System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
-
-        return asn1Bytes;
-    }
-
-    /**
      * Method engineSetHMACOutputLength
      *
      * @param HMACOutputLength
@@ -373,4 +285,15 @@
     ) throws XMLSignatureException {
         throw new XMLSignatureException("algorithms.CannotUseAlgorithmParameterSpecOnDSA");
     }
+
+    public static class SHA256 extends SignatureDSA {
+
+        public SHA256() throws XMLSignatureException {
+            super();
+        }
+
+        public String engineGetURI() {
+            return XMLSignature.ALGO_ID_SIGNATURE_DSA_SHA256;
+        }
+    }
 }
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java	Mon May 05 12:49:13 2014 -0700
@@ -85,6 +85,10 @@
     public static final String ALGO_ID_SIGNATURE_DSA =
         Constants.SignatureSpecNS + "dsa-sha1";
 
+    /** Signature - Optional DSAwithSHA256 */
+    public static final String ALGO_ID_SIGNATURE_DSA_SHA256 =
+        Constants.SignatureSpec11NS + "dsa-sha256";
+
     /** Signature - Recommended RSAwithSHA1 */
     public static final String ALGO_ID_SIGNATURE_RSA =
         Constants.SignatureSpecNS + "rsa-sha1";
--- a/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/JavaUtils.java	Mon May 05 12:49:13 2014 -0700
@@ -145,4 +145,98 @@
 
         return retBytes;
     }
+
+    /**
+     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
+     *
+     * The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+     * pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
+     * core BigInteger values.
+     *
+     * @param asn1Bytes the ASN.1 encoded bytes
+     * @param size size of r and s in bytes
+     * @return the XML Signature encoded bytes
+     * @throws IOException if the bytes are not encoded correctly
+     * @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
+     */
+    public static byte[] convertDsaASN1toXMLDSIG(byte[] asn1Bytes, int size)
+        throws IOException
+    {
+        if (asn1Bytes[0] != 48 || asn1Bytes[1] != asn1Bytes.length - 2
+            || asn1Bytes[2] != 2) {
+            throw new IOException("Invalid ASN.1 format of DSA signature");
+        }
+
+        byte rLength = asn1Bytes[3];
+        int i;
+        for (i = rLength; i > 0 && asn1Bytes[4 + rLength - i] == 0; i--);
+
+        byte sLength = asn1Bytes[5 + rLength];
+        int j;
+        for (j = sLength;
+             j > 0 && asn1Bytes[6 + rLength + sLength - j] == 0; j--);
+
+        if (i > size || asn1Bytes[4 + rLength] != 2 || j > size) {
+            throw new IOException("Invalid ASN.1 format of DSA signature");
+        } else {
+            byte[] xmldsigBytes = new byte[size * 2];
+            System.arraycopy(asn1Bytes, 4 + rLength - i, xmldsigBytes,
+                             size - i, i);
+            System.arraycopy(asn1Bytes, 6 + rLength + sLength - j,
+                             xmldsigBytes, size * 2 - j, j);
+            return xmldsigBytes;
+        }
+    }
+
+    /**
+     * Converts an XML Signature DSA Value to a ASN.1 DSA value.
+     *
+     * The JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
+     * pairs (see section 2.2.2 of RFC 3279); the XML Signature requires the
+     * core BigInteger values.
+     *
+     * @param xmldsigBytes the XML Signature encoded bytes
+     * @param size size of r and s in bytes
+     * @return the ASN.1 encoded bytes
+     * @throws IOException if the bytes are not encoded correctly
+     * @see <A HREF="http://www.w3.org/TR/xmldsig-core1/#sec-DSA">6.4.1 DSA</A>
+     */
+    public static byte[] convertDsaXMLDSIGtoASN1(byte[] xmldsigBytes, int size)
+        throws IOException
+    {
+        int totalSize = size * 2;
+        if (xmldsigBytes.length != totalSize) {
+            throw new IOException("Invalid XMLDSIG format of DSA signature");
+        }
+
+        int i;
+        for (i = size; i > 0 && xmldsigBytes[size - i] == 0; i--);
+
+        int j = i;
+        if (xmldsigBytes[size - i] < 0) {
+            j++;
+        }
+
+        int k;
+        for (k = size; k > 0 && xmldsigBytes[totalSize - k] == 0; k--);
+
+        int l = k;
+        if (xmldsigBytes[totalSize - k] < 0) {
+            l++;
+        }
+
+        byte[] asn1Bytes = new byte[6 + j + l];
+        asn1Bytes[0] = 48;
+        asn1Bytes[1] = (byte)(4 + j + l);
+        asn1Bytes[2] = 2;
+        asn1Bytes[3] = (byte)j;
+        System.arraycopy(xmldsigBytes, size - i, asn1Bytes, 4 + j - i, i);
+
+        asn1Bytes[4 + j] = 2;
+        asn1Bytes[5 + j] = (byte) l;
+        System.arraycopy(xmldsigBytes, totalSize - k, asn1Bytes,
+                         6 + j + l - k, k);
+
+        return asn1Bytes;
+    }
 }
--- a/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/example/debug/expr/LValue.java	Mon May 05 12:49:13 2014 -0700
@@ -559,6 +559,9 @@
             } else if (refType instanceof ClassType) {
                 ClassType clazz = (ClassType)refType;
                 return jdiValue = clazz.invokeMethod(thread, matchingMethod, methodArguments, 0);
+            } else if (refType instanceof InterfaceType) {
+                InterfaceType iface = (InterfaceType)refType;
+                return jdiValue = iface.invokeMethod(thread, matchingMethod, methodArguments, 0);
             } else {
                 throw new InvalidTypeException("Cannot invoke static method on " +
                                          refType.name());
--- a/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ClassTypeImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -29,9 +29,27 @@
 
 import java.util.*;
 
-public class ClassTypeImpl extends ReferenceTypeImpl
+final public class ClassTypeImpl extends InvokableTypeImpl
     implements ClassType
 {
+    private static class IResult implements InvocationResult {
+        final private JDWP.ClassType.InvokeMethod rslt;
+
+        public IResult(JDWP.ClassType.InvokeMethod rslt) {
+            this.rslt = rslt;
+        }
+
+        @Override
+        public ObjectReferenceImpl getException() {
+            return rslt.exception;
+        }
+
+        @Override
+        public ValueImpl getResult() {
+            return rslt.returnValue;
+        }
+    }
+
     private boolean cachedSuperclass = false;
     private ClassType superclass = null;
     private int lastLine = -1;
@@ -65,6 +83,7 @@
         return superclass;
     }
 
+    @Override
     public List<InterfaceType> interfaces()  {
         if (interfaces == null) {
             interfaces = getInterfaces();
@@ -72,26 +91,9 @@
         return interfaces;
     }
 
-    void addInterfaces(List<InterfaceType> list) {
-        List<InterfaceType> immediate = interfaces();
-        list.addAll(interfaces());
-
-        Iterator<InterfaceType> iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-
-        ClassTypeImpl superclass = (ClassTypeImpl)superclass();
-        if (superclass != null) {
-            superclass.addInterfaces(list);
-        }
-    }
-
-    public List<InterfaceType> allInterfaces()  {
-        List<InterfaceType> all = new ArrayList<InterfaceType>();
-        addInterfaces(all);
-        return all;
+    @Override
+    public List<InterfaceType> allInterfaces() {
+        return getAllInterfaces();
     }
 
     public List<ClassType> subclasses() {
@@ -159,28 +161,6 @@
         }
     }
 
-    PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
-                                   final MethodImpl method,
-                                   final ValueImpl[] args,
-                                   final int options) {
-        CommandSender sender =
-            new CommandSender() {
-                public PacketStream send() {
-                    return JDWP.ClassType.InvokeMethod.enqueueCommand(
-                                          vm, ClassTypeImpl.this, thread,
-                                          method.ref(), args, options);
-                }
-        };
-
-        PacketStream stream;
-        if ((options & INVOKE_SINGLE_THREADED) != 0) {
-            stream = thread.sendResumingCommand(sender);
-        } else {
-            stream = vm.sendResumingCommand(sender);
-        }
-        return stream;
-    }
-
     PacketStream sendNewInstanceCommand(final ThreadReferenceImpl thread,
                                    final MethodImpl method,
                                    final ValueImpl[] args,
@@ -203,52 +183,6 @@
         return stream;
     }
 
-    public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
-                              List<? extends Value> origArguments, int options)
-                                   throws InvalidTypeException,
-                                          ClassNotLoadedException,
-                                          IncompatibleThreadStateException,
-                                          InvocationException {
-        validateMirror(threadIntf);
-        validateMirror(methodIntf);
-        validateMirrorsOrNulls(origArguments);
-
-        MethodImpl method = (MethodImpl)methodIntf;
-        ThreadReferenceImpl thread = (ThreadReferenceImpl)threadIntf;
-
-        validateMethodInvocation(method);
-
-        List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
-
-        ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
-        JDWP.ClassType.InvokeMethod ret;
-        try {
-            PacketStream stream =
-                sendInvokeCommand(thread, method, args, options);
-            ret = JDWP.ClassType.InvokeMethod.waitForReply(vm, stream);
-        } catch (JDWPException exc) {
-            if (exc.errorCode() == JDWP.Error.INVALID_THREAD) {
-                throw new IncompatibleThreadStateException();
-            } else {
-                throw exc.toJDIException();
-            }
-        }
-
-        /*
-         * There is an implict VM-wide suspend at the conclusion
-         * of a normal (non-single-threaded) method invoke
-         */
-        if ((options & INVOKE_SINGLE_THREADED) == 0) {
-            vm.notifySuspend();
-        }
-
-        if (ret.exception != null) {
-            throw new InvocationException(ret.exception);
-        } else {
-            return ret.returnValue;
-        }
-    }
-
     public ObjectReference newInstance(ThreadReference threadIntf,
                                        Method methodIntf,
                                        List<? extends Value> origArguments,
@@ -311,58 +245,6 @@
        return method;
    }
 
-   public List<Method> allMethods() {
-        ArrayList<Method> list = new ArrayList<Method>(methods());
-
-        ClassType clazz = superclass();
-        while (clazz != null) {
-            list.addAll(clazz.methods());
-            clazz = clazz.superclass();
-        }
-
-        /*
-         * Avoid duplicate checking on each method by iterating through
-         * duplicate-free allInterfaces() rather than recursing
-         */
-        for (InterfaceType interfaze : allInterfaces()) {
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List<ReferenceType> inheritedTypes() {
-        List<ReferenceType> inherited = new ArrayList<ReferenceType>();
-        if (superclass() != null) {
-            inherited.add(0, (ReferenceType)superclass()); /* insert at front */
-        }
-        for (ReferenceType rt : interfaces()) {
-            inherited.add(rt);
-        }
-        return inherited;
-    }
-
-    void validateMethodInvocation(Method method)
-                                   throws InvalidTypeException,
-                                          InvocationException {
-        /*
-         * Method must be in this class or a superclass.
-         */
-        ReferenceTypeImpl declType = (ReferenceTypeImpl)method.declaringType();
-        if (!declType.isAssignableFrom(this)) {
-            throw new IllegalArgumentException("Invalid method");
-        }
-
-        /*
-         * Method must be a static and not a static initializer
-         */
-        if (!method.isStatic()) {
-            throw new IllegalArgumentException("Cannot invoke instance method on a class type");
-        } else if (method.isStaticInitializer()) {
-            throw new IllegalArgumentException("Cannot invoke static initializer");
-        }
-    }
-
     void validateConstructorInvocation(Method method)
                                    throws InvalidTypeException,
                                           InvocationException {
@@ -382,51 +264,33 @@
         }
     }
 
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        Iterator<InterfaceType> iter = interfaces().iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            if (!seenInterfaces.contains(interfaze)) {
-                interfaze.addVisibleMethods(methodMap, seenInterfaces);
-                seenInterfaces.add(interfaze);
-            }
-        }
-
-        ClassTypeImpl clazz = (ClassTypeImpl)superclass();
-        if (clazz != null) {
-            clazz.addVisibleMethods(methodMap, seenInterfaces);
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-        ClassTypeImpl superclazz = (ClassTypeImpl)superclass();
-        if (this.equals(type)) {
-            return true;
-        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
-            return true;
-        } else {
-            List<InterfaceType> interfaces = interfaces();
-            Iterator<InterfaceType> iter = interfaces.iterator();
-            while (iter.hasNext()) {
-                InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-                if (interfaze.isAssignableTo(type)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
 
     public String toString() {
        return "class " + name() + " (" + loaderString() + ")";
     }
+
+    @Override
+    CommandSender getInvokeMethodSender(ThreadReferenceImpl thread,
+                                        MethodImpl method,
+                                        ValueImpl[] args,
+                                        int options) {
+        return () ->
+            JDWP.ClassType.InvokeMethod.enqueueCommand(vm,
+                                                       ClassTypeImpl.this,
+                                                       thread,
+                                                       method.ref(),
+                                                       args,
+                                                       options);
+    }
+
+    @Override
+    InvocationResult waitForReply(PacketStream stream) throws JDWPException {
+        return new IResult(JDWP.ClassType.InvokeMethod.waitForReply(vm, stream));
+    }
+
+    @Override
+    boolean canInvoke(Method method) {
+        // Method must be in this class or a superclass.
+        return ((ReferenceTypeImpl)method.declaringType()).isAssignableFrom(this);
+    }
 }
--- a/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/InterfaceTypeImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -29,14 +29,31 @@
 
 import java.util.List;
 import java.util.ArrayList;
-import java.util.Map;
-import java.util.Iterator;
 import java.util.Collections;
 import java.util.Set;
 import java.lang.ref.SoftReference;
 
-public class InterfaceTypeImpl extends ReferenceTypeImpl
-                               implements InterfaceType {
+final public class InterfaceTypeImpl extends InvokableTypeImpl
+                                     implements InterfaceType {
+
+    private static class IResult implements InvocationResult {
+        final private JDWP.InterfaceType.InvokeMethod rslt;
+
+        public IResult(JDWP.InterfaceType.InvokeMethod rslt) {
+            this.rslt = rslt;
+        }
+
+        @Override
+        public ObjectReferenceImpl getException() {
+            return rslt.exception;
+        }
+
+        @Override
+        public ValueImpl getResult() {
+            return rslt.returnValue;
+        }
+
+    }
 
     private SoftReference<List<InterfaceType>> superinterfacesRef = null;
 
@@ -81,102 +98,6 @@
         return implementors;
     }
 
-    @Override
-    void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
-        /*
-         * Add methods from
-         * parent types first, so that the methods in this class will
-         * overwrite them in the hash table
-         */
-
-        for (InterfaceType interfaze : superinterfaces()) {
-            if (!seenInterfaces.contains(interfaze)) {
-                ((InterfaceTypeImpl)interfaze).addVisibleMethods(methodMap, seenInterfaces);
-                seenInterfaces.add(interfaze);
-            }
-        }
-
-        addToMethodMap(methodMap, methods());
-    }
-
-    public List<Method> allMethods() {
-        ArrayList<Method> list = new ArrayList<Method>(methods());
-
-        /*
-         * It's more efficient if don't do this
-         * recursively.
-         */
-        for (InterfaceType interfaze : allSuperinterfaces()) {
-            list.addAll(interfaze.methods());
-        }
-
-        return list;
-    }
-
-    List<InterfaceType> allSuperinterfaces() {
-        ArrayList<InterfaceType> list = new ArrayList<InterfaceType>();
-        addSuperinterfaces(list);
-        return list;
-    }
-
-    void addSuperinterfaces(List<InterfaceType> list) {
-        /*
-         * This code is a little strange because it
-         * builds the list with a more suitable order than the
-         * depth-first approach a normal recursive solution would
-         * take. Instead, all direct superinterfaces precede all
-         * indirect ones.
-         */
-
-        /*
-         * Get a list of direct superinterfaces that's not already in the
-         * list being built.
-         */
-        List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
-        Iterator<InterfaceType> iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceType interfaze = iter.next();
-            if (list.contains(interfaze)) {
-                iter.remove();
-            }
-        }
-
-        /*
-         * Add all new direct superinterfaces
-         */
-        list.addAll(immediate);
-
-        /*
-         * Recurse for all new direct superinterfaces.
-         */
-        iter = immediate.iterator();
-        while (iter.hasNext()) {
-            InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
-            interfaze.addSuperinterfaces(list);
-        }
-    }
-
-    boolean isAssignableTo(ReferenceType type) {
-
-        // Exact match?
-        if (this.equals(type)) {
-            return true;
-        } else {
-            // Try superinterfaces.
-            for (InterfaceType interfaze : superinterfaces()) {
-                if (((InterfaceTypeImpl)interfaze).isAssignableTo(type)) {
-                    return true;
-                }
-            }
-
-            return false;
-        }
-    }
-
-    List<InterfaceType> inheritedTypes() {
-        return superinterfaces();
-    }
-
     public boolean isInitialized() {
         return isPrepared();
     }
@@ -184,4 +105,39 @@
     public String toString() {
        return "interface " + name() + " (" + loaderString() + ")";
     }
-}
+
+    @Override
+    InvocationResult waitForReply(PacketStream stream) throws JDWPException {
+        return new IResult(JDWP.InterfaceType.InvokeMethod.waitForReply(vm, stream));
+    }
+
+    @Override
+    CommandSender getInvokeMethodSender(final ThreadReferenceImpl thread,
+                                        final MethodImpl method,
+                                        final ValueImpl[] args,
+                                        final int options) {
+        return () ->
+            JDWP.InterfaceType.InvokeMethod.enqueueCommand(vm,
+                                                           InterfaceTypeImpl.this,
+                                                           thread,
+                                                           method.ref(),
+                                                           args,
+                                                           options);
+    }
+
+    @Override
+    ClassType superclass() {
+        return null;
+    }
+
+    @Override
+    List<InterfaceType> interfaces() {
+        return superinterfaces();
+    }
+
+    @Override
+    boolean canInvoke(Method method) {
+        // method must be directly in this interface
+        return this.equals(method.declaringType());
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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.jdi;
+
+import com.sun.jdi.ClassNotLoadedException;
+import com.sun.jdi.ClassType;
+import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.InterfaceType;
+import com.sun.jdi.InvalidTypeException;
+import com.sun.jdi.InvocationException;
+import com.sun.jdi.Method;
+import com.sun.jdi.ReferenceType;
+import com.sun.jdi.ThreadReference;
+import com.sun.jdi.Value;
+import com.sun.jdi.VirtualMachine;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * A supertype for ReferenceTypes allowing method invocations
+ */
+abstract class InvokableTypeImpl extends ReferenceTypeImpl {
+    /**
+     * The invocation result wrapper
+     * It is necessary because both ClassType and InterfaceType
+     * use their own type to represent the invocation result
+     */
+    static interface InvocationResult {
+        ObjectReferenceImpl getException();
+        ValueImpl getResult();
+    }
+
+    InvokableTypeImpl(VirtualMachine aVm, long aRef) {
+        super(aVm, aRef);
+    }
+
+    /**
+     * Method invocation support.
+     * Shared by ClassType and InterfaceType
+     * @param threadIntf the thread in which to invoke.
+     * @param methodIntf method the {@link Method} to invoke.
+     * @param origArguments the list of {@link Value} arguments bound to the
+     * invoked method. Values from the list are assigned to arguments
+     * in the order they appear in the method signature.
+     * @param options the integer bit flag options.
+     * @return a {@link Value} mirror of the invoked method's return value.
+     * @throws java.lang.IllegalArgumentException if the method is not
+     * a member of this type, if the size of the argument list
+     * does not match the number of declared arguments for the method, or
+     * if the method is not static or is a static initializer.
+     * @throws {@link InvalidTypeException} if any argument in the
+     * argument list is not assignable to the corresponding method argument
+     * type.
+     * @throws ClassNotLoadedException if any argument type has not yet been loaded
+     * through the appropriate class loader.
+     * @throws IncompatibleThreadStateException if the specified thread has not
+     * been suspended by an event.
+     * @throws InvocationException if the method invocation resulted in
+     * an exception in the target VM.
+     * @throws InvalidTypeException If the arguments do not meet this requirement --
+     *         Object arguments must be assignment compatible with the argument
+     *         type.  This implies that the argument type must be
+     *         loaded through the enclosing class's class loader.
+     *         Primitive arguments must be either assignment compatible with the
+     *         argument type or must be convertible to the argument type without loss
+     *         of information. See JLS section 5.2 for more information on assignment
+     *         compatibility.
+     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+     */
+    final public Value invokeMethod(ThreadReference threadIntf, Method methodIntf,
+                                    List<? extends Value> origArguments, int options)
+                                        throws InvalidTypeException,
+                                               ClassNotLoadedException,
+                                               IncompatibleThreadStateException,
+                                               InvocationException {
+        validateMirror(threadIntf);
+        validateMirror(methodIntf);
+        validateMirrorsOrNulls(origArguments);
+        MethodImpl method = (MethodImpl) methodIntf;
+        ThreadReferenceImpl thread = (ThreadReferenceImpl) threadIntf;
+        validateMethodInvocation(method);
+        List<? extends Value> arguments = method.validateAndPrepareArgumentsForInvoke(origArguments);
+        ValueImpl[] args = arguments.toArray(new ValueImpl[0]);
+        InvocationResult ret;
+        try {
+            PacketStream stream = sendInvokeCommand(thread, method, args, options);
+            ret = waitForReply(stream);
+        } catch (JDWPException exc) {
+            if (exc.errorCode() == JDWP.Error.INVALID_THREAD) {
+                throw new IncompatibleThreadStateException();
+            } else {
+                throw exc.toJDIException();
+            }
+        }
+        /*
+         * There is an implict VM-wide suspend at the conclusion
+         * of a normal (non-single-threaded) method invoke
+         */
+        if ((options & ClassType.INVOKE_SINGLE_THREADED) == 0) {
+            vm.notifySuspend();
+        }
+        if (ret.getException() != null) {
+            throw new InvocationException(ret.getException());
+        } else {
+            return ret.getResult();
+        }
+    }
+
+    @Override
+    boolean isAssignableTo(ReferenceType type) {
+        ClassTypeImpl superclazz = (ClassTypeImpl) superclass();
+        if (this.equals(type)) {
+            return true;
+        } else if ((superclazz != null) && superclazz.isAssignableTo(type)) {
+            return true;
+        } else {
+            List<InterfaceType> interfaces = interfaces();
+            Iterator<InterfaceType> iter = interfaces.iterator();
+            while (iter.hasNext()) {
+                InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+                if (interfaze.isAssignableTo(type)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    }
+
+    @Override
+    final void addVisibleMethods(Map<String, Method> methodMap, Set<InterfaceType> seenInterfaces) {
+        /*
+         * Add methods from
+         * parent types first, so that the methods in this class will
+         * overwrite them in the hash table
+         */
+        Iterator<InterfaceType> iter = interfaces().iterator();
+        while (iter.hasNext()) {
+            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+            if (!seenInterfaces.contains(interfaze)) {
+                interfaze.addVisibleMethods(methodMap, seenInterfaces);
+                seenInterfaces.add(interfaze);
+            }
+        }
+        ClassTypeImpl clazz = (ClassTypeImpl) superclass();
+        if (clazz != null) {
+            clazz.addVisibleMethods(methodMap, seenInterfaces);
+        }
+        addToMethodMap(methodMap, methods());
+    }
+
+    final void addInterfaces(List<InterfaceType> list) {
+        List<InterfaceType> immediate = interfaces();
+        list.addAll(interfaces());
+        Iterator<InterfaceType> iter = immediate.iterator();
+        while (iter.hasNext()) {
+            InterfaceTypeImpl interfaze = (InterfaceTypeImpl) iter.next();
+            interfaze.addInterfaces(list);
+        }
+        ClassTypeImpl superclass = (ClassTypeImpl) superclass();
+        if (superclass != null) {
+            superclass.addInterfaces(list);
+        }
+    }
+
+    /**
+     * Returns all the implemented interfaces recursively
+     * @return A list of all the implemented interfaces (recursively)
+     */
+    final List<InterfaceType> getAllInterfaces() {
+        List<InterfaceType> all = new ArrayList<>();
+        addInterfaces(all);
+        return all;
+    }
+
+    /**
+     * Shared implementation of {@linkplain ClassType#allMethods()} and
+     * {@linkplain InterfaceType#allMethods()}
+     * @return A list of all methods (recursively)
+     */
+    public final List<Method> allMethods() {
+        ArrayList<Method> list = new ArrayList<>(methods());
+        ClassType clazz = superclass();
+        while (clazz != null) {
+            list.addAll(clazz.methods());
+            clazz = clazz.superclass();
+        }
+        /*
+         * Avoid duplicate checking on each method by iterating through
+         * duplicate-free allInterfaces() rather than recursing
+         */
+        for (InterfaceType interfaze : getAllInterfaces()) {
+            list.addAll(interfaze.methods());
+        }
+        return list;
+    }
+
+    @Override
+    final List<ReferenceType> inheritedTypes() {
+        List<ReferenceType> inherited = new ArrayList<>();
+        if (superclass() != null) {
+            inherited.add(0, superclass()); /* insert at front */
+        }
+        for (ReferenceType rt : interfaces()) {
+            inherited.add(rt);
+        }
+        return inherited;
+    }
+
+    private PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
+                                           final MethodImpl method,
+                                           final ValueImpl[] args,
+                                           final int options) {
+        CommandSender sender = getInvokeMethodSender(thread, method, args, options);
+        PacketStream stream;
+        if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {
+            stream = thread.sendResumingCommand(sender);
+        } else {
+            stream = vm.sendResumingCommand(sender);
+        }
+        return stream;
+    }
+
+    private void validateMethodInvocation(Method method)
+                                            throws InvalidTypeException,
+                                                   InvocationException {
+        if (!canInvoke(method)) {
+            throw new IllegalArgumentException("Invalid method");
+        }
+        /*
+         * Method must be a static and not a static initializer
+         */
+        if (!method.isStatic()) {
+            throw new IllegalArgumentException("Cannot invoke instance method on a class/interface type");
+        } else if (method.isStaticInitializer()) {
+            throw new IllegalArgumentException("Cannot invoke static initializer");
+        }
+    }
+
+    /**
+     * A subclass will provide specific {@linkplain CommandSender}
+     * @param thread the current invocation thread
+     * @param method the method to invoke
+     * @param args the arguments to pass to the method
+     * @param options the integer bit flag options
+     * @return the specific {@literal CommandSender} instance
+     */
+    abstract CommandSender getInvokeMethodSender(ThreadReferenceImpl thread,
+                                                 MethodImpl method,
+                                                 ValueImpl[] args,
+                                                 int options);
+
+    /**
+     * Waits for the reply to the last sent command
+     * @param stream the stream to listen for the reply on
+     * @return the {@linkplain InvocationResult} instance
+     * @throws JDWPException when something goes wrong in JDWP
+     */
+    abstract InvocationResult waitForReply(PacketStream stream) throws JDWPException;
+
+    /**
+     * Get the {@linkplain ReferenceType} superclass
+     * @return the superclass or null
+     */
+    abstract ClassType superclass();
+
+    /**
+     * Get the implemented/extended interfaces
+     * @return the list of implemented/extended interfaces
+     */
+    abstract List<InterfaceType> interfaces();
+
+    /**
+     * Checks the provided method whether it can be invoked
+     * @param method the method to check
+     * @return {@code TRUE} if the implementation knows how to invoke the method,
+     *         {@code FALSE} otherwise
+     */
+    abstract boolean canInvoke(Method method);
+}
--- a/jdk/src/share/classes/com/sun/tools/jdi/MethodImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/MethodImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -187,6 +187,13 @@
         return isModifierSet(VMModifiers.ABSTRACT);
     }
 
+    public boolean isDefault() {
+        return !isModifierSet(VMModifiers.ABSTRACT) &&
+               !isModifierSet(VMModifiers.STATIC) &&
+               !isModifierSet(VMModifiers.PRIVATE) &&
+               declaringType() instanceof InterfaceType;
+    }
+
     public boolean isSynchronized() {
         return isModifierSet(VMModifiers.SYNCHRONIZED);
     }
--- a/jdk/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -277,7 +277,6 @@
     void validateMethodInvocation(Method method, int options)
                                          throws InvalidTypeException,
                                          InvocationException {
-
         /*
          * Method must be in this object's class, a superclass, or
          * implemented interface
@@ -287,6 +286,19 @@
             throw new IllegalArgumentException("Invalid method");
         }
 
+        if (declType instanceof ClassTypeImpl) {
+            validateClassMethodInvocation(method, options);
+        } else if (declType instanceof InterfaceTypeImpl) {
+            validateIfaceMethodInvocation(method, options);
+        } else {
+            throw new InvalidTypeException();
+        }
+    }
+
+    void validateClassMethodInvocation(Method method, int options)
+                                         throws InvalidTypeException,
+                                         InvocationException {
+
         ClassTypeImpl clazz = invokableReferenceType(method);
 
         /*
@@ -300,9 +312,7 @@
          * For nonvirtual invokes, method must have a body
          */
         if ((options & INVOKE_NONVIRTUAL) != 0) {
-            if (method.declaringType() instanceof InterfaceType) {
-                throw new IllegalArgumentException("Interface method");
-            } else if (method.isAbstract()) {
+            if (method.isAbstract()) {
                 throw new IllegalArgumentException("Abstract method");
             }
         }
@@ -324,7 +334,7 @@
              */
             Method invoker = clazz.concreteMethodByName(method.name(),
                                                         method.signature());
-            //  isAssignableFrom check above guarantees non-null
+            //  invoker is supposed to be non-null under normal circumstances
             invokedClass = (ClassTypeImpl)invoker.declaringType();
         }
         /* The above code is left over from previous versions.
@@ -332,6 +342,17 @@
          */
     }
 
+    void validateIfaceMethodInvocation(Method method, int options)
+                                         throws InvalidTypeException,
+                                         InvocationException {
+        /*
+         * Only default methods allowed for nonvirtual invokes
+         */
+        if (!method.isDefault()) {
+            throw new IllegalArgumentException("Not a default method");
+        }
+    }
+
     PacketStream sendInvokeCommand(final ThreadReferenceImpl thread,
                                    final ClassTypeImpl refType,
                                    final MethodImpl method,
@@ -370,7 +391,10 @@
         ThreadReferenceImpl thread = (ThreadReferenceImpl)threadIntf;
 
         if (method.isStatic()) {
-            if (referenceType() instanceof ClassType) {
+            if (referenceType() instanceof InterfaceType) {
+                InterfaceType type = (InterfaceType)referenceType();
+                return type.invokeMethod(thread, method, origArguments, options);
+            } else if (referenceType() instanceof ClassType) {
                 ClassType type = (ClassType)referenceType();
                 return type.invokeMethod(thread, method, origArguments, options);
             } else {
--- a/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/com/sun/tools/jdi/VirtualMachineManagerImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -48,7 +48,7 @@
     private ResourceBundle messages = null;
     private int vmSequenceNumber = 0;
     private static final int majorVersion = 1;
-    private static final int minorVersion = 6;
+    private static final int minorVersion = 8;
 
     private static final Object lock = new Object();
     private static VirtualMachineManagerImpl vmm;
--- a/jdk/src/share/classes/java/lang/Math.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/lang/Math.java	Mon May 05 12:49:13 2014 -0700
@@ -1904,51 +1904,36 @@
          * are naturally handled without any additional testing
          */
 
-        // First check for NaN values
-        if (Double.isNaN(start) || Double.isNaN(direction)) {
-            // return a NaN derived from the input NaN(s)
-            return start + direction;
-        } else if (start == direction) {
-            return direction;
-        } else {        // start > direction or start < direction
+        /*
+         * IEEE 754 floating-point numbers are lexicographically
+         * ordered if treated as signed-magnitude integers.
+         * Since Java's integers are two's complement,
+         * incrementing the two's complement representation of a
+         * logically negative floating-point value *decrements*
+         * the signed-magnitude representation. Therefore, when
+         * the integer representation of a floating-point value
+         * is negative, the adjustment to the representation is in
+         * the opposite direction from what would initially be expected.
+         */
+
+        // Branch to descending case first as it is more costly than ascending
+        // case due to start != 0.0d conditional.
+        if (start > direction) { // descending
+            if (start != 0.0d) {
+                final long transducer = Double.doubleToRawLongBits(start);
+                return Double.longBitsToDouble(transducer + ((transducer > 0L) ? -1L : 1L));
+            } else { // start == 0.0d && direction < 0.0d
+                return -Double.MIN_VALUE;
+            }
+        } else if (start < direction) { // ascending
             // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
             // then bitwise convert start to integer.
-            long transducer = Double.doubleToRawLongBits(start + 0.0d);
-
-            /*
-             * IEEE 754 floating-point numbers are lexicographically
-             * ordered if treated as signed- magnitude integers .
-             * Since Java's integers are two's complement,
-             * incrementing" the two's complement representation of a
-             * logically negative floating-point value *decrements*
-             * the signed-magnitude representation. Therefore, when
-             * the integer representation of a floating-point values
-             * is less than zero, the adjustment to the representation
-             * is in the opposite direction than would be expected at
-             * first .
-             */
-            if (direction > start) { // Calculate next greater value
-                transducer = transducer + (transducer >= 0L ? 1L:-1L);
-            } else  { // Calculate next lesser value
-                assert direction < start;
-                if (transducer > 0L)
-                    --transducer;
-                else
-                    if (transducer < 0L )
-                        ++transducer;
-                    /*
-                     * transducer==0, the result is -MIN_VALUE
-                     *
-                     * The transition from zero (implicitly
-                     * positive) to the smallest negative
-                     * signed magnitude value must be done
-                     * explicitly.
-                     */
-                    else
-                        transducer = DoubleConsts.SIGN_BIT_MASK | 1L;
-            }
-
-            return Double.longBitsToDouble(transducer);
+            final long transducer = Double.doubleToRawLongBits(start + 0.0d);
+            return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
+        } else if (start == direction) {
+            return direction;
+        } else { // isNaN(start) || isNaN(direction)
+            return start + direction;
         }
     }
 
@@ -2003,51 +1988,36 @@
          * are naturally handled without any additional testing
          */
 
-        // First check for NaN values
-        if (Float.isNaN(start) || Double.isNaN(direction)) {
-            // return a NaN derived from the input NaN(s)
-            return start + (float)direction;
-        } else if (start == direction) {
-            return (float)direction;
-        } else {        // start > direction or start < direction
+        /*
+         * IEEE 754 floating-point numbers are lexicographically
+         * ordered if treated as signed-magnitude integers.
+         * Since Java's integers are two's complement,
+         * incrementing the two's complement representation of a
+         * logically negative floating-point value *decrements*
+         * the signed-magnitude representation. Therefore, when
+         * the integer representation of a floating-point value
+         * is negative, the adjustment to the representation is in
+         * the opposite direction from what would initially be expected.
+         */
+
+        // Branch to descending case first as it is more costly than ascending
+        // case due to start != 0.0f conditional.
+        if (start > direction) { // descending
+            if (start != 0.0f) {
+                final int transducer = Float.floatToRawIntBits(start);
+                return Float.intBitsToFloat(transducer + ((transducer > 0) ? -1 : 1));
+            } else { // start == 0.0f && direction < 0.0f
+                return -Float.MIN_VALUE;
+            }
+        } else if (start < direction) { // ascending
             // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0)
             // then bitwise convert start to integer.
-            int transducer = Float.floatToRawIntBits(start + 0.0f);
-
-            /*
-             * IEEE 754 floating-point numbers are lexicographically
-             * ordered if treated as signed- magnitude integers .
-             * Since Java's integers are two's complement,
-             * incrementing" the two's complement representation of a
-             * logically negative floating-point value *decrements*
-             * the signed-magnitude representation. Therefore, when
-             * the integer representation of a floating-point values
-             * is less than zero, the adjustment to the representation
-             * is in the opposite direction than would be expected at
-             * first.
-             */
-            if (direction > start) {// Calculate next greater value
-                transducer = transducer + (transducer >= 0 ? 1:-1);
-            } else  { // Calculate next lesser value
-                assert direction < start;
-                if (transducer > 0)
-                    --transducer;
-                else
-                    if (transducer < 0 )
-                        ++transducer;
-                    /*
-                     * transducer==0, the result is -MIN_VALUE
-                     *
-                     * The transition from zero (implicitly
-                     * positive) to the smallest negative
-                     * signed magnitude value must be done
-                     * explicitly.
-                     */
-                    else
-                        transducer = FloatConsts.SIGN_BIT_MASK | 1;
-            }
-
-            return Float.intBitsToFloat(transducer);
+            final int transducer = Float.floatToRawIntBits(start + 0.0f);
+            return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
+        } else if (start == direction) {
+            return (float)direction;
+        } else { // isNaN(start) || isNaN(direction)
+            return start + (float)direction;
         }
     }
 
@@ -2077,12 +2047,13 @@
      * @since 1.6
      */
     public static double nextUp(double d) {
-        if( Double.isNaN(d) || d == Double.POSITIVE_INFINITY)
+        // Use a single conditional and handle the likely cases first.
+        if (d < Double.POSITIVE_INFINITY) {
+            // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
+            final long transducer = Double.doubleToRawLongBits(d + 0.0D);
+            return Double.longBitsToDouble(transducer + ((transducer >= 0L) ? 1L : -1L));
+        } else { // d is NaN or +Infinity
             return d;
-        else {
-            d += 0.0d;
-            return Double.longBitsToDouble(Double.doubleToRawLongBits(d) +
-                                           ((d >= 0.0d)?+1L:-1L));
         }
     }
 
@@ -2112,12 +2083,13 @@
      * @since 1.6
      */
     public static float nextUp(float f) {
-        if( Float.isNaN(f) || f == FloatConsts.POSITIVE_INFINITY)
+        // Use a single conditional and handle the likely cases first.
+        if (f < Float.POSITIVE_INFINITY) {
+            // Add +0.0 to get rid of a -0.0 (+0.0 + -0.0 => +0.0).
+            final int transducer = Float.floatToRawIntBits(f + 0.0F);
+            return Float.intBitsToFloat(transducer + ((transducer >= 0) ? 1 : -1));
+        } else { // f is NaN or +Infinity
             return f;
-        else {
-            f += 0.0f;
-            return Float.intBitsToFloat(Float.floatToRawIntBits(f) +
-                                        ((f >= 0.0f)?+1:-1));
         }
     }
 
--- a/jdk/src/share/classes/java/nio/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/nio/package.html	Mon May 05 12:49:13 2014 -0700
@@ -121,7 +121,7 @@
   available.  </p></li>
 
   <li><p> A byte buffer provides access to its content as either a heterogeneous
-  or homogeneous sequence of <a href="ByteBuffer.html#bin">binary data</i></a>
+  or homogeneous sequence of <a href="ByteBuffer.html#bin"><i>binary data</i></a>
   of any non-boolean primitive type, in either big-endian or little-endian <a
   href="ByteOrder.html">byte order</a>.  </p></li>
 
--- a/jdk/src/share/classes/java/sql/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/sql/package.html	Mon May 05 12:49:13 2014 -0700
@@ -323,10 +323,10 @@
 
 <ul>
   <li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/index.html">
-          Lesson:JDBC Basics(The Javaxx Tutorials &gt; JDBC(&#0153;) Database Access)</a>
+          Lesson:JDBC Basics(The Javaxx Tutorials &gt; JDBC&trade; Database Access)</a>
 
  <li><a href="http://www.oracle.com/technetwork/java/index-142838.html">
-          <i>JDBC&#0153;API Tutorial and Reference, Third Edition</i></a>
+          <i>JDBC&trade; API Tutorial and Reference, Third Edition</i></a>
 </ul>
 
 </body>
--- a/jdk/src/share/classes/java/time/DayOfWeek.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/DayOfWeek.java	Mon May 05 12:49:13 2014 -0700
@@ -201,7 +201,7 @@
      * Gets the day-of-week {@code int} value.
      * <p>
      * The values are numbered following the ISO-8601 standard, from 1 (Monday) to 7 (Sunday).
-     * See {@link WeekFields#dayOfWeek} for localized week-numbering.
+     * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week-numbering.
      *
      * @return the day-of-week, from 1 (Monday) to 7 (Sunday)
      */
@@ -288,7 +288,7 @@
     /**
      * Gets the value of the specified field from this day-of-week as an {@code int}.
      * <p>
-     * This queries this day-of-week for the value for the specified field.
+     * This queries this day-of-week for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -321,7 +321,7 @@
     /**
      * Gets the value of the specified field from this day-of-week as a {@code long}.
      * <p>
-     * This queries this day-of-week for the value for the specified field.
+     * This queries this day-of-week for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -419,7 +419,7 @@
      * The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}
      * passing {@link ChronoField#DAY_OF_WEEK} as the field.
      * Note that this adjusts forwards or backwards within a Monday to Sunday week.
-     * See {@link WeekFields#dayOfWeek} for localized week start days.
+     * See {@link java.time.temporal.WeekFields#dayOfWeek()} for localized week start days.
      * See {@code TemporalAdjuster} for other adjusters with more control,
      * such as {@code next(MONDAY)}.
      * <p>
--- a/jdk/src/share/classes/java/time/Duration.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/Duration.java	Mon May 05 12:49:13 2014 -0700
@@ -546,7 +546,7 @@
      * They are returned in the order seconds, nanos.
      * <p>
      * This set can be used in conjunction with {@link #get(TemporalUnit)}
-     * to access the entire state of the period.
+     * to access the entire state of the duration.
      *
      * @return a list containing the seconds and nanos units, not null
      */
@@ -686,8 +686,8 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToAdd  the amount of the period, measured in terms of the unit, positive or negative
-     * @param unit  the unit that the period is measured in, must have an exact duration, not null
+     * @param amountToAdd  the amount to add, measured in terms of the unit, positive or negative
+     * @param unit  the unit that the amount is measured in, must have an exact duration, not null
      * @return a {@code Duration} based on this duration with the specified duration added, not null
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
@@ -848,8 +848,8 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToSubtract  the amount of the period, measured in terms of the unit, positive or negative
-     * @param unit  the unit that the period is measured in, must have an exact duration, not null
+     * @param amountToSubtract  the amount to subtract, measured in terms of the unit, positive or negative
+     * @param unit  the unit that the amount is measured in, must have an exact duration, not null
      * @return a {@code Duration} based on this duration with the specified duration subtracted, not null
      * @throws ArithmeticException if numeric overflow occurs
      */
--- a/jdk/src/share/classes/java/time/Instant.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/Instant.java	Mon May 05 12:49:13 2014 -0700
@@ -530,7 +530,7 @@
     /**
      * Gets the value of the specified field from this instant as an {@code int}.
      * <p>
-     * This queries this instant for the value for the specified field.
+     * This queries this instant for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -571,7 +571,7 @@
     /**
      * Gets the value of the specified field from this instant as a {@code long}.
      * <p>
-     * This queries this instant for the value for the specified field.
+     * This queries this instant for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/LocalDate.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Mon May 05 12:49:13 2014 -0700
@@ -280,7 +280,7 @@
      * @param dayOfYear  the day-of-year to represent, from 1 to 366
      * @return the local date, not null
      * @throws DateTimeException if the value of any field is out of range,
-     *  or if the day-of-year is invalid for the month-year
+     *  or if the day-of-year is invalid for the year
      */
     public static LocalDate ofYearDay(int year, int dayOfYear) {
         YEAR.checkValidValue(year);
@@ -308,7 +308,7 @@
      *
      * @param epochDay  the Epoch Day to convert, based on the epoch 1970-01-01
      * @return the local date, not null
-     * @throws DateTimeException if the epoch days exceeds the supported date range
+     * @throws DateTimeException if the epoch day exceeds the supported date range
      */
     public static LocalDate ofEpochDay(long epochDay) {
         long zeroDay = epochDay + DAYS_0000_TO_1970;
@@ -515,7 +515,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this date.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -592,7 +592,7 @@
     /**
      * Gets the value of the specified field from this date as an {@code int}.
      * <p>
-     * This queries this date for the value for the specified field.
+     * This queries this date for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -600,7 +600,7 @@
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date, except {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH}
-     * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * which are too large to fit in an {@code int} and throw an {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -627,7 +627,7 @@
     /**
      * Gets the value of the specified field from this date as a {@code long}.
      * <p>
-     * This queries this date for the value for the specified field.
+     * This queries this date for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -875,7 +875,9 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * <p>
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -885,7 +887,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = localDate.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -1041,7 +1043,8 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this date with the year altered.
+     * Returns a copy of this {@code LocalDate} with the year altered.
+     * <p>
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1059,7 +1062,8 @@
     }
 
     /**
-     * Returns a copy of this date with the month-of-year altered.
+     * Returns a copy of this {@code LocalDate} with the month-of-year altered.
+     * <p>
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1077,7 +1081,8 @@
     }
 
     /**
-     * Returns a copy of this date with the day-of-month altered.
+     * Returns a copy of this {@code LocalDate} with the day-of-month altered.
+     * <p>
      * If the resulting date is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1095,7 +1100,8 @@
     }
 
     /**
-     * Returns a copy of this date with the day-of-year altered.
+     * Returns a copy of this {@code LocalDate} with the day-of-year altered.
+     * <p>
      * If the resulting date is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1245,7 +1251,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in years added.
+     * Returns a copy of this {@code LocalDate} with the specified number of years added.
      * <p>
      * This method adds the specified amount to the years field in three steps:
      * <ol>
@@ -1273,7 +1279,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in months added.
+     * Returns a copy of this {@code LocalDate} with the specified number of months added.
      * <p>
      * This method adds the specified amount to the months field in three steps:
      * <ol>
@@ -1304,7 +1310,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in weeks added.
+     * Returns a copy of this {@code LocalDate} with the specified number of weeks added.
      * <p>
      * This method adds the specified amount in weeks to the days field incrementing
      * the month and year fields as necessary to ensure the result remains valid.
@@ -1402,11 +1408,11 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in years subtracted.
+     * Returns a copy of this {@code LocalDate} with the specified number of years subtracted.
      * <p>
      * This method subtracts the specified amount from the years field in three steps:
      * <ol>
-     * <li>Subtract the input years to the year field</li>
+     * <li>Subtract the input years from the year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1426,11 +1432,11 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in months subtracted.
+     * Returns a copy of this {@code LocalDate} with the specified number of months subtracted.
      * <p>
      * This method subtracts the specified amount from the months field in three steps:
      * <ol>
-     * <li>Subtract the input months to the month-of-year field</li>
+     * <li>Subtract the input months from the month-of-year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1450,7 +1456,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDate} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code LocalDate} with the specified number of weeks subtracted.
      * <p>
      * This method subtracts the specified amount in weeks from the days field decrementing
      * the month and year fields as necessary to ensure the result remains valid.
--- a/jdk/src/share/classes/java/time/LocalDateTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Mon May 05 12:49:13 2014 -0700
@@ -428,7 +428,7 @@
     /**
      * Obtains an instance of {@code LocalDateTime} from a temporal object.
      * <p>
-     * This obtains an offset time based on the specified temporal.
+     * This obtains a local date-time based on the specified temporal.
      * A {@code TemporalAccessor} represents an arbitrary set of date and time information,
      * which this factory converts to an instance of {@code LocalDateTime}.
      * <p>
@@ -656,7 +656,7 @@
     /**
      * Gets the value of the specified field from this date-time as an {@code int}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -665,7 +665,7 @@
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
      * {@code EPOCH_DAY} and {@code PROLEPTIC_MONTH} which are too large to fit in
-     * an {@code int} and throw a {@code DateTimeException}.
+     * an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -693,7 +693,7 @@
     /**
      * Gets the value of the specified field from this date-time as a {@code long}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -878,7 +878,9 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * <p>
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -888,7 +890,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = localDateTime.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -974,6 +976,7 @@
     //-----------------------------------------------------------------------
     /**
      * Returns a copy of this {@code LocalDateTime} with the year altered.
+     * <p>
      * The time does not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
@@ -989,6 +992,7 @@
 
     /**
      * Returns a copy of this {@code LocalDateTime} with the month-of-year altered.
+     * <p>
      * The time does not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
@@ -1004,7 +1008,8 @@
 
     /**
      * Returns a copy of this {@code LocalDateTime} with the day-of-month altered.
-     * If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
+     * <p>
+     * If the resulting date-time is invalid, an exception is thrown.
      * The time does not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1020,7 +1025,8 @@
 
     /**
      * Returns a copy of this {@code LocalDateTime} with the day-of-year altered.
-     * If the resulting {@code LocalDateTime} is invalid, an exception is thrown.
+     * <p>
+     * If the resulting date-time is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1035,7 +1041,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code LocalDateTime} with the hour-of-day altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1049,7 +1055,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code LocalDateTime} with the minute-of-hour altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1063,7 +1069,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code LocalDateTime} with the second-of-minute altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1077,7 +1083,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code LocalDateTime} with the nano-of-second altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1109,7 +1115,7 @@
      * @param unit  the unit to truncate to, not null
      * @return a {@code LocalDateTime} based on this date-time with the time truncated, not null
      * @throws DateTimeException if unable to truncate
-     * @throws UnsupportedTemporalTypeException if the field is not supported
+     * @throws UnsupportedTemporalTypeException if the unit is not supported
      */
     public LocalDateTime truncatedTo(TemporalUnit unit) {
         return with(date, time.truncatedTo(unit));
@@ -1192,7 +1198,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in years added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of years added.
      * <p>
      * This method adds the specified amount to the years field in three steps:
      * <ol>
@@ -1217,7 +1223,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in months added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of months added.
      * <p>
      * This method adds the specified amount to the months field in three steps:
      * <ol>
@@ -1242,7 +1248,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in weeks added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of weeks added.
      * <p>
      * This method adds the specified amount in weeks to the days field incrementing
      * the month and year fields as necessary to ensure the result remains valid.
@@ -1262,7 +1268,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in days added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of days added.
      * <p>
      * This method adds the specified amount to the days field incrementing the
      * month and year fields as necessary to ensure the result remains valid.
@@ -1283,7 +1289,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in hours added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of hours added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1296,7 +1302,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in minutes added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of minutes added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1309,7 +1315,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in seconds added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of seconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1322,7 +1328,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1391,7 +1397,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in years subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of years subtracted.
      * <p>
      * This method subtracts the specified amount from the years field in three steps:
      * <ol>
@@ -1415,7 +1421,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in months subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of months subtracted.
      * <p>
      * This method subtracts the specified amount from the months field in three steps:
      * <ol>
@@ -1439,7 +1445,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of weeks subtracted.
      * <p>
      * This method subtracts the specified amount in weeks from the days field decrementing
      * the month and year fields as necessary to ensure the result remains valid.
@@ -1458,9 +1464,9 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in days subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of days subtracted.
      * <p>
-     * This method subtracts the specified amount from the days field incrementing the
+     * This method subtracts the specified amount from the days field decrementing the
      * month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
@@ -1478,7 +1484,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of hours subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1491,7 +1497,7 @@
    }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of minutes subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1504,7 +1510,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of seconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1517,7 +1523,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalDateTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code LocalDateTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1575,7 +1581,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/LocalTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/LocalTime.java	Mon May 05 12:49:13 2014 -0700
@@ -93,7 +93,7 @@
 import java.util.Objects;
 
 /**
- * A time without time-zone in the ISO-8601 calendar system,
+ * A time without a time-zone in the ISO-8601 calendar system,
  * such as {@code 10:15:30}.
  * <p>
  * {@code LocalTime} is an immutable date-time object that represents a time,
@@ -101,7 +101,7 @@
  * Time is represented to nanosecond precision.
  * For example, the value "13:45.30.123456789" can be stored in a {@code LocalTime}.
  * <p>
- * It does not store or represent a date or time-zone.
+ * This class does not store or represent a date or time-zone.
  * Instead, it is a description of the local time as seen on a wall clock.
  * It cannot represent an instant on the time-line without additional information
  * such as an offset or time-zone.
@@ -280,7 +280,7 @@
         return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano());
     }
 
-    //------------------------get-----------------------------------------------
+    //-----------------------------------------------------------------------
     /**
      * Obtains an instance of {@code LocalTime} from an hour and minute.
      * <p>
@@ -395,7 +395,7 @@
      * on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code LocalTime::from}.
+     * allowing it to be used as a query via method reference, {@code LocalTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the local time, not null
@@ -418,7 +418,7 @@
      * The string must represent a valid time and is parsed using
      * {@link java.time.format.DateTimeFormatter#ISO_LOCAL_TIME}.
      *
-     * @param text the text to parse such as "10:15:30", not null
+     * @param text  the text to parse such as "10:15:30", not null
      * @return the parsed local time, not null
      * @throws DateTimeParseException if the text cannot be parsed
      */
@@ -524,7 +524,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this time.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -589,7 +589,7 @@
     /**
      * Gets the value of the specified field from this time as an {@code int}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -597,7 +597,7 @@
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
-     * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -624,7 +624,7 @@
     /**
      * Gets the value of the specified field from this time as a {@code long}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -858,7 +858,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code LocalTime} with the hour-of-day altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -875,7 +875,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code LocalTime} with the minute-of-hour altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -892,7 +892,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code LocalTime} with the second-of-minute altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -909,7 +909,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code LocalTime} with the nano-of-second altered.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -929,7 +929,7 @@
     /**
      * Returns a copy of this {@code LocalTime} with the time truncated.
      * <p>
-     * Truncating the time returns a copy of the original time with fields
+     * Truncation returns a copy of the original time with fields
      * smaller than the specified unit set to zero.
      * For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit
      * will set the second-of-minute and nano-of-second field to zero.
@@ -1059,7 +1059,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in hours added.
+     * Returns a copy of this {@code LocalTime} with the specified number of hours added.
      * <p>
      * This adds the specified number of hours to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1078,7 +1078,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in minutes added.
+     * Returns a copy of this {@code LocalTime} with the specified number of minutes added.
      * <p>
      * This adds the specified number of minutes to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1103,7 +1103,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in seconds added.
+     * Returns a copy of this {@code LocalTime} with the specified number of seconds added.
      * <p>
      * This adds the specified number of seconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1130,7 +1130,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds added.
      * <p>
      * This adds the specified number of nanoseconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1208,7 +1208,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of hours subtracted.
      * <p>
      * This subtracts the specified number of hours from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1223,7 +1223,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of minutes subtracted.
      * <p>
      * This subtracts the specified number of minutes from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1238,7 +1238,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of seconds subtracted.
      * <p>
      * This subtracts the specified number of seconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1253,7 +1253,7 @@
     }
 
     /**
-     * Returns a copy of this {@code LocalTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code LocalTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This subtracts the specified number of nanoseconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1470,14 +1470,13 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Compares this {@code LocalTime} to another time.
+     * Compares this time to another time.
      * <p>
      * The comparison is based on the time-line position of the local times within a day.
      * It is "consistent with equals", as defined by {@link Comparable}.
      *
      * @param other  the other time to compare to, not null
      * @return the comparator value, negative if less, positive if greater
-     * @throws NullPointerException if {@code other} is null
      */
     @Override
     public int compareTo(LocalTime other) {
@@ -1495,26 +1494,24 @@
     }
 
     /**
-     * Checks if this {@code LocalTime} is after the specified time.
+     * Checks if this time is after the specified time.
      * <p>
      * The comparison is based on the time-line position of the time within a day.
      *
      * @param other  the other time to compare to, not null
      * @return true if this is after the specified time
-     * @throws NullPointerException if {@code other} is null
      */
     public boolean isAfter(LocalTime other) {
         return compareTo(other) > 0;
     }
 
     /**
-     * Checks if this {@code LocalTime} is before the specified time.
+     * Checks if this time is before the specified time.
      * <p>
      * The comparison is based on the time-line position of the time within a day.
      *
      * @param other  the other time to compare to, not null
      * @return true if this point is before the specified time
-     * @throws NullPointerException if {@code other} is null
      */
     public boolean isBefore(LocalTime other) {
         return compareTo(other) < 0;
--- a/jdk/src/share/classes/java/time/Month.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/Month.java	Mon May 05 12:49:13 2014 -0700
@@ -202,7 +202,7 @@
      * 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 Month::from}.
+     * allowing it to be used as a query via method reference, {@code Month::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the month-of-year, not null
@@ -315,7 +315,7 @@
     /**
      * Gets the value of the specified field from this month-of-year as an {@code int}.
      * <p>
-     * This queries this month for the value for the specified field.
+     * This queries this month for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -348,7 +348,7 @@
     /**
      * Gets the value of the specified field from this month-of-year as a {@code long}.
      * <p>
-     * This queries this month for the value for the specified field.
+     * This queries this month for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/MonthDay.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/MonthDay.java	Mon May 05 12:49:13 2014 -0700
@@ -90,8 +90,8 @@
  * A month-day in the ISO-8601 calendar system, such as {@code --12-03}.
  * <p>
  * {@code MonthDay} is an immutable date-time object that represents the combination
- * of a year and month. Any field that can be derived from a month and day, such as
- * quarter-of-year, can be obtained.
+ * of a month and day-of-month. Any field that can be derived from a month and day,
+ * such as quarter-of-year, can be obtained.
  * <p>
  * This class does not store or represent a year, time or time-zone.
  * For example, the value "December 3rd" can be stored in a {@code MonthDay}.
@@ -154,7 +154,7 @@
     /**
      * Obtains the current month-day from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current month-day.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -169,7 +169,7 @@
     /**
      * Obtains the current month-day from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current month-day.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current month-day.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -258,7 +258,7 @@
      * 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}.
+     * allowing it to be used as a query via method reference, {@code MonthDay::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the month-day, not null
@@ -389,7 +389,7 @@
     /**
      * Gets the value of the specified field from this month-day as an {@code int}.
      * <p>
-     * This queries this month-day for the value for the specified field.
+     * This queries this month-day for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -420,7 +420,7 @@
     /**
      * Gets the value of the specified field from this month-day as a {@code long}.
      * <p>
-     * This queries this month-day for the value for the specified field.
+     * This queries this month-day for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -501,7 +501,7 @@
      * This method checks whether this month and day and the input year form
      * a valid date. This can only return false for February 29th.
      *
-     * @param year  the year to validate, an out of range value returns false
+     * @param year  the year to validate
      * @return true if the year is valid for this month-day
      * @see Year#isValidMonthDay(MonthDay)
      */
@@ -685,7 +685,7 @@
     }
 
     /**
-     * Is this month-day after the specified month-day.
+     * Checks if this month-day is after the specified month-day.
      *
      * @param other  the other month-day to compare to, not null
      * @return true if this is after the specified month-day
@@ -695,7 +695,7 @@
     }
 
     /**
-     * Is this month-day before the specified month-day.
+     * Checks if this month-day is before the specified month-day.
      *
      * @param other  the other month-day to compare to, not null
      * @return true if this point is before the specified month-day
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Mon May 05 12:49:13 2014 -0700
@@ -199,7 +199,7 @@
     /**
      * Obtains the current date-time from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current date-time.
      * The offset will be calculated from the time-zone in the clock.
      * <p>
@@ -215,7 +215,7 @@
     /**
      * Obtains the current date-time from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current date-time.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current date-time.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * The offset will be calculated from the specified time-zone.
      * <p>
@@ -345,7 +345,7 @@
      * those fields that are equivalent to the relevant objects.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code OffsetDateTime::from}.
+     * allowing it to be used as a query via method reference, {@code OffsetDateTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the offset date-time, not null
@@ -566,7 +566,7 @@
     /**
      * Gets the value of the specified field from this date-time as an {@code int}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -575,7 +575,7 @@
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
      * {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
-     * large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -608,7 +608,7 @@
     /**
      * Gets the value of the specified field from this date-time as a {@code long}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -703,7 +703,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Gets the {@code LocalDateTime} part of this offset date-time.
+     * Gets the {@code LocalDateTime} part of this date-time.
      * <p>
      * This returns a {@code LocalDateTime} with the same year, month, day and time
      * as this date-time.
@@ -795,10 +795,10 @@
     /**
      * Gets the day-of-week field, which is an enum {@code DayOfWeek}.
      * <p>
-     * This method returns the enum {@link java.time.DayOfWeek} for the day-of-week.
+     * This method returns the enum {@link DayOfWeek} for the day-of-week.
      * This avoids confusion as to what {@code int} values mean.
      * If you need access to the primitive {@code int} value then the enum
-     * provides the {@link java.time.DayOfWeek#getValue() int value}.
+     * provides the {@link DayOfWeek#getValue() int value}.
      * <p>
      * Additional information can be obtained from the {@code DayOfWeek}.
      * This includes textual names of the values.
@@ -868,7 +868,8 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -878,7 +879,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = offsetDateTime.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -920,7 +921,7 @@
     /**
      * Returns a copy of this date-time with the specified field set to a new value.
      * <p>
-     * TThis returns an {@code OffsetDateTime}, based on this one, with the value
+     * This returns an {@code OffsetDateTime}, based on this one, with the value
      * for the specified field changed.
      * This can be used to change any supported field, such as the year, month or day-of-month.
      * If it is not possible to set the value, because the field is not supported or for
@@ -979,7 +980,8 @@
     //-----------------------------------------------------------------------
     /**
      * Returns a copy of this {@code OffsetDateTime} with the year altered.
-     * The offset does not affect the calculation and will be the same in the result.
+     * <p>
+     * The time and offset do not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -994,7 +996,8 @@
 
     /**
      * Returns a copy of this {@code OffsetDateTime} with the month-of-year altered.
-     * The offset does not affect the calculation and will be the same in the result.
+     * <p>
+     * The time and offset do not affect the calculation and will be the same in the result.
      * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1009,8 +1012,9 @@
 
     /**
      * Returns a copy of this {@code OffsetDateTime} with the day-of-month altered.
+     * <p>
      * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
-     * The offset does not affect the calculation and will be the same in the result.
+     * The time and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1025,6 +1029,8 @@
 
     /**
      * Returns a copy of this {@code OffsetDateTime} with the day-of-year altered.
+     * <p>
+     * The time and offset do not affect the calculation and will be the same in the result.
      * If the resulting {@code OffsetDateTime} is invalid, an exception is thrown.
      * <p>
      * This instance is immutable and unaffected by this method call.
@@ -1040,9 +1046,9 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the hour-of-day altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1055,9 +1061,9 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the minute-of-hour altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1070,9 +1076,9 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the second-of-minute altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1085,15 +1091,15 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code OffsetDateTime} with the nano-of-second altered.
      * <p>
-     * The offset does not affect the calculation and will be the same in the result.
+     * The date and offset do not affect the calculation and will be the same in the result.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param nanoOfSecond  the nano-of-second to set in the result, from 0 to 999,999,999
      * @return an {@code OffsetDateTime} based on this date-time with the requested nanosecond, not null
-     * @throws DateTimeException if the nanos value is invalid
+     * @throws DateTimeException if the nano value is invalid
      */
     public OffsetDateTime withNano(int nanoOfSecond) {
         return with(dateTime.withNano(nanoOfSecond), offset);
@@ -1187,7 +1193,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in years added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of years added.
      * <p>
      * This method adds the specified amount to the years field in three steps:
      * <ol>
@@ -1211,7 +1217,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in months added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of months added.
      * <p>
      * This method adds the specified amount to the months field in three steps:
      * <ol>
@@ -1235,13 +1241,13 @@
     }
 
     /**
-     * Returns a copy of this OffsetDateTime with the specified period in weeks added.
+     * Returns a copy of this OffsetDateTime with the specified number of weeks added.
      * <p>
      * This method adds the specified amount in weeks to the days field incrementing
      * the month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 plus one week would result in the 2009-01-07.
+     * For example, 2008-12-31 plus one week would result in 2009-01-07.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1254,13 +1260,13 @@
     }
 
     /**
-     * Returns a copy of this OffsetDateTime with the specified period in days added.
+     * Returns a copy of this OffsetDateTime with the specified number of days added.
      * <p>
      * This method adds the specified amount to the days field incrementing the
      * month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 plus one day would result in the 2009-01-01.
+     * For example, 2008-12-31 plus one day would result in 2009-01-01.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1273,7 +1279,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in hours added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of hours added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1286,7 +1292,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1299,7 +1305,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1312,7 +1318,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1376,11 +1382,11 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in years subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of years subtracted.
      * <p>
      * This method subtracts the specified amount from the years field in three steps:
      * <ol>
-     * <li>Subtract the input years to the year field</li>
+     * <li>Subtract the input years from the year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1400,11 +1406,11 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in months subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of months subtracted.
      * <p>
      * This method subtracts the specified amount from the months field in three steps:
      * <ol>
-     * <li>Subtract the input months to the month-of-year field</li>
+     * <li>Subtract the input months from the month-of-year field</li>
      * <li>Check if the resulting date would be invalid</li>
      * <li>Adjust the day-of-month to the last valid day if necessary</li>
      * </ol>
@@ -1424,13 +1430,13 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of weeks subtracted.
      * <p>
      * This method subtracts the specified amount in weeks from the days field decrementing
      * the month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 minus one week would result in the 2009-01-07.
+     * For example, 2008-12-31 minus one week would result in 2009-01-07.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1443,13 +1449,13 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in days subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of days subtracted.
      * <p>
-     * This method subtracts the specified amount from the days field incrementing the
+     * This method subtracts the specified amount from the days field decrementing the
      * month and year fields as necessary to ensure the result remains valid.
      * The result is only invalid if the maximum/minimum year is exceeded.
      * <p>
-     * For example, 2008-12-31 minus one day would result in the 2009-01-01.
+     * For example, 2008-12-31 minus one day would result in 2009-01-01.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1462,7 +1468,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of hours subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1475,7 +1481,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of minutes subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1488,7 +1494,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of seconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1501,7 +1507,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetDateTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code OffsetDateTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1598,7 +1604,7 @@
      * 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.
-     * For example, the period in days between two date-times can be calculated
+     * For example, the amount in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The {@code Temporal} passed to this method is converted to a
@@ -1608,7 +1614,7 @@
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two date-times.
-     * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
+     * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
      * will only be one month as it is one minute short of two months.
      * <p>
      * There are two equivalent ways of using this method.
@@ -1769,7 +1775,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Compares this {@code OffsetDateTime} to another date-time.
+     * Compares this date-time to another date-time.
      * <p>
      * The comparison is based on the instant then on the local date-time.
      * It is "consistent with equals", as defined by {@link Comparable}.
--- a/jdk/src/share/classes/java/time/OffsetTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Mon May 05 12:49:13 2014 -0700
@@ -153,14 +153,14 @@
     /**
      * Obtains the current time from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current time.
      * The offset will be calculated from the time-zone in the clock.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
      * because the clock is hard-coded.
      *
-     * @return the current time using the system clock, not null
+     * @return the current time using the system clock and default time-zone, not null
      */
     public static OffsetTime now() {
         return now(Clock.systemDefaultZone());
@@ -169,7 +169,7 @@
     /**
      * Obtains the current time from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current time.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * The offset will be calculated from the specified time-zone.
      * <p>
@@ -277,7 +277,7 @@
      * those fields that are equivalent to the relevant objects.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code OffsetTime::from}.
+     * allowing it to be used as a query via method reference, {@code OffsetTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the offset time, not null
@@ -402,7 +402,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this offset-time.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -473,7 +473,7 @@
     /**
      * Gets the value of the specified field from this time as an {@code int}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -481,7 +481,7 @@
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}
-     * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * which are too large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -505,7 +505,7 @@
     /**
      * Gets the value of the specified field from this time as a {@code long}.
      * <p>
-     * This queries this time for the value for the specified field.
+     * This queries this time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -575,7 +575,7 @@
      * <p>
      * This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime}
      * adjusted by the difference between the two offsets.
-     * This will result in the old and new objects representing the same instant an an implied day.
+     * This will result in the old and new objects representing the same instant on an implied day.
      * This is useful for finding the local time in a different offset.
      * For example, if this time represents {@code 10:30+02:00} and the offset specified is
      * {@code +03:00}, then this method will return {@code 11:30+03:00}.
@@ -737,7 +737,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code OffsetTime} with the hour-of-day altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -752,7 +752,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code OffsetTime} with the minute-of-hour altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -767,7 +767,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code OffsetTime} with the second-of-minute altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -782,7 +782,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code OffsetTime} with the nano-of-second altered.
      * <p>
      * The offset does not affect the calculation and will be the same in the result.
      * <p>
@@ -884,7 +884,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in hours added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of hours added.
      * <p>
      * This adds the specified number of hours to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -899,7 +899,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in minutes added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of minutes added.
      * <p>
      * This adds the specified number of minutes to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -914,7 +914,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in seconds added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of seconds added.
      * <p>
      * This adds the specified number of seconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -929,7 +929,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added.
      * <p>
      * This adds the specified number of nanoseconds to this time, returning a new time.
      * The calculation wraps around midnight.
@@ -995,7 +995,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted.
      * <p>
      * This subtracts the specified number of hours from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1010,7 +1010,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted.
      * <p>
      * This subtracts the specified number of minutes from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1025,7 +1025,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted.
      * <p>
      * This subtracts the specified number of seconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1040,7 +1040,7 @@
     }
 
     /**
-     * Returns a copy of this {@code OffsetTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This subtracts the specified number of nanoseconds from this time, returning a new time.
      * The calculation wraps around midnight.
@@ -1130,7 +1130,7 @@
      * 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.
-     * For example, the period in hours between two times can be calculated
+     * For example, the amount in hours between two times can be calculated
      * using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The {@code Temporal} passed to this method is converted to a
@@ -1140,7 +1140,7 @@
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two times.
-     * For example, the period in hours between 11:30Z and 13:29Z will only
+     * For example, the amount in hours between 11:30Z and 13:29Z will only
      * be one hour as it is one minute short of two hours.
      * <p>
      * There are two equivalent ways of using this method.
@@ -1165,7 +1165,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param endExclusive  the end date, exclusive, which is converted to an {@code OffsetTime}, not null
+     * @param endExclusive  the end time, 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, or the end
@@ -1258,7 +1258,6 @@
      *
      * @param other  the other time to compare to, not null
      * @return the comparator value, negative if less, positive if greater
-     * @throws NullPointerException if {@code other} is null
      */
     @Override
     public int compareTo(OffsetTime other) {
--- a/jdk/src/share/classes/java/time/Period.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/Period.java	Mon May 05 12:49:13 2014 -0700
@@ -616,7 +616,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToAdd  the period to add, not null
+     * @param amountToAdd  the amount 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
@@ -705,7 +705,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @param amountToSubtract  the period to subtract, not null
+     * @param amountToSubtract  the amount 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
--- a/jdk/src/share/classes/java/time/Year.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/Year.java	Mon May 05 12:49:13 2014 -0700
@@ -164,7 +164,7 @@
     /**
      * Obtains the current year from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current year.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -179,7 +179,7 @@
     /**
      * Obtains the current year from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -240,7 +240,7 @@
      * 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 Year::from}.
+     * allowing it to be used as a query via method reference, {@code Year::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the year, not null
@@ -375,7 +375,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this year.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -441,7 +441,7 @@
     /**
      * Gets the value of the specified field from this year as an {@code int}.
      * <p>
-     * This queries this year for the value for the specified field.
+     * This queries this year for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -472,7 +472,7 @@
     /**
      * Gets the value of the specified field from this year as a {@code long}.
      * <p>
-     * This queries this year for the value for the specified field.
+     * This queries this year for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -720,13 +720,13 @@
     }
 
     /**
-     * Returns a copy of this year with the specified number of years added.
+     * Returns a copy of this {@code Year} with the specified number of years added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param yearsToAdd  the years to add, may be negative
-     * @return a {@code Year} based on this year with the period added, not null
-     * @throws DateTimeException if the result exceeds the supported year range
+     * @return a {@code Year} based on this year with the years added, not null
+     * @throws DateTimeException if the result exceeds the supported range
      */
     public Year plusYears(long yearsToAdd) {
         if (yearsToAdd == 0) {
@@ -786,13 +786,13 @@
     }
 
     /**
-     * Returns a copy of this year with the specified number of years subtracted.
+     * Returns a copy of this {@code Year} with the specified number of years subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
      * @param yearsToSubtract  the years to subtract, may be negative
-     * @return a {@code Year} based on this year with the period subtracted, not null
-     * @throws DateTimeException if the result exceeds the supported year range
+     * @return a {@code Year} based on this year with the year subtracted, not null
+     * @throws DateTimeException if the result exceeds the supported range
      */
     public Year minusYears(long yearsToSubtract) {
         return (yearsToSubtract == Long.MIN_VALUE ? plusYears(Long.MAX_VALUE).plusYears(1) : plusYears(-yearsToSubtract));
@@ -871,12 +871,12 @@
      * The result will be negative if the end is before the start.
      * 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
+     * For example, the amount in decades between two year can be calculated
      * using {@code startYear.until(endYear, DECADES)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two years.
-     * For example, the period in decades between 2012 and 2031
+     * For example, the amount in decades between 2012 and 2031
      * will only be one decade as it is one year short of two decades.
      * <p>
      * There are two equivalent ways of using this method.
@@ -948,7 +948,7 @@
      * <p>
      * The day-of-year value 366 is only valid in a leap year.
      *
-     * @param dayOfYear  the day-of-year to use, not null
+     * @param dayOfYear  the day-of-year to use, from 1 to 365-366
      * @return the local date formed from this year and the specified date of year, not null
      * @throws DateTimeException if the day of year is zero or less, 366 or greater or equal
      *  to 366 and this is not a leap year
@@ -1025,7 +1025,7 @@
     }
 
     /**
-     * Is this year after the specified year.
+     * Checks if this year is after the specified year.
      *
      * @param other  the other year to compare to, not null
      * @return true if this is after the specified year
@@ -1035,7 +1035,7 @@
     }
 
     /**
-     * Is this year before the specified year.
+     * Checks if this year is before the specified year.
      *
      * @param other  the other year to compare to, not null
      * @return true if this point is before the specified year
--- a/jdk/src/share/classes/java/time/YearMonth.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/YearMonth.java	Mon May 05 12:49:13 2014 -0700
@@ -157,9 +157,8 @@
     /**
      * Obtains the current year-month from the system clock in the default time-zone.
      * <p>
-     * This will query the {@link java.time.Clock#systemDefaultZone() system clock} in the default
+     * This will query the {@link Clock#systemDefaultZone() system clock} in the default
      * time-zone to obtain the current year-month.
-     * The zone and offset will be set based on the time-zone in the clock.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
      * because the clock is hard-coded.
@@ -173,7 +172,7 @@
     /**
      * Obtains the current year-month from the system clock in the specified time-zone.
      * <p>
-     * This will query the {@link Clock#system(java.time.ZoneId) system clock} to obtain the current year-month.
+     * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current year-month.
      * Specifying the time-zone avoids dependence on the default time-zone.
      * <p>
      * Using this method will prevent the ability to use an alternate clock for testing
@@ -243,7 +242,7 @@
      * 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 YearMonth::from}.
+     * allowing it to be used as a query via method reference, {@code YearMonth::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the year-month, not null
@@ -363,7 +362,7 @@
     /**
      * Checks if the specified unit is supported.
      * <p>
-     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * This checks if the specified unit can be added to, or subtracted from, this year-month.
      * If false, then calling the {@link #plus(long, TemporalUnit)} and
      * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
      * <p>
@@ -430,7 +429,7 @@
     /**
      * Gets the value of the specified field from this year-month as an {@code int}.
      * <p>
-     * This queries this year-month for the value for the specified field.
+     * This queries this year-month for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -462,7 +461,7 @@
     /**
      * Gets the value of the specified field from this year-month as a {@code long}.
      * <p>
-     * This queries this year-month for the value for the specified field.
+     * This queries this year-month for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -819,7 +818,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in years added.
+     * Returns a copy of this {@code YearMonth} with the specified number of years added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -836,7 +835,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in months added.
+     * Returns a copy of this {@code YearMonth} with the specified number of months added.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -906,7 +905,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in years subtracted.
+     * Returns a copy of this {@code YearMonth} with the specified number of years subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -919,7 +918,7 @@
     }
 
     /**
-     * Returns a copy of this year-month with the specified period in months subtracted.
+     * Returns a copy of this {@code YearMonth} with the specified number of months subtracted.
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
@@ -1004,12 +1003,12 @@
      * The result will be negative if the end is before the start.
      * 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
+     * For example, the amount in years between two year-months can be calculated
      * using {@code startYearMonth.until(endYearMonth, YEARS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two year-months.
-     * For example, the period in decades between 2012-06 and 2032-05
+     * For example, the amount in decades between 2012-06 and 2032-05
      * will only be one decade as it is one month short of two decades.
      * <p>
      * There are two equivalent ways of using this method.
@@ -1134,7 +1133,7 @@
     }
 
     /**
-     * Is this year-month after the specified year-month.
+     * Checks if this year-month is after the specified year-month.
      *
      * @param other  the other year-month to compare to, not null
      * @return true if this is after the specified year-month
@@ -1144,7 +1143,7 @@
     }
 
     /**
-     * Is this year-month before the specified year-month.
+     * Checks if this year-month is before the specified year-month.
      *
      * @param other  the other year-month to compare to, not null
      * @return true if this point is before the specified year-month
--- a/jdk/src/share/classes/java/time/ZoneId.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Mon May 05 12:49:13 2014 -0700
@@ -453,7 +453,7 @@
      * zones over offset-based zones using {@link TemporalQueries#zone()}.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code ZoneId::from}.
+     * allowing it to be used as a query via method reference, {@code ZoneId::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the zone ID, not null
--- a/jdk/src/share/classes/java/time/ZoneOffset.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java	Mon May 05 12:49:13 2014 -0700
@@ -89,7 +89,7 @@
 /**
  * A time-zone offset from Greenwich/UTC, such as {@code +02:00}.
  * <p>
- * A time-zone offset is the period of time that a time-zone differs from Greenwich/UTC.
+ * A time-zone offset is the amount of time that a time-zone differs from Greenwich/UTC.
  * This is usually a fixed number of hours and minutes.
  * <p>
  * Different parts of the world have different time-zone offsets.
@@ -334,7 +334,7 @@
      * on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code ZoneOffset::from}.
+     * allowing it to be used as a query via method reference, {@code ZoneOffset::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the zone-offset, not null
@@ -564,7 +564,7 @@
     /**
      * Gets the value of the specified field from this offset as an {@code int}.
      * <p>
-     * This queries this offset for the value for the specified field.
+     * This queries this offset for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -599,7 +599,7 @@
     /**
      * Gets the value of the specified field from this offset as a {@code long}.
      * <p>
-     * This queries this offset for the value for the specified field.
+     * This queries this offset for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java	Mon May 05 12:49:13 2014 -0700
@@ -418,7 +418,7 @@
      * <p>
      * Converting an instant to a zoned date-time is simple as there is only one valid
      * offset for each instant. If the valid offset is different to the offset specified,
-     * the the date-time and offset of the zoned date-time will differ from those specified.
+     * then the date-time and offset of the zoned date-time will differ from those specified.
      * <p>
      * If the {@code ZoneId} to be used is a {@code ZoneOffset}, this method is equivalent
      * to {@link #of(LocalDateTime, ZoneId)}.
@@ -469,6 +469,7 @@
      * @param offset  the zone offset, not null
      * @param zone  the time-zone, not null
      * @return the zoned date-time, not null
+     * @throws DateTimeException if the combination of arguments is invalid
      */
     public static ZonedDateTime ofStrict(LocalDateTime localDateTime, ZoneOffset offset, ZoneId zone) {
         Objects.requireNonNull(localDateTime, "localDateTime");
@@ -538,7 +539,7 @@
      * those fields that are equivalent to the relevant objects.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code ZonedDateTime::from}.
+     * allowing it to be used as a query via method reference, {@code ZonedDateTime::from}.
      *
      * @param temporal  the temporal object to convert, not null
      * @return the zoned date-time, not null
@@ -782,7 +783,7 @@
     /**
      * Gets the value of the specified field from this date-time as an {@code int}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -791,7 +792,7 @@
      * The {@link #isSupported(TemporalField) supported fields} will return valid
      * values based on this date-time, except {@code NANO_OF_DAY}, {@code MICRO_OF_DAY},
      * {@code EPOCH_DAY}, {@code PROLEPTIC_MONTH} and {@code INSTANT_SECONDS} which are too
-     * large to fit in an {@code int} and throw a {@code DateTimeException}.
+     * large to fit in an {@code int} and throw a {@code UnsupportedTemporalTypeException}.
      * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
@@ -824,7 +825,7 @@
     /**
      * Gets the value of the specified field from this date-time as a {@code long}.
      * <p>
-     * This queries this date-time for the value for the specified field.
+     * This queries this date-time for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
@@ -1182,7 +1183,8 @@
      * <p>
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * Key date-time classes also implement the {@code TemporalAdjuster} interface,
      * such as {@link Month} and {@link java.time.MonthDay MonthDay}.
@@ -1192,7 +1194,7 @@
      * For example this code returns a date on the last day of July:
      * <pre>
      *  import static java.time.Month.*;
-     *  import static java.time.temporal.Adjusters.*;
+     *  import static java.time.temporal.TemporalAdjusters.*;
      *
      *  result = zonedDateTime.with(JULY).with(lastDayOfMonth());
      * </pre>
@@ -1313,7 +1315,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the year value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the year altered.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#withYear(int) changing the year} of the local date-time.
@@ -1335,7 +1337,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the month-of-year value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the month-of-year altered.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#withMonth(int) changing the month} of the local date-time.
@@ -1357,7 +1359,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the day-of-month value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the day-of-month altered.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#withDayOfMonth(int) changing the day-of-month} of the local date-time.
@@ -1404,7 +1406,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the hour-of-day value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the hour-of-day altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withHour(int) changing the time} of the local date-time.
@@ -1426,7 +1428,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the minute-of-hour altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withMinute(int) changing the time} of the local date-time.
@@ -1448,7 +1450,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the second-of-minute value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the second-of-minute altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withSecond(int) changing the time} of the local date-time.
@@ -1470,7 +1472,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the nano-of-second value altered.
+     * Returns a copy of this {@code ZonedDateTime} with the nano-of-second altered.
      * <p>
      * This operates on the local time-line,
      * {@linkplain LocalDateTime#withNano(int) changing the time} of the local date-time.
@@ -1506,7 +1508,7 @@
      * {@link ChronoUnit#DAYS DAYS}. Other units throw an exception.
      * <p>
      * This operates on the local time-line,
-     * {@link LocalDateTime#truncatedTo(java.time.temporal.TemporalUnit) truncating}
+     * {@link LocalDateTime#truncatedTo(TemporalUnit) truncating}
      * the underlying local date-time. This is then converted back to a
      * {@code ZonedDateTime}, using the zone ID to obtain the offset.
      * <p>
@@ -1607,7 +1609,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in years added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of years added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusYears(long) adding years} to the local date-time.
@@ -1629,7 +1631,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in months added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of months added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusMonths(long) adding months} to the local date-time.
@@ -1651,7 +1653,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusWeeks(long) adding weeks} to the local date-time.
@@ -1673,7 +1675,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in days added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of days added.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#plusDays(long) adding days} to the local date-time.
@@ -1696,7 +1698,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in hours added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of hours added.
      * <p>
      * This operates on the instant time-line, such that adding one hour will
      * always be a duration of one hour later.
@@ -1724,7 +1726,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes added.
      * <p>
      * This operates on the instant time-line, such that adding one minute will
      * always be a duration of one minute later.
@@ -1742,7 +1744,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds added.
      * <p>
      * This operates on the instant time-line, such that adding one second will
      * always be a duration of one second later.
@@ -1760,7 +1762,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds added.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds added.
      * <p>
      * This operates on the instant time-line, such that adding one nano will
      * always be a duration of one nano later.
@@ -1848,7 +1850,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in years subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of years subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusYears(long) subtracting years} to the local date-time.
@@ -1870,7 +1872,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in months subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of months subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusMonths(long) subtracting months} to the local date-time.
@@ -1892,7 +1894,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in weeks subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of weeks subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusWeeks(long) subtracting weeks} to the local date-time.
@@ -1914,7 +1916,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in days subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of days subtracted.
      * <p>
      * This operates on the local time-line,
      * {@link LocalDateTime#minusDays(long) subtracting days} to the local date-time.
@@ -1937,7 +1939,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in hours subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of hours subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one hour will
      * always be a duration of one hour earlier.
@@ -1965,7 +1967,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in minutes subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of minutes subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one minute will
      * always be a duration of one minute earlier.
@@ -1983,7 +1985,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in seconds subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of seconds subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one second will
      * always be a duration of one second earlier.
@@ -2001,7 +2003,7 @@
     }
 
     /**
-     * Returns a copy of this {@code ZonedDateTime} with the specified period in nanoseconds subtracted.
+     * Returns a copy of this {@code ZonedDateTime} with the specified number of nanoseconds subtracted.
      * <p>
      * This operates on the instant time-line, such that subtracting one nano will
      * always be a duration of one nano earlier.
@@ -2028,7 +2030,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
@@ -2049,7 +2051,7 @@
      * 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.
-     * For example, the period in days between two date-times can be calculated
+     * For example, the amount in days between two date-times can be calculated
      * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The {@code Temporal} passed to this method is converted to a
@@ -2059,7 +2061,7 @@
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two date-times.
-     * For example, the period in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
+     * For example, the amount in months between 2012-06-15T00:00Z and 2012-08-14T23:59Z
      * will only be one month as it is one minute short of two months.
      * <p>
      * There are two equivalent ways of using this method.
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Mon May 05 12:49:13 2014 -0700
@@ -249,8 +249,8 @@
      * This allows dates in different calendar systems to be compared based
      * on the position of the date on the local time-line.
      * The underlying comparison is equivalent to comparing the epoch-day.
+     *
      * @return a comparator that compares in time-line order ignoring the chronology
-     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -227,7 +227,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this date with the specified period in years added.
+     * Returns a copy of this date with the specified number of 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.
@@ -243,7 +243,7 @@
     abstract D plusYears(long yearsToAdd);
 
     /**
-     * Returns a copy of this date with the specified period in months added.
+     * Returns a copy of this date with the specified number of 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.
@@ -259,7 +259,7 @@
     abstract D plusMonths(long monthsToAdd);
 
     /**
-     * Returns a copy of this date with the specified period in weeks added.
+     * Returns a copy of this date with the specified number of 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.
@@ -292,7 +292,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns a copy of this date with the specified period in years subtracted.
+     * Returns a copy of this date with the specified number of 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.
@@ -313,7 +313,7 @@
     }
 
     /**
-     * Returns a copy of this date with the specified period in months subtracted.
+     * Returns a copy of this date with the specified number of 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.
@@ -334,7 +334,7 @@
     }
 
     /**
-     * Returns a copy of this date with the specified period in weeks subtracted.
+     * Returns a copy of this date with the specified number of 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.
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Mon May 05 12:49:13 2014 -0700
@@ -131,7 +131,6 @@
      * The underlying comparison is equivalent to comparing the epoch-day and nano-of-day.
      *
      * @return a comparator that compares in time-line order ignoring the chronology
-     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
@@ -323,7 +322,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Mon May 05 12:49:13 2014 -0700
@@ -132,7 +132,6 @@
      * The underlying comparison is equivalent to comparing the epoch-second and nano-of-second.
      *
      * @return a comparator that compares in time-line order ignoring the chronology
-     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
@@ -292,7 +291,7 @@
      * <p>
      * This instance is immutable and unaffected by this method call.
      *
-     * @return a {@code ZoneChronoDateTime} based on this date-time with the earlier offset, not null
+     * @return a {@code ChronoZonedDateTime} based on this date-time with the earlier offset, not null
      * @throws DateTimeException if no rules can be found for the zone
      * @throws DateTimeException if no rules are valid for this date-time
      */
@@ -319,7 +318,7 @@
     ChronoZonedDateTime<D> withLaterOffsetAtOverlap();
 
     /**
-     * Returns a copy of this ZonedDateTime with a different time-zone,
+     * Returns a copy of this date-time with a different time-zone,
      * retaining the local date-time if possible.
      * <p>
      * This method changes the time-zone and retains the local date-time.
@@ -470,7 +469,7 @@
      * what the result of this method will be.
      * <p>
      * The result of this method is obtained by invoking the
-     * {@link java.time.temporal.TemporalQuery#queryFrom(TemporalAccessor)} method on the
+     * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the
      * specified query passing {@code this} as the argument.
      *
      * @param <R> the type of the result
--- a/jdk/src/share/classes/java/time/chrono/Chronology.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/Chronology.java	Mon May 05 12:49:13 2014 -0700
@@ -132,8 +132,9 @@
  * The set of available chronologies can be extended by applications.
  * Adding a new calendar system requires the writing of an implementation of
  * {@code Chronology}, {@code ChronoLocalDate} and {@code Era}.
- * The majority of the logic specific to the calendar system will be in
- * {@code ChronoLocalDate}. The {@code Chronology} subclass acts as a factory.
+ * The majority of the logic specific to the calendar system will be in the
+ * {@code ChronoLocalDate} implementation.
+ * The {@code Chronology} implementation acts as a factory.
  * <p>
  * To permit the discovery of additional chronologies, the {@link java.util.ServiceLoader ServiceLoader}
  * is used. A file must be added to the {@code META-INF/services} directory with the
@@ -167,7 +168,7 @@
      * If the specified temporal object does not have a chronology, {@link IsoChronology} is returned.
      * <p>
      * This method matches the signature of the functional interface {@link TemporalQuery}
-     * allowing it to be used in queries via method reference, {@code Chronology::from}.
+     * allowing it to be used as a query via method reference, {@code Chronology::from}.
      *
      * @param temporal  the temporal to convert, not null
      * @return the chronology, not null
@@ -413,7 +414,7 @@
      * The alternate clock may be introduced using {@link Clock dependency injection}.
      *
      * @implSpec
-     * The default implementation invokes {@link #date(TemporalAccessor)} )}.
+     * The default implementation invokes {@link #date(TemporalAccessor)}.
      *
      * @param clock  the clock to use, not null
      * @return the current local date, not null
@@ -622,7 +623,7 @@
      * The parameters control the style of the returned text and the locale.
      *
      * @implSpec
-     * The default implementation behaves as the the formatter was used to
+     * The default implementation behaves as though the formatter was used to
      * format the chronology textual name.
      *
      * @param style  the style of the text required, not null
--- a/jdk/src/share/classes/java/time/chrono/Era.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/Era.java	Mon May 05 12:49:13 2014 -0700
@@ -182,7 +182,7 @@
     /**
      * Gets the value of the specified field from this era as an {@code int}.
      * <p>
-     * This queries this era for the value for the specified field.
+     * This queries this era for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
@@ -215,7 +215,7 @@
     /**
      * Gets the value of the specified field from this era as a {@code long}.
      * <p>
-     * This queries this era for the value for the specified field.
+     * This queries this era for the value of the specified field.
      * If it is not possible to return the value, because the field is not supported
      * or for some other reason, an exception is thrown.
      * <p>
--- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Mon May 05 12:49:13 2014 -0700
@@ -394,7 +394,7 @@
      * Gets the ID of the chronology.
      * <p>
      * The ID uniquely identifies the {@code Chronology}. It can be used to
-     * lookup the {@code Chronology} using {@link #of(String)}.
+     * lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID, non-null
      * @see #getCalendarType()
@@ -409,7 +409,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the calendar system type; non-null if the calendar has
      *    a standard type, otherwise null
--- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Mon May 05 12:49:13 2014 -0700
@@ -143,7 +143,7 @@
      * Gets the ID of the chronology - 'ISO'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'ISO'
      * @see #getCalendarType()
@@ -158,7 +158,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Mon May 05 12:49:13 2014 -0700
@@ -150,7 +150,7 @@
      * Gets the ID of the chronology - 'Japanese'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'Japanese'
      * @see #getCalendarType()
@@ -165,7 +165,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Mon May 05 12:49:13 2014 -0700
@@ -132,7 +132,7 @@
      * Gets the ID of the chronology - 'Minguo'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'Minguo'
      * @see #getCalendarType()
@@ -147,7 +147,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Mon May 05 12:49:13 2014 -0700
@@ -168,7 +168,7 @@
      * Gets the ID of the chronology - 'ThaiBuddhist'.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      *
      * @return the chronology ID - 'ThaiBuddhist'
      * @see #getCalendarType()
@@ -183,7 +183,7 @@
      * <p>
      * The calendar type is an identifier defined by the
      * <em>Unicode Locale Data Markup Language (LDML)</em> specification.
-     * It can be used to lookup the {@code Chronology} using {@link #of(String)}.
+     * It can be used to lookup the {@code Chronology} using {@link Chronology#of(String)}.
      * It can also be used as part of a locale, accessible via
      * {@link Locale#getUnicodeLocaleType(String)} with the key 'ca'.
      *
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java	Mon May 05 12:49:13 2014 -0700
@@ -117,7 +117,7 @@
  * {@code parse(CharSequence text, DateTimeFormatter formatter)}.
  * <p>For example:
  * <blockquote><pre>
- *  String text = date.toString(formatter);
+ *  String text = date.format(formatter);
  *  LocalDate date = LocalDate.parse(text, formatter);
  * </pre></blockquote>
  * <p>
@@ -266,7 +266,7 @@
  * For example:
  * <blockquote><pre>
  *  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
- *  String text = date.toString(formatter);
+ *  String text = date.format(formatter);
  *  LocalDate date = LocalDate.parse(text, formatter);
  * </pre></blockquote>
  * <p>
@@ -1976,7 +1976,7 @@
      * Errors are returned using the error index field of the {@code ParsePosition}
      * instead of {@code DateTimeParseException}.
      * The returned error index will be set to an index indicative of the error.
-     * Callers must check for errors before using the context.
+     * Callers must check for errors before using the result.
      * <p>
      * If the formatter parses the same field more than once with different values,
      * the result will be an error.
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -137,7 +137,6 @@
  * <li>ChronologyText - the name of the chronology</li>
  * <li>Literal - a text literal</li>
  * <li>Nested and Optional - formats can be nested or made optional</li>
- * <li>Other - the printer and parser interfaces can be used to add user supplied formatting</li>
  * </ul>
  * In addition, any of the elements may be decorated by padding, either with spaces or any other character.
  * <p>
@@ -194,8 +193,8 @@
      * The locale and chronology are used to lookup the locale specific format
      * for the requested dateStyle and/or timeStyle.
      *
-     * @param dateStyle  the FormatStyle for the date
-     * @param timeStyle  the FormatStyle for the time
+     * @param dateStyle  the FormatStyle for the date, null for time-only pattern
+     * @param timeStyle  the FormatStyle for the time, null for date-only pattern
      * @param chrono  the Chronology, non-null
      * @param locale  the locale, non-null
      * @return the locale and Chronology specific formatting pattern
@@ -747,9 +746,9 @@
      * defines the connection between each value and the text:
      * <pre>
      * Map&lt;Long, String&gt; map = new HashMap&lt;&gt;();
-     * map.put(1, "JNY");
-     * map.put(2, "FBY");
-     * map.put(3, "MCH");
+     * map.put(1L, "JNY");
+     * map.put(2L, "FBY");
+     * map.put(3L, "MCH");
      * ...
      * builder.appendText(MONTH_OF_YEAR, map);
      * </pre>
@@ -841,7 +840,7 @@
      * <p>
      * The {@linkplain ResolverStyle resolver style} has no effect on instant parsing.
      * The end-of-day time of '24:00' is handled as midnight at the start of the following day.
-     * The leap-second time of '23:59:59' is handled to some degree, see
+     * The leap-second time of '23:59:60' is handled to some degree, see
      * {@link DateTimeFormatter#parsedLeapSecond()} for full details.
      * <p>
      * An alternative to this method is to format/parse the instant as a single
@@ -864,7 +863,7 @@
      * Appends the zone offset, such as '+01:00', to the formatter.
      * <p>
      * This appends an instruction to format/parse the offset ID to the builder.
-     * This is equivalent to calling {@code appendOffset("HH:MM:ss", "Z")}.
+     * This is equivalent to calling {@code appendOffset("+HH:MM:ss", "Z")}.
      *
      * @return this, for chaining, not null
      */
@@ -1049,7 +1048,7 @@
      *   "GMT+01:30"               -- ZoneOffset.of("+01:30")
      * </pre>
      * <p>
-     * Note that this method is is identical to {@code appendZoneId()} except
+     * Note that this method is identical to {@code appendZoneId()} except
      * in the mechanism used to obtain the zone.
      * Note also that parsing accepts offsets, whereas formatting will never
      * produce one.
@@ -1107,7 +1106,7 @@
      *   "GMT+01:30"               -- ZoneOffset.of("GMT+01:30")
      * </pre>
      * <p>
-     * Note that this method is is identical to {@code appendZoneId()} except
+     * Note that this method is identical to {@code appendZoneId()} except
      * in the mechanism used to obtain the zone.
      *
      * @return this, for chaining, not null
@@ -1132,7 +1131,7 @@
      * for the locale set in the {@link DateTimeFormatter}.
      * If the temporal object being printed represents an instant, then the text
      * will be the summer or winter time text as appropriate.
-     * If the lookup for text does not find any suitable reuslt, then the
+     * If the lookup for text does not find any suitable result, then the
      * {@link ZoneId#getId() ID} will be printed instead.
      * If the zone cannot be obtained then an exception is thrown unless the
      * section of the formatter is optional.
@@ -1168,7 +1167,7 @@
      * for the locale set in the {@link DateTimeFormatter}.
      * If the temporal object being printed represents an instant, then the text
      * will be the summer or winter time text as appropriate.
-     * If the lookup for text does not find any suitable reuslt, then the
+     * If the lookup for text does not find any suitable result, then the
      * {@link ZoneId#getId() ID} will be printed instead.
      * If the zone cannot be obtained then an exception is thrown unless the
      * section of the formatter is optional.
@@ -1182,7 +1181,7 @@
      * zone. This method also allows a set of preferred {@link ZoneId} to be
      * specified for parsing. The matched preferred zone id will be used if the
      * textural zone name being parsed is not unique.
-     *
+     * <p>
      * If the zone cannot be parsed then an exception is thrown unless the
      * section of the formatter is optional.
      *
@@ -1227,7 +1226,6 @@
      * <p>
      * The calendar system name will be output during a format.
      * If the chronology cannot be obtained then an exception will be thrown.
-     * The calendar system name is obtained from the Chronology.
      *
      * @param textStyle  the text style to use, not null
      * @return this, for chaining, not null
@@ -1453,7 +1451,7 @@
      *    LLLLL   5      appendText(ChronoField.MONTH_OF_YEAR, TextStyle.NARROW_STANDALONE)
      *
      *    w       1      append special localized WeekFields element for numeric week-of-year
-     *    ww      1      append special localized WeekFields element for numeric week-of-year, zero-padded
+     *    ww      2      append special localized WeekFields element for numeric week-of-year, zero-padded
      *    W       1      append special localized WeekFields element for numeric week-of-month
      *    d       1      appendValue(ChronoField.DAY_OF_MONTH)
      *    dd      2      appendValue(ChronoField.DAY_OF_MONTH, 2)
@@ -1880,7 +1878,6 @@
      * <p>
      * During parsing, the padding and decorated element are parsed.
      * If parsing is lenient, then the pad width is treated as a maximum.
-     * If parsing is case insensitive, then the pad character is matched ignoring case.
      * The padding is parsed greedily. Thus, if the decorated element starts with
      * the pad character, it will not be parsed.
      *
--- a/jdk/src/share/classes/java/time/format/DecimalStyle.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/format/DecimalStyle.java	Mon May 05 12:49:13 2014 -0700
@@ -62,7 +62,6 @@
 package java.time.format;
 
 import java.text.DecimalFormatSymbols;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Locale;
@@ -138,7 +137,7 @@
      *     of(Locale.getDefault(Locale.Category.FORMAT))}.
      *
      * @see java.util.Locale.Category#FORMAT
-     * @return the info, not null
+     * @return the decimal style, not null
      */
     public static DecimalStyle ofDefaultLocale() {
         return of(Locale.getDefault(Locale.Category.FORMAT));
@@ -150,7 +149,7 @@
      * This method provides access to locale sensitive decimal style symbols.
      *
      * @param locale  the locale, not null
-     * @return the info, not null
+     * @return the decimal style, not null
      */
     public static DecimalStyle of(Locale locale) {
         Objects.requireNonNull(locale, "locale");
@@ -340,7 +339,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Checks if this DecimalStyle is equal another DecimalStyle.
+     * Checks if this DecimalStyle is equal to another DecimalStyle.
      *
      * @param obj  the object to check, null returns false
      * @return true if this is equal to the other date
--- a/jdk/src/share/classes/java/time/temporal/IsoFields.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java	Mon May 05 12:49:13 2014 -0700
@@ -638,7 +638,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Implementation of the period unit.
+     * Implementation of the unit.
      */
     private static enum Unit implements TemporalUnit {
 
--- a/jdk/src/share/classes/java/time/temporal/Temporal.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/Temporal.java	Mon May 05 12:49:13 2014 -0700
@@ -157,7 +157,8 @@
      * This adjusts this date-time according to the rules of the specified adjuster.
      * A simple adjuster might simply set the one of the fields, such as the year field.
      * A more complex adjuster might set the date to the last day of the month.
-     * A selection of common adjustments is provided in {@link TemporalAdjuster}.
+     * A selection of common adjustments is provided in
+     * {@link java.time.temporal.TemporalAdjusters TemporalAdjusters}.
      * These include finding the "last day of the month" and "next Wednesday".
      * The adjuster is responsible for handling special cases, such as the varying
      * lengths of month and leap years.
@@ -287,7 +288,7 @@
      * This provides equivalent, safe behavior for immutable and mutable implementations.
      *
      * @param amountToAdd  the amount of the specified unit to add, may be negative
-     * @param unit  the unit of the period to add, not null
+     * @param unit  the unit of the amount to add, not null
      * @return an object of the same type with the specified period added, not null
      * @throws DateTimeException if the unit cannot be added
      * @throws UnsupportedTemporalTypeException if the unit is not supported
@@ -359,7 +360,7 @@
      * </pre>
      *
      * @param amountToSubtract  the amount of the specified unit to subtract, may be negative
-     * @param unit  the unit of the period to subtract, not null
+     * @param unit  the unit of the amount to subtract, not null
      * @return an object of the same type with the specified period subtracted, not null
      * @throws DateTimeException if the unit cannot be subtracted
      * @throws UnsupportedTemporalTypeException if the unit is not supported
@@ -378,12 +379,12 @@
      * 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
+     * For example, the amount in hours between two temporal objects can be
      * calculated using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two temporals.
-     * For example, the period in hours between the times 11:30 and 13:29
+     * For example, the amount in hours between the times 11:30 and 13:29
      * will only be one hour as it is one minute short of two hours.
      * <p>
      * There are two equivalent ways of using this method.
--- a/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java	Mon May 05 12:49:13 2014 -0700
@@ -180,7 +180,7 @@
     /**
      * Gets the value of the specified field as an {@code int}.
      * <p>
-     * This queries the date-time for the value for the specified field.
+     * This queries the date-time for the value of the specified field.
      * The returned value will always be within the valid range of values for the field.
      * If the date-time cannot return the value, because the field is unsupported or for
      * some other reason, an exception will be thrown.
@@ -229,7 +229,7 @@
     /**
      * Gets the value of the specified field as a {@code long}.
      * <p>
-     * This queries the date-time for the value for the specified field.
+     * This queries the date-time for the value of the specified field.
      * The returned value may be outside the valid range of values for the field.
      * If the date-time cannot return the value, because the field is unsupported or for
      * some other reason, an exception will be thrown.
--- a/jdk/src/share/classes/java/time/temporal/TemporalField.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java	Mon May 05 12:49:13 2014 -0700
@@ -116,7 +116,7 @@
      * For example, in the field 'MonthOfYear', the unit is 'Months'.
      * See also {@link #getRangeUnit()}.
      *
-     * @return the period unit defining the base unit of the field, not null
+     * @return the unit defining the base unit of the field, not null
      */
     TemporalUnit getBaseUnit();
 
@@ -130,7 +130,7 @@
      * The range is never null. For example, the 'Year' field is shorthand for
      * 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'.
      *
-     * @return the period unit defining the range of the field, not null
+     * @return the unit defining the range of the field, not null
      */
     TemporalUnit getRangeUnit();
 
@@ -179,7 +179,7 @@
      * Checks if this field is supported by the temporal object.
      * <p>
      * This determines whether the temporal accessor supports this field.
-     * If this returns false, the the temporal cannot be queried for this field.
+     * If this returns false, then the temporal cannot be queried for this field.
      * <p>
      * There are two equivalent ways of using this method.
      * The first is to invoke this method directly.
--- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Mon May 05 12:49:13 2014 -0700
@@ -221,7 +221,7 @@
      * @param temporal  the temporal object to adjust, not null
      * @param amount  the amount of this unit to add, positive or negative
      * @return the adjusted temporal object, not null
-     * @throws DateTimeException if the period cannot be added
+     * @throws DateTimeException if the amount cannot be added
      * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
      */
     <R extends Temporal> R addTo(R temporal, long amount);
--- a/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java	Mon May 05 12:49:13 2014 -0700
@@ -83,7 +83,7 @@
  * The discontinuity is normally a gap in spring and an overlap in autumn.
  * {@code ZoneOffsetTransition} models the transition between the two offsets.
  * <p>
- * Gaps occur where there are local date-times that simply do not not exist.
+ * Gaps occur where there are local date-times that simply do not exist.
  * An example would be when the offset changes from {@code +03:00} to {@code +04:00}.
  * This might be described as 'the clocks will move forward one hour tonight at 1am'.
  * <p>
@@ -334,7 +334,7 @@
     /**
      * Does this transition represent a gap in the local time-line.
      * <p>
-     * Gaps occur where there are local date-times that simply do not not exist.
+     * Gaps occur where there are local date-times that simply do not exist.
      * An example would be when the offset changes from {@code +01:00} to {@code +02:00}.
      * This might be described as 'the clocks will move forward one hour tonight at 1am'.
      *
--- a/jdk/src/share/classes/java/util/ArrayList.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/ArrayList.java	Mon May 05 12:49:13 2014 -0700
@@ -70,9 +70,9 @@
  * unsynchronized access to the list:<pre>
  *   List list = Collections.synchronizedList(new ArrayList(...));</pre>
  *
- * <p><a name="fail-fast">
+ * <p id="fail-fast">
  * The iterators returned by this class's {@link #iterator() iterator} and
- * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:</a>
+ * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:
  * if the list is structurally modified at any time after the iterator is
  * created, in any way except through the iterator's own
  * {@link ListIterator#remove() remove} or
--- a/jdk/src/share/classes/java/util/Arrays.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/Arrays.java	Mon May 05 12:49:13 2014 -0700
@@ -2561,7 +2561,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2590,7 +2590,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2619,7 +2619,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2648,7 +2648,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2677,7 +2677,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2706,7 +2706,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
@@ -2735,7 +2735,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * Two doubles <tt>d1</tt> and <tt>d2</tt> are considered equal if:
      * <pre>    <tt>new Double(d1).equals(new Double(d2))</tt></pre>
@@ -2770,7 +2770,7 @@
      * arrays contain the same number of elements, and all corresponding pairs
      * of elements in the two arrays are equal.  In other words, two arrays
      * are equal if they contain the same elements in the same order.  Also,
-     * two array references are considered equal if both are <tt>null</tt>.<p>
+     * two array references are considered equal if both are <tt>null</tt>.
      *
      * Two floats <tt>f1</tt> and <tt>f2</tt> are considered equal if:
      * <pre>    <tt>new Float(f1).equals(new Float(f2))</tt></pre>
@@ -2807,7 +2807,7 @@
      * and <tt>e2</tt> are considered <i>equal</i> if <tt>(e1==null ? e2==null
      * : e1.equals(e2))</tt>.  In other words, the two arrays are equal if
      * they contain the same elements in the same order.  Also, two array
-     * references are considered equal if both are <tt>null</tt>.<p>
+     * references are considered equal if both are <tt>null</tt>.
      *
      * @param a one array to be tested for equality
      * @param a2 the other array to be tested for equality
--- a/jdk/src/share/classes/java/util/Hashtable.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/Hashtable.java	Mon May 05 12:49:13 2014 -0700
@@ -26,7 +26,6 @@
 package java.util;
 
 import java.io.*;
-import java.util.concurrent.ThreadLocalRandom;
 import java.util.function.BiConsumer;
 import java.util.function.Function;
 import java.util.function.BiFunction;
@@ -92,8 +91,10 @@
  * ConcurrentModificationException}.  Thus, in the face of concurrent
  * modification, the iterator fails quickly and cleanly, rather than risking
  * arbitrary, non-deterministic behavior at an undetermined time in the future.
- * The Enumerations returned by Hashtable's keys and elements methods are
- * <em>not</em> fail-fast.
+ * The Enumerations returned by Hashtable's {@link #keys keys} and
+ * {@link #elements elements} methods are <em>not</em> fail-fast; if the
+ * Hashtable is structurally modified at any time after the enumeration is
+ * created then the results of enumerating are undefined.
  *
  * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
  * as it is, generally speaking, impossible to make any hard guarantees in the
@@ -115,6 +116,9 @@
  * to use {@link java.util.concurrent.ConcurrentHashMap} in place of
  * {@code Hashtable}.
  *
+ * @param <K> the type of keys maintained by this map
+ * @param <V> the type of mapped values
+ *
  * @author  Arthur van Hoff
  * @author  Josh Bloch
  * @author  Neal Gafter
@@ -246,6 +250,9 @@
 
     /**
      * Returns an enumeration of the keys in this hashtable.
+     * Use the Enumeration methods on the returned object to fetch the keys
+     * sequentially. If the hashtable is structurally modified while enumerating
+     * over the keys then the results of enumerating are undefined.
      *
      * @return  an enumeration of the keys in this hashtable.
      * @see     Enumeration
@@ -260,7 +267,8 @@
     /**
      * Returns an enumeration of the values in this hashtable.
      * Use the Enumeration methods on the returned object to fetch the elements
-     * sequentially.
+     * sequentially. If the hashtable is structurally modified while enumerating
+     * over the values then the results of enumerating are undefined.
      *
      * @return  an enumeration of the values in this hashtable.
      * @see     java.util.Enumeration
@@ -417,8 +425,6 @@
     }
 
     private void addEntry(int hash, K key, V value, int index) {
-        modCount++;
-
         Entry<?,?> tab[] = table;
         if (count >= threshold) {
             // Rehash the table if the threshold is exceeded
@@ -434,6 +440,7 @@
         Entry<K,V> e = (Entry<K,V>) tab[index];
         tab[index] = new Entry<>(hash, key, value, e);
         count++;
+        modCount++;
     }
 
     /**
@@ -494,12 +501,12 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for(Entry<K,V> prev = null ; e != null ; prev = e, e = e.next) {
             if ((e.hash == hash) && e.key.equals(key)) {
-                modCount++;
                 if (prev != null) {
                     prev.next = e.next;
                 } else {
                     tab[index] = e.next;
                 }
+                modCount++;
                 count--;
                 V oldValue = e.value;
                 e.value = null;
@@ -528,9 +535,9 @@
      */
     public synchronized void clear() {
         Entry<?,?> tab[] = table;
-        modCount++;
         for (int index = tab.length; --index >= 0; )
             tab[index] = null;
+        modCount++;
         count = 0;
     }
 
@@ -719,14 +726,14 @@
             Entry<K,V> e = (Entry<K,V>)tab[index];
             for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
                 if (e.hash==hash && e.equals(entry)) {
-                    modCount++;
                     if (prev != null)
                         prev.next = e.next;
                     else
                         tab[index] = e.next;
 
+                    e.value = null; // clear for gc.
+                    modCount++;
                     count--;
-                    e.value = null;
                     return true;
                 }
             }
@@ -939,14 +946,14 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
             if ((e.hash == hash) && e.key.equals(key) && e.value.equals(value)) {
-                modCount++;
                 if (prev != null) {
                     prev.next = e.next;
                 } else {
                     tab[index] = e.next;
                 }
+                e.value = null; // clear for gc
+                modCount++;
                 count--;
-                e.value = null;
                 return true;
             }
         }
@@ -1030,12 +1037,12 @@
             if (e.hash == hash && e.key.equals(key)) {
                 V newValue = remappingFunction.apply(key, e.value);
                 if (newValue == null) {
-                    modCount++;
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
+                    modCount++;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1059,12 +1066,12 @@
             if (e.hash == hash && Objects.equals(e.key, key)) {
                 V newValue = remappingFunction.apply(key, e.value);
                 if (newValue == null) {
-                    modCount++;
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
+                    modCount++;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1094,12 +1101,12 @@
             if (e.hash == hash && e.key.equals(key)) {
                 V newValue = remappingFunction.apply(e.value, value);
                 if (newValue == null) {
-                    modCount++;
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
+                    modCount++;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1298,24 +1305,24 @@
      * by passing an Enumeration.
      */
     private class Enumerator<T> implements Enumeration<T>, Iterator<T> {
-        Entry<?,?>[] table = Hashtable.this.table;
+        final Entry<?,?>[] table = Hashtable.this.table;
         int index = table.length;
         Entry<?,?> entry;
         Entry<?,?> lastReturned;
-        int type;
+        final int type;
 
         /**
          * Indicates whether this Enumerator is serving as an Iterator
          * or an Enumeration.  (true -> Iterator).
          */
-        boolean iterator;
+        final boolean iterator;
 
         /**
          * The modCount value that the iterator believes that the backing
          * Hashtable should have.  If this expectation is violated, the iterator
          * has detected concurrent modification.
          */
-        protected int expectedModCount = modCount;
+        protected int expectedModCount = Hashtable.this.modCount;
 
         Enumerator(int type, boolean iterator) {
             this.type = type;
@@ -1360,7 +1367,7 @@
         }
 
         public T next() {
-            if (modCount != expectedModCount)
+            if (Hashtable.this.modCount != expectedModCount)
                 throw new ConcurrentModificationException();
             return nextElement();
         }
@@ -1381,14 +1388,14 @@
                 Entry<K,V> e = (Entry<K,V>)tab[index];
                 for(Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
                     if (e == lastReturned) {
-                        modCount++;
-                        expectedModCount++;
                         if (prev == null)
                             tab[index] = e.next;
                         else
                             prev.next = e.next;
-                        count--;
+                        expectedModCount++;
                         lastReturned = null;
+                        Hashtable.this.modCount++;
+                        Hashtable.this.count--;
                         return;
                     }
                 }
--- a/jdk/src/share/classes/java/util/Locale.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/Locale.java	Mon May 05 12:49:13 2014 -0700
@@ -951,7 +951,6 @@
      * functionality, this method should only be used if the caller is
      * prepared to reinitialize locale-sensitive code running within the
      * same Java Virtual Machine.
-     * <p>
      *
      * @param category - the specified category to set the default locale
      * @param newLocale - the new default locale
--- a/jdk/src/share/classes/java/util/Properties.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/Properties.java	Mon May 05 12:49:13 2014 -0700
@@ -754,7 +754,6 @@
      * <p>
      * After the entries have been written, the output stream is flushed.
      * The output stream remains open after this method returns.
-     * <p>
      *
      * @param   writer      an output character stream writer.
      * @param   comments   a description of the property list.
@@ -802,7 +801,7 @@
      * <p>
      * After the entries have been written, the output stream is flushed.
      * The output stream remains open after this method returns.
-     * <p>
+     *
      * @param   out      an output stream.
      * @param   comments   a description of the property list.
      * @exception  IOException if writing this property list to the specified
--- a/jdk/src/share/classes/java/util/PropertyPermission.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/PropertyPermission.java	Mon May 05 12:49:13 2014 -0700
@@ -193,7 +193,7 @@
     /**
      * Checks two PropertyPermission objects for equality. Checks that <i>obj</i> is
      * a PropertyPermission, and has the same name and actions as this object.
-     * <P>
+     *
      * @param obj the object we are testing for equality with this object.
      * @return true if obj is a PropertyPermission, and has the same name and
      * actions as this PropertyPermission object.
@@ -369,7 +369,6 @@
     /**
      * Returns a new PermissionCollection object for storing
      * PropertyPermission objects.
-     * <p>
      *
      * @return a new PermissionCollection object suitable for storing
      * PropertyPermissions.
--- a/jdk/src/share/classes/java/util/Vector.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/Vector.java	Mon May 05 12:49:13 2014 -0700
@@ -45,9 +45,9 @@
  * capacity of a vector before inserting a large number of
  * components; this reduces the amount of incremental reallocation.
  *
- * <p><a name="fail-fast">
+ * <p id="fail-fast">
  * The iterators returned by this class's {@link #iterator() iterator} and
- * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em></a>:
+ * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:
  * if the vector is structurally modified at any time after the iterator is
  * created, in any way except through the iterator's own
  * {@link ListIterator#remove() remove} or
@@ -56,7 +56,9 @@
  * concurrent modification, the iterator fails quickly and cleanly, rather
  * than risking arbitrary, non-deterministic behavior at an undetermined
  * time in the future.  The {@link Enumeration Enumerations} returned by
- * the {@link #elements() elements} method are <em>not</em> fail-fast.
+ * the {@link #elements() elements} method are <em>not</em> fail-fast; if the
+ * Vector is structurally modified at any time after the enumeration is
+ * created then the results of enumerating are undefined.
  *
  * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
  * as it is, generally speaking, impossible to make any hard guarantees in the
@@ -74,6 +76,8 @@
  * implementation is not needed, it is recommended to use {@link
  * ArrayList} in place of {@code Vector}.
  *
+ * @param <E> Type of component elements
+ *
  * @author  Lee Boynton
  * @author  Jonathan Payne
  * @see Collection
@@ -330,7 +334,9 @@
      * Returns an enumeration of the components of this vector. The
      * returned {@code Enumeration} object will generate all items in
      * this vector. The first item generated is the item at index {@code 0},
-     * then the item at index {@code 1}, and so on.
+     * then the item at index {@code 1}, and so on. If the vector is
+     * structurally modified while enumerating over the elements then the
+     * results of enumerating are undefined.
      *
      * @return  an enumeration of the components of this vector
      * @see     Iterator
@@ -553,7 +559,6 @@
      *         ({@code index < 0 || index >= size()})
      */
     public synchronized void removeElementAt(int index) {
-        modCount++;
         if (index >= elementCount) {
             throw new ArrayIndexOutOfBoundsException(index + " >= " +
                                                      elementCount);
@@ -565,6 +570,7 @@
         if (j > 0) {
             System.arraycopy(elementData, index + 1, elementData, index, j);
         }
+        modCount++;
         elementCount--;
         elementData[elementCount] = null; /* to let gc do its work */
     }
@@ -593,7 +599,6 @@
      *         ({@code index < 0 || index > size()})
      */
     public synchronized void insertElementAt(E obj, int index) {
-        modCount++;
         if (index > elementCount) {
             throw new ArrayIndexOutOfBoundsException(index
                                                      + " > " + elementCount);
@@ -601,6 +606,7 @@
         ensureCapacityHelper(elementCount + 1);
         System.arraycopy(elementData, index, elementData, index + 1, elementCount - index);
         elementData[index] = obj;
+        modCount++;
         elementCount++;
     }
 
@@ -616,8 +622,8 @@
      * @param   obj   the component to be added
      */
     public synchronized void addElement(E obj) {
+        ensureCapacityHelper(elementCount + 1);
         modCount++;
-        ensureCapacityHelper(elementCount + 1);
         elementData[elementCount++] = obj;
     }
 
@@ -653,11 +659,11 @@
      * method (which is part of the {@link List} interface).
      */
     public synchronized void removeAllElements() {
-        modCount++;
         // Let gc do its work
         for (int i = 0; i < elementCount; i++)
             elementData[i] = null;
 
+        modCount++;
         elementCount = 0;
     }
 
@@ -705,12 +711,15 @@
      * of the Vector <em>only</em> if the caller knows that the Vector
      * does not contain any null elements.)
      *
+     * @param <T> type of array elements. The same type as {@code <E>} or a
+     * supertype of {@code <E>}.
      * @param a the array into which the elements of the Vector are to
      *          be stored, if it is big enough; otherwise, a new array of the
      *          same runtime type is allocated for this purpose.
      * @return an array containing the elements of the Vector
-     * @throws ArrayStoreException if the runtime type of a is not a supertype
-     * of the runtime type of every element in this Vector
+     * @throws ArrayStoreException if the runtime type of a, {@code <T>}, is not
+     * a supertype of the runtime type, {@code <E>}, of every element in this
+     * Vector
      * @throws NullPointerException if the given array is null
      * @since 1.2
      */
@@ -778,8 +787,8 @@
      * @since 1.2
      */
     public synchronized boolean add(E e) {
+        ensureCapacityHelper(elementCount + 1);
         modCount++;
-        ensureCapacityHelper(elementCount + 1);
         elementData[elementCount++] = e;
         return true;
     }
@@ -879,14 +888,18 @@
      * @throws NullPointerException if the specified collection is null
      * @since 1.2
      */
-    public synchronized boolean addAll(Collection<? extends E> c) {
-        modCount++;
+    public boolean addAll(Collection<? extends E> c) {
         Object[] a = c.toArray();
         int numNew = a.length;
-        ensureCapacityHelper(elementCount + numNew);
-        System.arraycopy(a, 0, elementData, elementCount, numNew);
-        elementCount += numNew;
-        return numNew != 0;
+        if (numNew > 0) {
+            synchronized (this) {
+                ensureCapacityHelper(elementCount + numNew);
+                System.arraycopy(a, 0, elementData, elementCount, numNew);
+                modCount++;
+                elementCount += numNew;
+            }
+        }
+        return numNew > 0;
     }
 
     /**
@@ -951,22 +964,25 @@
      * @since 1.2
      */
     public synchronized boolean addAll(int index, Collection<? extends E> c) {
-        modCount++;
         if (index < 0 || index > elementCount)
             throw new ArrayIndexOutOfBoundsException(index);
 
         Object[] a = c.toArray();
         int numNew = a.length;
-        ensureCapacityHelper(elementCount + numNew);
+
+        if (numNew > 0) {
+            ensureCapacityHelper(elementCount + numNew);
 
-        int numMoved = elementCount - index;
-        if (numMoved > 0)
-            System.arraycopy(elementData, index, elementData, index + numNew,
-                             numMoved);
+            int numMoved = elementCount - index;
+            if (numMoved > 0)
+                System.arraycopy(elementData, index, elementData,
+                        index + numNew, numMoved);
 
-        System.arraycopy(a, 0, elementData, index, numNew);
-        elementCount += numNew;
-        return numNew != 0;
+             System.arraycopy(a, 0, elementData, index, numNew);
+             elementCount += numNew;
+             modCount++;
+        }
+        return numNew > 0;
     }
 
     /**
@@ -1047,12 +1063,12 @@
      * (If {@code toIndex==fromIndex}, this operation has no effect.)
      */
     protected synchronized void removeRange(int fromIndex, int toIndex) {
-        modCount++;
         int numMoved = elementCount - toIndex;
         System.arraycopy(elementData, toIndex, elementData, fromIndex,
                          numMoved);
 
         // Let gc do its work
+        modCount++;
         int newElementCount = elementCount - (toIndex-fromIndex);
         while (elementCount != newElementCount)
             elementData[--elementCount] = null;
@@ -1420,7 +1436,7 @@
         }
 
         public long estimateSize() {
-            return (long) (getFence() - index);
+            return getFence() - index;
         }
 
         public int characteristics() {
--- a/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/concurrent/locks/ReentrantReadWriteLock.java	Mon May 05 12:49:13 2014 -0700
@@ -80,7 +80,6 @@
  * {@link ReadLock#tryLock()} and {@link WriteLock#tryLock()} methods
  * do not honor this fair setting and will immediately acquire the lock
  * if it is possible, regardless of waiting threads.)
- * <p>
  * </dl>
  *
  * <li><b>Reentrancy</b>
--- a/jdk/src/share/classes/java/util/jar/Pack200.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/jar/Pack200.java	Mon May 05 12:49:13 2014 -0700
@@ -224,7 +224,7 @@
      * Note: Unless otherwise noted, passing a <tt>null</tt> argument to a
      * constructor or method in this class will cause a {@link NullPointerException}
      * to be thrown.
-     * <p>
+     *
      * @since 1.5
      */
     public interface Packer {
--- a/jdk/src/share/classes/java/util/jar/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/jar/package.html	Mon May 05 12:49:13 2014 -0700
@@ -43,8 +43,7 @@
       file format. See 
       <a href="../zip/package-summary.html#package_description">java.util.zip
       package description.</a> <p>
-      In JAR files, all file names must be encoded in the UTF-8 encoding. 
-<p>
+      In JAR files, all file names must be encoded in the UTF-8 encoding.
   <li><a href="../../../../technotes/guides/jar/jar.html">
       Manifest and Signature Specification</a> - The manifest format specification.
 </ul>
--- a/jdk/src/share/classes/java/util/logging/ConsoleHandler.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/ConsoleHandler.java	Mon May 05 12:49:13 2014 -0700
@@ -62,7 +62,7 @@
  * <li>   com.foo.MyHandler.level=INFO </li>
  * <li>   com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
  * </ul>
- * <p>
+ *
  * @since 1.4
  */
 public class ConsoleHandler extends StreamHandler {
@@ -86,7 +86,7 @@
      * <p>
      * The logging request was made initially to a <tt>Logger</tt> object,
      * which initialized the <tt>LogRecord</tt> and forwarded it here.
-     * <p>
+     *
      * @param  record  description of the log event. A null record is
      *                 silently ignored and is not published
      */
--- a/jdk/src/share/classes/java/util/logging/FileHandler.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/FileHandler.java	Mon May 05 12:49:13 2014 -0700
@@ -243,7 +243,7 @@
     /**
      * Construct a default <tt>FileHandler</tt>.  This will be configured
      * entirely from <tt>LogManager</tt> properties (or their default values).
-     * <p>
+     *
      * @exception  IOException if there are IO problems opening the files.
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have <tt>LoggingPermission("control"))</tt>.
--- a/jdk/src/share/classes/java/util/logging/Formatter.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/Formatter.java	Mon May 05 12:49:13 2014 -0700
@@ -105,7 +105,6 @@
      *     java.text.MessageFormat  is used to format the string.
      * <li>Otherwise no formatting is performed.
      * </ul>
-     * <p>
      *
      * @param  record  the log record containing the raw message
      * @return   a localized and formatted message
--- a/jdk/src/share/classes/java/util/logging/Handler.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/Handler.java	Mon May 05 12:49:13 2014 -0700
@@ -158,7 +158,7 @@
      * <p>
      * Some <tt>Handlers</tt> may not use <tt>Formatters</tt>, in
      * which case the <tt>Formatter</tt> will be remembered, but not used.
-     * <p>
+     *
      * @param newFormatter the <tt>Formatter</tt> to use (may not be null)
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
@@ -329,7 +329,7 @@
      * may make other <tt>Handler</tt> specific checks that might prevent a
      * handler from logging the <tt>LogRecord</tt>. It will return false if
      * the <tt>LogRecord</tt> is null.
-     * <p>
+     *
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
--- a/jdk/src/share/classes/java/util/logging/Level.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/Level.java	Mon May 05 12:49:13 2014 -0700
@@ -195,7 +195,7 @@
     /**
      * Create a named Level with a given integer value and a
      * given localization resource name.
-     * <p>
+     *
      * @param name  the name of the Level, for example "SEVERE".
      * @param value an integer value for the level.
      * @param resourceBundleName name of a resource bundle to use in
--- a/jdk/src/share/classes/java/util/logging/LogManager.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/LogManager.java	Mon May 05 12:49:13 2014 -0700
@@ -1130,7 +1130,7 @@
      * is no strong reference to the Logger. The caller of this method
      * must check the return value for null in order to properly handle
      * the case where the Logger has been garbage collected.
-     * <p>
+     *
      * @param name name of the logger
      * @return  matching logger or null if none is found
      */
@@ -1151,7 +1151,7 @@
      * return value from {@code LogManager.getLogger()} for null to properly
      * handle the case where the Logger has been garbage collected in the
      * time since its name was returned by this method.
-     * <p>
+     *
      * @return  enumeration of logger name strings
      */
     public Enumeration<String> getLoggerNames() {
--- a/jdk/src/share/classes/java/util/logging/Logger.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/Logger.java	Mon May 05 12:49:13 2014 -0700
@@ -338,7 +338,7 @@
      * suitable per-Logger granularity. Developers also need to keep a
      * strong reference to their Logger objects to prevent them from
      * being garbage collected.
-     * <p>
+     *
      * @deprecated Initialization of this field is prone to deadlocks.
      * The field must be initialized by the Logger class initialization
      * which may cause deadlocks with the LogManager class initialization.
@@ -526,7 +526,7 @@
      * name is used.  If the named Logger already exists and has
      * a different resource bundle name then an IllegalArgumentException
      * is thrown.
-     * <p>
+     *
      * @param   name    A name for the logger.  This should
      *                          be a dot-separated name and should normally
      *                          be based on the package name or class name
@@ -595,7 +595,6 @@
      * from the root logger. Changing its parent via the
      * {@link #setParent(java.util.logging.Logger) setParent} method
      * will still require the security permission specified by that method.
-     * <p>
      *
      * @return a newly created private Logger
      */
@@ -621,7 +620,7 @@
      * from the root logger.  Changing its parent via the
      * {@link #setParent(java.util.logging.Logger) setParent} method
      * will still require the security permission specified by that method.
-     * <p>
+     *
      * @param   resourceBundleName  name of ResourceBundle to be used for localizing
      *                          messages for this logger.
      *          May be null if none of the messages require localization.
@@ -776,7 +775,7 @@
      * If the logger is currently enabled for the given message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      */
@@ -796,7 +795,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
@@ -815,7 +814,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      * @param   param1  parameter to the message
@@ -836,7 +835,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      * @param   params  array of parameters to the message
@@ -861,7 +860,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   msg     The string message (or a key in the message catalog)
      * @param   thrown  Throwable associated with log message.
@@ -887,7 +886,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   thrown  Throwable associated with log message.
      * @param   msgSupplier   A function, which when called, produces the
@@ -914,7 +913,7 @@
      * If the logger is currently enabled for the given message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -938,7 +937,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -964,7 +963,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -991,7 +990,7 @@
      * If the logger is currently enabled for the given message
      * level then a corresponding LogRecord is created and forwarded
      * to all the registered output Handler objects.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1022,7 +1021,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1054,7 +1053,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1113,7 +1112,7 @@
      * The msg string is localized using the named resource bundle.  If the
      * resource bundle name is null, or an empty String or invalid
      * then the msg string is not localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1147,7 +1146,7 @@
      * The msg string is localized using the named resource bundle.  If the
      * resource bundle name is null, or an empty String or invalid
      * then the msg string is not localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1184,7 +1183,7 @@
      * The msg string is localized using the named resource bundle.  If the
      * resource bundle name is null, or an empty String or invalid
      * then the msg string is not localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1220,7 +1219,7 @@
      * The {@code msg} string is localized using the given resource bundle.
      * If the resource bundle is {@code null}, then the {@code msg} string is not
      * localized.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    Name of the class that issued the logging request
      * @param   sourceMethod   Name of the method that issued the logging request
@@ -1260,7 +1259,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that issued the logging request
@@ -1301,7 +1300,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   level   One of the message level identifiers, e.g., SEVERE
      * @param   sourceClass    Name of the class that issued the logging request
      * @param   sourceMethod   Name of the method that issued the logging request
@@ -1333,7 +1332,7 @@
      * This is a convenience method that can be used to log entry
      * to a method.  A LogRecord with message "ENTRY", log level
      * FINER, and the given sourceMethod and sourceClass is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that is being entered
      */
@@ -1348,7 +1347,7 @@
      * to a method.  A LogRecord with message "ENTRY {0}", log level
      * FINER, and the given sourceMethod, sourceClass, and parameter
      * is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that is being entered
      * @param   param1         parameter to the method being entered
@@ -1365,7 +1364,7 @@
      * format {N} indicator for each entry in the parameter array),
      * log level FINER, and the given sourceMethod, sourceClass, and
      * parameters is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of method that is being entered
      * @param   params         array of parameters to the method being entered
@@ -1389,7 +1388,7 @@
      * This is a convenience method that can be used to log returning
      * from a method.  A LogRecord with message "RETURN", log level
      * FINER, and the given sourceMethod and sourceClass is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of the method
      */
@@ -1405,7 +1404,7 @@
      * from a method.  A LogRecord with message "RETURN {0}", log level
      * FINER, and the gives sourceMethod, sourceClass, and result
      * object is logged.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod   name of the method
      * @param   result  Object that is being returned
@@ -1430,7 +1429,7 @@
      * property, rather than the LogRecord parameters property.  Thus it is
      * processed specially by output Formatters and is not treated
      * as a formatting parameter to the LogRecord message property.
-     * <p>
+     *
      * @param   sourceClass    name of class that issued the logging request
      * @param   sourceMethod  name of the method.
      * @param   thrown  The Throwable that is being thrown.
@@ -1456,7 +1455,7 @@
      * If the logger is currently enabled for the SEVERE message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void severe(String msg) {
@@ -1469,7 +1468,7 @@
      * If the logger is currently enabled for the WARNING message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void warning(String msg) {
@@ -1482,7 +1481,7 @@
      * If the logger is currently enabled for the INFO message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void info(String msg) {
@@ -1495,7 +1494,7 @@
      * If the logger is currently enabled for the CONFIG message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void config(String msg) {
@@ -1508,7 +1507,7 @@
      * If the logger is currently enabled for the FINE message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void fine(String msg) {
@@ -1521,7 +1520,7 @@
      * If the logger is currently enabled for the FINER message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void finer(String msg) {
@@ -1534,7 +1533,7 @@
      * If the logger is currently enabled for the FINEST message
      * level then the given message is forwarded to all the
      * registered output Handler objects.
-     * <p>
+     *
      * @param   msg     The string message (or a key in the message catalog)
      */
     public void finest(String msg) {
@@ -1554,7 +1553,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1571,7 +1570,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1588,7 +1587,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1605,7 +1604,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1622,7 +1621,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1639,7 +1638,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1656,7 +1655,7 @@
      * level then the message is constructed by invoking the provided
      * supplier function and forwarded to all the registered output
      * Handler objects.
-     * <p>
+     *
      * @param   msgSupplier   A function, which when called, produces the
      *                        desired log message
      * @since   1.8
@@ -1769,7 +1768,7 @@
 
     /**
      * Get the Handlers associated with this logger.
-     * <p>
+     *
      * @return  an array of all registered Handlers
      */
     public Handler[] getHandlers() {
@@ -2015,7 +2014,7 @@
      * the LogManager to update a Logger when the namespace changes.
      * <p>
      * It should not be called from application code.
-     * <p>
+     *
      * @param  parent   the new parent logger
      * @throws  SecurityException  if a security manager exists and if
      *          the caller does not have LoggingPermission("control").
--- a/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/MemoryHandler.java	Mon May 05 12:49:13 2014 -0700
@@ -82,7 +82,7 @@
  * <li>   com.foo.MyHandler.level=INFO </li>
  * <li>   com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
  * </ul>
- * <p>
+ *
  * @since 1.4
  */
 
@@ -267,7 +267,7 @@
      * whether it satisfies any <tt>Filter</tt>.  However it does <b>not</b>
      * check whether the <tt>LogRecord</tt> would result in a "push" of the
      * buffer contents. It will return false if the <tt>LogRecord</tt> is null.
-     * <p>
+     *
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
--- a/jdk/src/share/classes/java/util/logging/StreamHandler.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/StreamHandler.java	Mon May 05 12:49:13 2014 -0700
@@ -71,7 +71,7 @@
  * <li>   com.foo.MyHandler.level=INFO </li>
  * <li>   com.foo.MyHandler.formatter=java.util.logging.SimpleFormatter </li>
  * </ul>
- * <p>
+ *
  * @since 1.4
  */
 
@@ -91,7 +91,7 @@
     /**
      * Create a <tt>StreamHandler</tt> with a given <tt>Formatter</tt>
      * and output stream.
-     * <p>
+     *
      * @param out         the target output stream
      * @param formatter   Formatter to be used to format output
      */
@@ -224,7 +224,7 @@
      * This method checks if the <tt>LogRecord</tt> has an appropriate level and
      * whether it satisfies any <tt>Filter</tt>.  It will also return false if
      * no output stream has been assigned yet or the LogRecord is null.
-     * <p>
+     *
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
--- a/jdk/src/share/classes/java/util/logging/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/logging/package.html	Mon May 05 12:49:13 2014 -0700
@@ -54,18 +54,18 @@
          When a problem occurs in the field, it may be necessary to return the captured logging
          information to the original development team for diagnosis. This logging
          information may be extremely detailed and fairly inscrutable. Such information might include
-         detailed tracing on the internal execution of particular subsystems.           
+         detailed tracing on the internal execution of particular subsystems.
 
    <LI> <I>Problem diagnosis by developers</I>. The Logging APIs may also be
            used to help debug an application under development. This may 
            include logging information generated by the target application
-           as well as logging information generated by lower-level libraries.          
+           as well as logging information generated by lower-level libraries.
            Note however that while this use is perfectly reasonable,
            the logging APIs are not intended to replace the normal debugging 
            and profiling tools that may already exist in the development environment. 
 </OL>
 
-</P>
+<p>
 The key elements of this package include:
 <UL>
    <LI> <I>Logger</I>: The main entity on which applications make 
@@ -111,7 +111,7 @@
 log, logp, logrb, severe, throwing, and warning methods)  
 will accept null values 
 for all arguments except for the initial Level argument (if any).
-<p>
+
 <H2>Related Documentation</H2>
 <P>
 For an overview of control flow, 
--- a/jdk/src/share/classes/java/util/prefs/PreferenceChangeListener.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/prefs/PreferenceChangeListener.java	Mon May 05 12:49:13 2014 -0700
@@ -39,7 +39,7 @@
     /**
      * This method gets called when a preference is added, removed or when
      * its value is changed.
-     * <p>
+     *
      * @param evt A PreferenceChangeEvent object describing the event source
      *          and the preference that has changed.
      */
--- a/jdk/src/share/classes/java/util/regex/Matcher.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/regex/Matcher.java	Mon May 05 12:49:13 2014 -0700
@@ -830,7 +830,7 @@
      *
      * <p> The replacement string may contain references to subsequences
      * captured during the previous match: Each occurrence of
-     * <tt>$</tt><i>g</i><tt></tt> will be replaced by the result of
+     * <tt>$</tt><i>g</i> will be replaced by the result of
      * evaluating {@link #group(int) group}<tt>(</tt><i>g</i><tt>)</tt>.
      * The first number after the <tt>$</tt> is always treated as part of
      * the group reference. Subsequent numbers are incorporated into g if
--- a/jdk/src/share/classes/java/util/zip/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/java/util/zip/package.html	Mon May 05 12:49:13 2014 -0700
@@ -39,45 +39,35 @@
 
 <h2>Package Specification</h2>
 
-</a>
 <ul>
   <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">
       Info-ZIP Application Note 970311
       </a> - a detailed description of the Info-ZIP format upon which
       the <code>java.util.zip</code> classes are based.
-<p>
-  <a name="zip64">
-  <li>An implementation may optionally support the ZIP64(tm) format extensions
-      defined by the 
+  <li><a name="zip64">An implementation may optionally support the ZIP64(tm) format extensions
+      defined by the </a>
       <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
       PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format extensions
       are used to overcome the size limitations of the original ZIP format.
-<p>
-  <a name="lang_encoding">
-  <li>APPENDIX D of <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
+  <li><a name="lang_encoding">APPENDIX D of </a><a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
       PKWARE ZIP File Format Specification</a> - Language Encoding Flag (EFS) to
       encode ZIP entry filename and comment fields using UTF-8.
-<p>
   <li><a href="http://www.ietf.org/rfc/rfc1950.txt">
       ZLIB Compressed Data Format Specification version 3.3</a>
       &nbsp;
       <a href="http://www.ietf.org/rfc/rfc1950.txt.pdf">(pdf)</a>
       (RFC 1950)
-<p>
   <li><a href="http://www.ietf.org/rfc/rfc1951.txt">
       DEFLATE Compressed Data Format Specification version 1.3</a>
       &nbsp;
       <a href="http://www.ietf.org/rfc/rfc1951.txt.pdf">(pdf)</a>
       (RFC 1951)
-<p>
   <li><a href="http://www.ietf.org/rfc/rfc1952.txt">
       GZIP file format specification version 4.3</a>
       &nbsp;
       <a href="http://www.ietf.org/rfc/rfc1952.txt.pdf">(pdf)</a>
       (RFC 1952)
-<p>
   <li>CRC-32 checksum is described in RFC 1952 (above)
-<p>
   <li>Adler-32 checksum is described in RFC 1950 (above)
 </ul>
 
--- a/jdk/src/share/classes/javax/sql/PooledConnection.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/PooledConnection.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,6 @@
  * <code>ConnectionPool</code> method <code>addStatementEventListener</code>.
  *  Thus, when an application closes its  <code>PreparedStatement</code>,
  * the underlying prepared statement is recycled rather than being closed.
- * <P>
  *
  * @since 1.4
  */
@@ -154,10 +153,10 @@
          * wish to be notified when  <code>PreparedStatement</code>s created by the
          * connection are closed or are detected to be invalid may use this method
          * to register a <code>StatementEventListener</code> with this <code>PooledConnection</code> object.
-         * <p>
+         *
          * @param listener      an component which implements the <code>StatementEventListener</code>
          *                                      interface that is to be registered with this <code>PooledConnection</code> object
-         * <p>
+         *
          * @since 1.6
          */
         public void addStatementEventListener(StatementEventListener listener);
@@ -166,11 +165,11 @@
          * Removes the specified <code>StatementEventListener</code> from the list of
          * components that will be notified when the driver detects that a
          * <code>PreparedStatement</code> has been closed or is invalid.
-         * <p>
+         *
          * @param listener      the component which implements the
          *                                      <code>StatementEventListener</code> interface that was previously
          *                                      registered with this <code>PooledConnection</code> object
-         * <p>
+         *
          * @since 1.6
          */
         public void removeStatementEventListener(StatementEventListener listener);
--- a/jdk/src/share/classes/javax/sql/StatementEvent.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/StatementEvent.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  * registered with a <code>PooledConnection</code>. This occurs when the driver determines that a
  * <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines
  * is invalid.
- * <p>
+ *
  * @since 1.6
  */
 public class StatementEvent extends EventObject {
@@ -50,11 +50,11 @@
          * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and
          * <code>PreparedStatement</code>.  The <code>SQLException</code> contained in the event defaults to
          * null.
-         * <p>
+         *
          * @param con                   The <code>PooledConnection</code> that the closed or invalid
          * <code>PreparedStatement</code>is associated with.
          * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
-         * <p>
+         *
          * @throws IllegalArgumentException if <code>con</code> is null.
          *
          * @since 1.6
@@ -71,7 +71,7 @@
         /**
          * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,
          * <code>PreparedStatement</code> and <code>SQLException</code>
-         * <p>
+         *
          * @param con                   The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>
          * is associated with.
          * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
@@ -79,7 +79,7 @@
          *                                              the application
          *
          * @throws IllegalArgumentException if <code>con</code> is null.
-         * <p>
+         *
          * @since 1.6
          */
         public StatementEvent(PooledConnection con,
@@ -94,9 +94,9 @@
 
         /**
          * Returns the <code>PreparedStatement</code> that is being closed or is invalid
-         * <p>
+         *
          * @return      The <code>PreparedStatement</code> that is being closed or is invalid
-         * <p>
+         *
          * @since 1.6
          */
         public PreparedStatement getStatement() {
@@ -106,9 +106,9 @@
 
         /**
          * Returns the <code>SQLException</code> the driver is about to throw
-         * <p>
+         *
          * @return      The <code>SQLException</code> the driver is about to throw
-         * <p>
+         *
          * @since 1.6
          */
         public SQLException getSQLException() {
--- a/jdk/src/share/classes/javax/sql/StatementEventListener.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/StatementEventListener.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * <p>
  * Methods which allow a component to register a StatementEventListener with a
  * <code>PooledConnection</code> have been added to the <code>PooledConnection</code> interface.
- * <p>
+ *
  * @since 1.6
  */
 public interface StatementEventListener  extends java.util.EventListener{
@@ -72,13 +72,13 @@
          * <code>PreparedStatement</code> is invalid. The driver calls this method
          * just before it throws the <code>SQLException</code>,
          * contained in the given event, to the application.
-         * <p>
-         * @param event         an event object describing the source of the event,
-         *                                      the statement that is invalid and the exception the
-         *                                      driver is about to throw.  The source of the event is
-         *                                      the <code>PooledConnection</code> which the invalid <code>PreparedStatement</code>
-         * is associated with.
-         * <p>
+         *
+         * @param event    an event object describing the source of the event,
+         *                 the statement that is invalid and the exception the
+         *                 driver is about to throw.  The source of the event is
+         *                 the <code>PooledConnection</code> which the invalid <code>PreparedStatement</code>
+         *                 is associated with.
+         *
          * @since 1.6
          */
         void statementErrorOccurred(StatementEvent event);
--- a/jdk/src/share/classes/javax/sql/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/package.html	Mon May 05 12:49:13 2014 -0700
@@ -2,7 +2,7 @@
 <html>
 <head>
 <!--
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -36,10 +36,9 @@
 the Java<sup><font size=-2>TM</font></sup> programming language.
 This package supplements the <code>java.sql</code>
 package and, as of the version 1.4 release, is included in the 
-Java Platform, Standard Edition
-(Java SE<sup><font size=-2>TM</sup></font>).
+Java Platform, Standard Edition (Java SE&trade;).
 It remains an essential part of the Java Platform, Enterprise Edition
-(Java EE<sup><font size=-2>TM</sup></font>).
+(Java EE&trade;).
 <P>
 The <code>javax.sql</code> package provides for the following:
 <OL>
@@ -145,7 +144,6 @@
 <code>PreparedStatement</code> is closed or there is an error, the connection 
 pool manager (being a listener)
 gets a notification that includes a <code>StatementEvent</code> object.
-<p>
 
 <H2>Distributed Transactions</H2>
 
@@ -203,14 +201,12 @@
 it rows, or moves its cursor, it also notifies each listener that is registered 
 with it.  The listener reacts by carrying out its implementation of the 
 notification method called on it.
-<P>
   <LI><code>RowSetEvent</code><br>
 As part of its internal notification process, a <code>RowSet</code> object
 creates an instance of <code>RowSetEvent</code> and passes it to the listener.
 The listener can use this <code>RowSetEvent</code> object to find out which rowset
 had the event.
 </UL>
-<P>
 <LI>Metadata 
 <UL>
   <LI><code>RowSetMetaData</code><br>
@@ -226,7 +222,6 @@
 method <code>execute</code>, the <code>RowSet</code> object will contain
 a new set of rows, and its <code>RowSetMetaData</code> object will have been
 internally updated to contain information about the new columns.
-<P>
 </UL>
 <LI>The Reader/Writer Facility<br>
 A <code>RowSet</code> object that implements the <code>RowSetInternal</code>
@@ -248,7 +243,7 @@
 (2) the connection that was passed to it, if any.  A rowset uses the 
 <code>RowSetInternal</code> methods behind the scenes to get access to
 this information.  An application does not normally invoke these methods directly.
-<P>
+
   <LI><code>RowSetReader</code><br>
 A disconnected <code>RowSet</code> object that has implemented the 
 <code>RowSetInternal</code> interface can call on its reader (the 
@@ -269,7 +264,6 @@
 back to the underlying data source.  Implementations may vary widely, but
 generally, a writer will do the following:
 
-<P>
 <UL>
   <LI>Make a connection to the data source 
   <LI>Check to see whether there is a conflict, that is, whether
@@ -291,7 +285,6 @@
 JDBC technology driver that implements the JDBC 4.0 API.
 You must check your driver documentation to be sure that it implements
 the particular features you want to use.
-<P>
 
 <h2>Package Specification</h2>
 
@@ -307,7 +300,7 @@
 
 <ul>
   <li><a href="http://www.oracle.com/technetwork/java/index-142838.html">
-          <i>JDBC&#0153;API Tutorial and Reference, Third Edition</i></a>
+          <i>JDBC&#8482;API Tutorial and Reference, Third Edition</i></a>
 </ul>
 </body>
 </html>
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,6 @@
  *  <li>Fields for storing stream instances
  *  <li>Constants for indicating the type of a stream
  *  </ul>
- *  <p>
  * </UL>
  *
  * <h3>2.0 Setting Properties</h3>
@@ -981,7 +980,7 @@
      * the specified concurrency. The default concurrency for any <code>RowSet</code>
      * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>,
      * but this method may be called at any time to change the concurrency.
-     * <P>
+     *
      * @param concurrency one of the following constants:
      *                    <code>ResultSet.CONCUR_READ_ONLY</code> or
      *                    <code>ResultSet.CONCUR_UPDATABLE</code>
@@ -1419,7 +1418,6 @@
      * form a subset of the actual rows returned by the original query. This is
      * an implementation variance determined by the specific <code>SyncProvider</code>
      * object employed by the disconnected <code>RowSet</code> object.
-     * <P>
      *
      * @param rows the number of rows to fetch; <code>0</code> to let the
      *        driver decide what the best fetch size is; must not be less
@@ -1466,7 +1464,7 @@
      * <P>
      * An application can call the method <code>setConcurrency</code> at any time
      * to change a <code>RowSet</code> object's concurrency.
-     * <p>
+     *
      * @return the concurrency type for this <code>RowSet</code>
      *     object, which must be one of the following:
      *     <code>ResultSet.CONCUR_READ_ONLY</code> or
@@ -1737,7 +1735,7 @@
      * <p>
      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
      * as it is undefined in this class.
-     * <p>
+     *
      * @param parameterIndex the ordinal number of the placeholder parameter
      *        in this <code>RowSet</code> object's command that is to be set.
      *        The first parameter is 1, the second is 2, and so on; must be
@@ -1867,7 +1865,7 @@
      * <P>
      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
      * as it is undefined in this class.
-     * S
+     *
      * @param parameterIndex the ordinal number of the placeholder parameter
      *        in this <code>RowSet</code> object's command that is to be set.
      *        The first parameter is 1, the second is 2, and so on; must be
@@ -1933,7 +1931,7 @@
      * <p>
      * NOTE: <code>JdbcRowSet</code> does not require the <code>populate</code> method
      * as it is undefined in this class.
-     * <p>
+     *
      * @param parameterIndex the ordinal number of the placeholder parameter
      *        in this <code>RowSet</code> object's command that is to be set.
      *        The first parameter is 1, the second is 2, and so on; must be
@@ -3579,7 +3577,7 @@
    * @exception SQLException if a database access error occurs or
    * this method is called on a closed <code>CallableStatement</code>
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
-     * @since 1.6
+   * @since 1.6
   */
   public void setAsciiStream(String parameterName, java.io.InputStream x)
           throws SQLException{
@@ -3651,7 +3649,7 @@
   * <code>Reader</code> reads the data till end-of-file is reached. The
   * driver does the necessary conversion from Java character format to
   * the national character set in the database.
-
+  *
   * <P><B>Note:</B> This stream object can either be a standard
   * Java stream object or your own subclass that implements the
   * standard interface.
--- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -998,7 +998,6 @@
     * available within the internal <code>RowSet</code> tabular structure by
     * virtue of a key already set either on the <code>RowSet</code> object
     * itself or on the underlying SQL data.
-    * <P>
     *
     * @return a <code>Collection</code> object that contains the values in
     * each row in this <code>CachedRowSet</code> object
--- a/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/JdbcRowSet.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,7 +116,6 @@
  * <code>CachedRowSet</code>&trade;
  * reference implementation to account for the different
  * requirements of connected and disconnected <code>RowSet</code> objects.
- * <p>
  *
  * @author Jonathan Bruce
  */
--- a/jdk/src/share/classes/javax/sql/rowset/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/package.html	Mon May 05 12:49:13 2014 -0700
@@ -5,7 +5,7 @@
   <meta http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1">
 <!--
-Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
 technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
 object provides a fully updatable and scrollable tabular 
 data structure as defined in the JDBC 3.0 specification.
-<p>
+
 <li><a href="CachedRowSet.html">
 <b><code>CachedRowSet</code>&trade;</b></a>
  - A <tt>CachedRowSet</tt> object is a JavaBeans&trade;
@@ -92,7 +92,7 @@
 Further details on this mechanism are discussed in the <a
 href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
 specification.
-<p>
+
 <li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A 
 <code>WebRowSet</code> object is an extension of <tt>CachedRowSet</tt>
 that can read and write a <code>RowSet</code> object in a well formed XML format.
@@ -108,7 +108,7 @@
 Schema is defined and published at
 <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
 <code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
-<p>   
+
 <li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
 <tt>FilteredRowSet</tt> object provides filtering functionality in a programmatic
 and extensible way. There are many instances when a <tt>RowSet</tt> <code>object</code>
@@ -124,7 +124,7 @@
 considered as bi-directional. No standard filters are defined;
 however, sufficient mechanics are specified to permit any required filter to be
 implemented.
-<p>
+
 <li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <tt>JoinRowSet</tt>
 interface  describes a mechanism by which relationships can be established between 
 two or more standard <code>RowSet</code> implementations. Any number of <tt>RowSet</tt>
@@ -146,7 +146,7 @@
 should also consult the <i>Implementer's Guide</i> in the <a
 href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
 on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
-<p>
+
 <ul>
 <li><b>3.1 Constructor</b>
 <p>
@@ -215,11 +215,10 @@
   in addition to providing a set of constants for stream type designation.<br>
               </td>
             </tr>
-                               
-      </tbody>                    
+      </tbody>
     </table>
     </blockquote>
-<p>
+
 <li><b>3.3 Connected RowSet Requirements</b>
 <p>
 The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
@@ -231,7 +230,6 @@
 or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
 supply their needs by virtue of the presence of an underlying updatable and scrollable
 <code>ResultSet</code> implementation.
-<p>
 
 <li>
 <b>3.4 Disconnected RowSet Requirements</b>
@@ -248,7 +246,7 @@
 synchronization is required. A disconnected <code>RowSet</code> object should 
 therefore ensure that no 
 extraneous references remain on the <code>Connection</code> object.
-<p>
+
 <li><b>3.5 Role of RowSetMetaDataImpl</b>
 <p>
 The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
@@ -256,7 +254,7 @@
 method implementations for metadata for both connected and disconnected 
 <code>RowSet</code> objects. All implementations are free to use this standard
 implementation but are not required to do so.
-<p>
+
 <li><b>3.6 RowSetWarning Class</b>
 <p>
 The <code>RowSetWarning</code> class provides warnings that can be set
@@ -273,8 +271,6 @@
 be chained on it.  If a warning is returned, <code>getNextWarning</code> can be called
 on it, and so on until there are no more warnings.
 
-
-<P>
 <li><b>3.7 The Joinable Interface</b>
 <P>
 The <code>Joinable</code> interface provides both connected and disconnected 
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -164,7 +164,7 @@
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code>
      * implementation.
-     * <p>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *     if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -182,7 +182,7 @@
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code>
      * implementation.
-     * <p>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *     if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -201,7 +201,7 @@
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code>
      * implementation.
-     * <p>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *     if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -219,7 +219,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -237,7 +237,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -255,7 +255,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -273,7 +273,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -291,7 +291,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -309,7 +309,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -326,7 +326,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
@@ -343,7 +343,7 @@
      * This method does not perform type-safe checking to determine if the
      * returned type is the expected type; this responsibility is delegated
      * to the UDT mapping as defined by a <code>SQLData</code> implementation.
-     * <P>
+     *
      * @return the next attribute in this <code>SQLInputImpl</code> object;
      *       if the value is <code>SQL NULL</code>, return <code>null</code>
      * @throws SQLException if the read position is located at an invalid
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialDatalink.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,7 +76,7 @@
     /**
       * Constructs a new <code>SerialDatalink</code> object from the given
       * <code>java.net.URL</code> object.
-      * <P>
+      *
       * @param url the {@code URL} to create the {@code SerialDataLink} from
       * @throws SerialException if url parameter is a null
       */
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialJavaObject.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -70,7 +70,6 @@
 
     /**
      * Constructor for <code>SerialJavaObject</code> helper class.
-     * <p>
      *
      * @param obj the Java <code>Object</code> to be serialized
      * @throws SerialException if the object is found not to be serializable
--- a/jdk/src/share/classes/javax/sql/rowset/spi/package.html	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/javax/sql/rowset/spi/package.html	Mon May 05 12:49:13 2014 -0700
@@ -1,14 +1,14 @@
 <!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
 <html>
 <head>
-                    
+
   <meta http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1">
-                    
+
   <meta name="GENERATOR"
  content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
 <!--
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
 This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 questions.
 -->
   <title>javax.sql.rowset.spi</title>
-   
+
 </head>
   <body bgcolor="#ffffff">
 
@@ -46,7 +46,7 @@
 it with the <code>SyncFactory</code> singleton. (See the class comment for
 <code>SyncProvider</code> for a full explanation of the registration process and 
 the naming convention to be used.)
-<P>
+
 <h2>Table of Contents</h2>
 <ul>
 <li><a href="#pkgspec">1.0 Package Specification</a>
@@ -57,7 +57,7 @@
 <li><a href="#reldocs">6.0 Related Documentation</a>
 </ul>
 
-<h3><a name="pkgspec">1.0 Package Specification</h3>
+<h3><a name="pkgspec">1.0 Package Specification</a></h3>
 <P>
 The following classes and interfaces make up the <code>javax.sql.rowset.spi</code>
 package:
@@ -155,7 +155,7 @@
            using locks; rather, it checks to see if there is a conflict
            before trying to synchronize the <code>RowSet</code> object and the
            data source. If there is a conflict, it does nothing, meaning that
-		   changes to the <code>RowSet</code> object are not persisted to the data
+           changes to the <code>RowSet</code> object are not persisted to the data
            source.
        <LI><B><tt>RIXMLProvider</tt></B> <BR>
             A synchronization provider that can be used with a
@@ -201,10 +201,8 @@
 synchronization mechanisms.  A vendor can make its implementation available by 
 registering the fully qualified class name with Oracle Corporation at
 <code>jdbc@sun.com</code>. This process is discussed in further detail below. 
-<P>
 
-<a name="arch"><h3>2.0 Service Provider Interface Architecture</h3>
-<ul>
+<h3><a name="arch">2.0 Service Provider Interface Architecture</a></h3>
 <b>2.1 Overview</b>
 <p>
 The Service Provider Interface provides a pluggable mechanism by which
@@ -229,13 +227,13 @@
 properties are set at run time and apply system-wide per invocation of the Java
 application. See the section <a href="#reldocs">"Related Documentation"</a>
 further related information.
-<p>
+
 <li><b>Property Files</b> - Properties specified in a standard property file.
 This can be specified using a System Property or by modifying a standard
 property file located in the platform run-time. The
 reference implementation of this technology includes a standard property
 file than can be edited to add additional <code>SyncProvider</code> objects.
-<p> 
+
 <li><b>JNDI Context</b> - Available providers can be registered on a JNDI
 context. The <tt>SyncFactory</tt> will attempt to load <tt>SyncProvider</tt>
 objects bound to the context and register them with the factory. This
@@ -258,20 +256,19 @@
 <li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
 contains <i>no</i> reference to the provider, a <code>SyncFactoryException</code> is 
 thrown.
-<p>
+
 <li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
 contains a reference to the provider, the requested provider is supplied.
-<p>
+
 <li> If no <code>SyncProvider</code> object is specified, the reference
 implementation provider <code>RIOptimisticProvider</code> is supplied.
 </ul>
 <p>
 These policies are explored in more detail in the <a href="SyncFactory.html">
 <code>SyncFactory</code></a> class.
-</ul>
 
-<li><a name="impl"><h3>3.0 SyncProvider Implementer's Guide</h3>
-<ul>
+<h3><a name="impl">3.0 SyncProvider Implementer's Guide</a></h3>
+
 <b>3.1 Requirements</b>
 <p>
 A compliant <code>SyncProvider</code> implementation that is fully pluggable
@@ -300,7 +297,7 @@
 underlying data source, overwriting whatever is there. No attempt is made to compare 
 original values with current values to see if there is a conflict. The 
 <code>RIXMLProvider</code> is implemented with this grade.
-<p>
+
 <li><b>GRADE_CHECK_MODIFIED_AT_COMMIT</b> - A low grade of optimistic synchronization.
 A <code>SyncProvider</code> implementation returning this grade
 will check for conflicts in rows that have changed between the last synchronization 
@@ -309,20 +306,20 @@
 object. If there are no conflicts, changes in the <code>RowSet</code> object will be
 written to the data source. If there are conflicts, no changes are written.
 The <code>RIOptimisticProvider</code> implementation uses this grade.
-<p>
+
 <li><b>GRADE_CHECK_ALL_AT_COMMIT</b> - A high grade of optimistic synchronization.
 A <code>SyncProvider</code> implementation   returning this grade
 will check all rows, including rows that have not changed in the disconnected
 <code>RowSet</code> object. In this way, any changes to rows in the underlying
 data source will be reflected in the disconnected <code>RowSet</code> object
 when the synchronization finishes successfully.
-<p>
+
 <li><b>GRADE_LOCK_WHEN_MODIFIED</b> - A pessimistic grade of synchronization.
 <code>SyncProvider</code> implementations returning this grade will lock
 the row in the originating  data source that corresponds to the row being changed
 in the <code>RowSet</code> object to reduce the possibility of other
 processes modifying the same data in the data source.
-<p>
+
 <li><b>GRADE_LOCK_WHEN_LOADED</b> - A higher pessimistic synchronization grade.
 A <code>SyncProvider</code> implementation returning this grade will lock
 the entire view and/or  table affected by the original query used to
@@ -347,13 +344,13 @@
 <li><b>DATASOURCE_NO_LOCK</b> - No locks remain on the originating data source. 
 This is the default lock setting for all <code>SyncProvider</code> implementations 
 unless otherwise directed by a <code>RowSet</code> object.
-<p>
+
 <li><b>DATASOURCE_ROW_LOCK</b> - A lock is placed on the rows that are touched by
 the original SQL query used to populate the <code>RowSet</code> object.
-<p> 
+
 <li><b>DATASOURCE_TABLE_LOCK</b> - A lock is placed on all tables that are touched
 by the query that was used to populate the <code>RowSet</code> object.
-<p>
+
 <li><b>DATASOURCE_DB_LOCK</b>
 A lock is placed on the entire data source that is used by the <code>RowSet</code>
 object.
@@ -369,7 +366,7 @@
 Indicates that a <code>SyncProvider</code> implementation  supports synchronization
 to the table or tables from which the SQL <code>VIEW</code> used to populate  a
 a <code>RowSet</code> object is derived.
-<p>
+
 <li><b>NONUPDATABLE_VIEW_SYNC</b>
 Indicates that a <code>SyncProvider</code> implementation  does <b>not</b> support
 synchronization to the table or tables from which the SQL <code>VIEW</code> 
@@ -381,7 +378,7 @@
 In the example below, the reference <tt>CachedRowSetImpl</tt> implementation
 reconfigures its current <tt>SyncProvider</tt> object by calling the 
 <tt>setSyncProvider</tt> method.<br>
-       
+
 <PRE>
     CachedRowSetImpl crs = new CachedRowSetImpl();
     crs.setSyncProvider("com.foo.bar.HASyncProvider");
@@ -412,7 +409,7 @@
       // No synchronization with the originating data source provided
     break;
     }
-	  
+
     switch (sync.getDataSourcLock() {
       case: SyncProvider.DATASOURCE_DB_LOCK
        // A lock is placed on the entire datasource that is used by the
@@ -439,14 +436,13 @@
     It is also possible using the static utility method in the
 <code>SyncFactory</code> class to determine the list of <code>SyncProvider</code>
 implementations currently registered with the <code>SyncFactory</code>.
-       
+
 <pre>
-	Enumeration e = SyncFactory.getRegisteredProviders();
-</pre>    
+       Enumeration e = SyncFactory.getRegisteredProviders();
+</pre>
 
-</ul>
 
-<h3><a name="resolving">4.0 Resolving Synchronization Conflicts</h3>
+<h3><a name="resolving">4.0 Resolving Synchronization Conflicts</a></h3>
 
 The interface <code>SyncResolver</code> provides a way for an application to
 decide manually what to do when a conflict occurs. When the <code>CachedRowSet</code>
@@ -491,18 +487,18 @@
 <P>
 The comment for the <code>SyncResolver</code> interface has more detail.
 
-<a name="relspec"><h3>5.0 Related Specifications</h3>
+<h3><a name="relspec">5.0 Related Specifications</a></h3>
 <ul>
-<li><a href="http://java.sun.com/products/jndi">JNDI 1.3</a>
+<li><a href="http://docs.oracle.com/javase/jndi/tutorial/index.html">JNDI</a>
 <li><a href="{@docRoot}/../technotes/guides/logging/index.html">Java Logging
 APIs</a>
 </ul>
-<a name="reldocs"><h3>6.0 Related Documentation</h3>
+<h3><a name="reldocs">6.0 Related Documentation</a></h3>
 <ul>
 <li><a href="{@docRoot}/../technotes/tools/index.html#basic">System
 properties</a>
 <li>Resource Files
-<li><a href="http://java.sun.com/tutorial/jdbc">DataSource for JDBC
+<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/">DataSource for JDBC
 Connections</a>
 </ul>
 
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java	Mon May 05 12:49:13 2014 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMSignatureMethod.java 1333415 2012-05-03 12:03:51Z coheigea $
@@ -34,10 +34,12 @@
 
 import java.io.IOException;
 import java.security.*;
+import java.security.interfaces.DSAKey;
 import java.security.spec.AlgorithmParameterSpec;
 import org.w3c.dom.Element;
 
 import com.sun.org.apache.xml.internal.security.algorithms.implementations.SignatureECDSA;
+import com.sun.org.apache.xml.internal.security.utils.JavaUtils;
 import org.jcp.xml.dsig.internal.SignerOutputStream;
 
 /**
@@ -68,6 +70,8 @@
         "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384";
     static final String ECDSA_SHA512 =
         "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512";
+    static final String DSA_SHA256 =
+        "http://www.w3.org/2009/xmldsig11#dsa-sha256";
 
     /**
      * Creates a <code>DOMSignatureMethod</code>.
@@ -119,6 +123,8 @@
             return new SHA512withRSA(smElem);
         } else if (alg.equals(SignatureMethod.DSA_SHA1)) {
             return new SHA1withDSA(smElem);
+        } else if (alg.equals(DSA_SHA256)) {
+            return new SHA256withDSA(smElem);
         } else if (alg.equals(ECDSA_SHA1)) {
             return new SHA1withECDSA(smElem);
         } else if (alg.equals(ECDSA_SHA256)) {
@@ -178,7 +184,9 @@
         try {
             Type type = getAlgorithmType();
             if (type == Type.DSA) {
-                return signature.verify(convertXMLDSIGtoASN1(sig));
+                int size = ((DSAKey)key).getParams().getQ().bitLength();
+                return signature.verify(JavaUtils.convertDsaXMLDSIGtoASN1(sig,
+                                                                       size/8));
             } else if (type == Type.ECDSA) {
                 return signature.verify(SignatureECDSA.convertXMLDSIGtoASN1(sig));
             } else {
@@ -222,7 +230,9 @@
         try {
             Type type = getAlgorithmType();
             if (type == Type.DSA) {
-                return convertASN1toXMLDSIG(signature.sign());
+                int size = ((DSAKey)key).getParams().getQ().bitLength();
+                return JavaUtils.convertDsaASN1toXMLDSIG(signature.sign(),
+                                                         size/8);
             } else if (type == Type.ECDSA) {
                 return SignatureECDSA.convertASN1toXMLDSIG(signature.sign());
             } else {
@@ -235,101 +245,6 @@
         }
     }
 
-    /**
-     * Converts an ASN.1 DSA value to a XML Signature DSA Value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param asn1Bytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertASN1toXMLDSIG(byte asn1Bytes[])
-        throws IOException
-    {
-        byte rLength = asn1Bytes[3];
-        int i;
-
-        for (i = rLength; (i > 0) && (asn1Bytes[(4 + rLength) - i] == 0); i--);
-
-        byte sLength = asn1Bytes[5 + rLength];
-        int j;
-
-        for (j = sLength;
-            (j > 0) && (asn1Bytes[(6 + rLength + sLength) - j] == 0); j--);
-
-        if ((asn1Bytes[0] != 48) || (asn1Bytes[1] != asn1Bytes.length - 2)
-            || (asn1Bytes[2] != 2) || (i > 20)
-            || (asn1Bytes[4 + rLength] != 2) || (j > 20)) {
-            throw new IOException("Invalid ASN.1 format of DSA signature");
-        } else {
-            byte xmldsigBytes[] = new byte[40];
-
-            System.arraycopy(asn1Bytes, (4+rLength)-i, xmldsigBytes, 20-i, i);
-            System.arraycopy(asn1Bytes, (6+rLength+sLength)-j, xmldsigBytes,
-                             40 - j, j);
-
-            return xmldsigBytes;
-        }
-    }
-
-    /**
-     * Converts a XML Signature DSA Value to an ASN.1 DSA value.
-     *
-     * The JAVA JCE DSA Signature algorithm creates ASN.1 encoded (r,s) value
-     * pairs; the XML Signature requires the core BigInteger values.
-     *
-     * @param xmldsigBytes
-     *
-     * @throws IOException
-     * @see <A HREF="http://www.w3.org/TR/xmldsig-core/#dsa-sha1">6.4.1 DSA</A>
-     */
-    private static byte[] convertXMLDSIGtoASN1(byte xmldsigBytes[])
-        throws IOException
-    {
-        if (xmldsigBytes.length != 40) {
-            throw new IOException("Invalid XMLDSIG format of DSA signature");
-        }
-
-        int i;
-
-        for (i = 20; (i > 0) && (xmldsigBytes[20 - i] == 0); i--);
-
-        int j = i;
-
-        if (xmldsigBytes[20 - i] < 0) {
-            j += 1;
-        }
-
-        int k;
-
-        for (k = 20; (k > 0) && (xmldsigBytes[40 - k] == 0); k--);
-
-        int l = k;
-
-        if (xmldsigBytes[40 - k] < 0) {
-            l += 1;
-        }
-
-        byte asn1Bytes[] = new byte[6 + j + l];
-
-        asn1Bytes[0] = 48;
-        asn1Bytes[1] = (byte)(4 + j + l);
-        asn1Bytes[2] = 2;
-        asn1Bytes[3] = (byte)j;
-
-        System.arraycopy(xmldsigBytes, 20 - i, asn1Bytes, (4 + j) - i, i);
-
-        asn1Bytes[4 + j] = 2;
-        asn1Bytes[5 + j] = (byte) l;
-
-        System.arraycopy(xmldsigBytes, 40 - k, asn1Bytes, (6 + j + l) - k, k);
-
-        return asn1Bytes;
-    }
-
     static final class SHA1withRSA extends DOMSignatureMethod {
         SHA1withRSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
@@ -425,6 +340,25 @@
         }
     }
 
+    static final class SHA256withDSA extends DOMSignatureMethod {
+        SHA256withDSA(AlgorithmParameterSpec params)
+            throws InvalidAlgorithmParameterException {
+            super(params);
+        }
+        SHA256withDSA(Element dmElem) throws MarshalException {
+            super(dmElem);
+        }
+        public String getAlgorithm() {
+            return DSA_SHA256;
+        }
+        String getJCAAlgorithm() {
+            return "SHA256withDSA";
+        }
+        Type getAlgorithmType() {
+            return Type.DSA;
+        }
+    }
+
     static final class SHA1withECDSA extends DOMSignatureMethod {
         SHA1withECDSA(AlgorithmParameterSpec params)
             throws InvalidAlgorithmParameterException {
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java	Mon May 05 12:49:13 2014 -0700
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMXMLSignatureFactory.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -239,6 +239,8 @@
             return new DOMSignatureMethod.SHA512withRSA(params);
         } else if (algorithm.equals(SignatureMethod.DSA_SHA1)) {
             return new DOMSignatureMethod.SHA1withDSA(params);
+        } else if (algorithm.equals(DOMSignatureMethod.DSA_SHA256)) {
+            return new DOMSignatureMethod.SHA256withDSA(params);
         } else if (algorithm.equals(SignatureMethod.HMAC_SHA1)) {
             return new DOMHMACSignatureMethod.SHA1(params);
         } else if (algorithm.equals(DOMHMACSignatureMethod.HMAC_SHA256)) {
--- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java	Mon May 05 12:49:13 2014 -0700
@@ -69,6 +69,14 @@
 
 public enum LauncherHelper {
     INSTANCE;
+
+    // used to identify JavaFX applications
+    private static final String JAVAFX_APPLICATION_MARKER =
+            "JavaFX-Application-Class";
+    private static final String JAVAFX_APPLICATION_CLASS_NAME =
+            "javafx.application.Application";
+    private static final String JAVAFX_FXHELPER_CLASS_NAME_SUFFIX =
+            "sun.launcher.LauncherHelper$FXHelper";
     private static final String MAIN_CLASS = "Main-Class";
 
     private static StringBuilder outBuf = new StringBuilder();
@@ -418,7 +426,8 @@
              * exists to enforce compliance with the jar specification
              */
             if (mainAttrs.containsKey(
-                    new Attributes.Name(FXHelper.JAVAFX_APPLICATION_MARKER))) {
+                    new Attributes.Name(JAVAFX_APPLICATION_MARKER))) {
+                FXHelper.setFXLaunchParameters(jarname, LM_JAR);
                 return FXHelper.class.getName();
             }
 
@@ -516,9 +525,9 @@
          * the main class may or may not have a main method, so do this before
          * validating the main class.
          */
-        if (mainClass.equals(FXHelper.class) ||
-                FXHelper.doesExtendFXApplication(mainClass)) {
-            // Will abort() if there are problems with the FX runtime
+        if (JAVAFX_FXHELPER_CLASS_NAME_SUFFIX.equals(mainClass.getName()) ||
+            doesExtendFXApplication(mainClass)) {
+            // Will abort() if there are problems with FX runtime
             FXHelper.setFXLaunchParameters(what, mode);
             return FXHelper.class;
         }
@@ -537,6 +546,21 @@
         return appClass;
     }
 
+    /*
+     * Check if the given class is a JavaFX Application class. This is done
+     * in a way that does not cause the Application class to load or throw
+     * ClassNotFoundException if the JavaFX runtime is not available.
+     */
+    private static boolean doesExtendFXApplication(Class<?> mainClass) {
+        for (Class<?> sc = mainClass.getSuperclass(); sc != null;
+                sc = sc.getSuperclass()) {
+            if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     // Check the existence and signature of main and abort if incorrect
     static void validateMainClass(Class<?> mainClass) {
         Method mainMethod;
@@ -545,7 +569,7 @@
         } catch (NoSuchMethodException nsme) {
             // invalid main or not FX application, abort with an error
             abort(null, "java.launcher.cls.error4", mainClass.getName(),
-                  FXHelper.JAVAFX_APPLICATION_CLASS_NAME);
+                  JAVAFX_APPLICATION_CLASS_NAME);
             return; // Avoid compiler issues
         }
 
@@ -668,11 +692,7 @@
     }
 
     static final class FXHelper {
-        // Marker entry in jar manifest that designates a JavaFX application jar
-        private static final String JAVAFX_APPLICATION_MARKER =
-                "JavaFX-Application-Class";
-        private static final String JAVAFX_APPLICATION_CLASS_NAME =
-                "javafx.application.Application";
+
         private static final String JAVAFX_LAUNCHER_CLASS_NAME =
                 "com.sun.javafx.application.LauncherImpl";
 
@@ -742,21 +762,6 @@
             }
         }
 
-        /*
-         * Check if the given class is a JavaFX Application class. This is done
-         * in a way that does not cause the Application class to load or throw
-         * ClassNotFoundException if the JavaFX runtime is not available.
-         */
-        private static boolean doesExtendFXApplication(Class<?> mainClass) {
-            for (Class<?> sc = mainClass.getSuperclass(); sc != null;
-                    sc = sc.getSuperclass()) {
-                if (sc.getName().equals(JAVAFX_APPLICATION_CLASS_NAME)) {
-                    return true;
-                }
-            }
-            return false;
-        }
-
         public static void main(String... args) throws Exception {
             if (fxLauncherMethod == null
                     || fxLaunchMode == null
--- a/jdk/src/share/classes/sun/nio/ch/PendingFuture.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/sun/nio/ch/PendingFuture.java	Mon May 05 12:49:13 2014 -0700
@@ -35,8 +35,6 @@
  */
 
 final class PendingFuture<V,A> implements Future<V> {
-    private static final CancellationException CANCELLED =
-        new CancellationException();
 
     private final AsynchronousChannel channel;
     private final CompletionHandler<V,? super A> handler;
@@ -180,7 +178,7 @@
                 latch.await();
         }
         if (exc != null) {
-            if (exc == CANCELLED)
+            if (exc instanceof CancellationException)
                 throw new CancellationException();
             throw new ExecutionException(exc);
         }
@@ -197,7 +195,7 @@
                 if (!latch.await(timeout, unit)) throw new TimeoutException();
         }
         if (exc != null) {
-            if (exc == CANCELLED)
+            if (exc instanceof CancellationException)
                 throw new CancellationException();
             throw new ExecutionException(exc);
         }
@@ -205,7 +203,7 @@
     }
 
     Throwable exception() {
-        return (exc != CANCELLED) ? exc : null;
+        return (exc instanceof CancellationException) ? null : exc;
     }
 
     V value() {
@@ -214,7 +212,7 @@
 
     @Override
     public boolean isCancelled() {
-        return (exc == CANCELLED);
+        return (exc instanceof CancellationException);
     }
 
     @Override
@@ -233,7 +231,7 @@
                 ((Cancellable)channel()).onCancel(this);
 
             // set result and cancel timer
-            exc = CANCELLED;
+            exc = new CancellationException();
             haveResult = true;
             if (timeoutTask != null)
                 timeoutTask.cancel(false);
--- a/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/src/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +113,6 @@
 
         try {
             Cipher cipher = JsseJce.getCipher(JsseJce.CIPHER_RSA_PKCS1);
-            // Cannot generate key here, please don't use Cipher.UNWRAP_MODE!
             cipher.init(Cipher.UNWRAP_MODE, privateKey,
                     new TlsRsaPremasterSecretParameterSpec(
                             maxVersion.v, currentVersion.v),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/EvalInterfaceStatic.sh	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,126 @@
+#!/bin/sh
+
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please 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 8031195
+#  @summary JDB allows evaluation of calls to static interface methods
+#  @author Jaroslav Bachorik
+#
+#  @run shell/timeout=300 EvalInterfaceStatic.sh
+
+#  The test exercises the ability to invoke static methods on interfaces.
+#  Static interface methods are a new feature added in JDK8.
+#
+#  The test makes sure that it is, at all, possible to invoke an interface
+#  static method and that the static methods are not inherited by extending
+#  interfaces.
+
+classname=EvalStaticInterfaces
+
+createJavaFile()
+{
+    cat <<EOF > $classname.java.1
+public interface $classname {
+    static String staticMethod1() {
+        return "base:staticMethod1";
+    }
+
+    static String staticMethod2() {
+        return "base:staticMethod2";
+    }
+
+    public static void main(String[] args) {
+        // prove that these work
+        System.out.println("base staticMethod1(): " + $classname.staticMethod1());
+        System.out.println("base staticMethod2(): " + $classname.staticMethod2());
+        System.out.println("overridden staticMethod2(): " + Extended$classname.staticMethod2());
+        System.out.println("base staticMethod3(): " + Extended$classname.staticMethod3());
+
+        gus();
+    }
+
+    static void gus() {
+        int x = 0;             // @1 breakpoint
+    }
+}
+
+interface Extended$classname extends $classname {
+    static String staticMethod2() {
+        return "extended:staticMethod2";
+    }
+
+    static String staticMethod3() {
+        return "extended:staticMethod3";
+    }
+}
+
+
+
+EOF
+}
+
+# drive jdb by sending cmds to it and examining its output
+dojdbCmds()
+{
+    setBkpts @1
+    runToBkpt @1
+
+    cmd eval "$classname.staticMethod1()"
+    jdbFailIfNotPresent "base:staticMethod1" 2
+
+    cmd eval "$classname.staticMethod2()"
+    jdbFailIfNotPresent "base:staticMethod2" 2
+
+    cmd eval "Extended$classname.staticMethod1()"
+    jdbFailIfPresent "base:staticMethod1" 2
+
+    cmd eval "Extended$classname.staticMethod2()"
+    jdbFailIfNotPresent "extended:staticMethod2" 2
+
+    cmd eval "Extended$classname.staticMethod3()"
+    jdbFailIfNotPresent "extended:staticMethod3" 2
+}
+
+
+mysetup()
+{
+    if [ -z "$TESTSRC" ] ; then
+        TESTSRC=.
+    fi
+
+    for ii in . $TESTSRC $TESTSRC/.. ; do
+        if [ -r "$ii/ShellScaffold.sh" ] ; then
+            . $ii/ShellScaffold.sh
+            break
+        fi
+    done
+}
+
+# You could replace this next line with the contents
+# of ShellScaffold.sh and this script will run just the same.
+mysetup
+
+runit
+pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/jdi/InterfaceMethodsTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,422 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8031195
+ *  @summary  JDI: Add support for static and default methods in interfaces
+ *
+ *  @run build TestScaffold VMConnection TargetListener TargetAdapter
+ *  @run build InterfaceMethodsTest
+ *  @run main InterfaceMethodsTest
+ */
+import com.sun.jdi.*;
+import com.sun.jdi.event.*;
+import java.util.Collections;
+
+public class InterfaceMethodsTest extends TestScaffold {
+    private static final int RESULT_A = 1;
+    private static final int RESULT_B = 1;
+    private static final int RESULT_TARGET = 1;
+    static interface InterfaceA {
+        static int staticMethodA() {
+            System.out.println("-InterfaceA: static interface method A-");
+            return RESULT_A;
+        }
+        static int staticMethodB() {
+            System.out.println("-InterfaceA: static interface method B-");
+            return RESULT_A;
+        }
+        default int defaultMethodA() {
+            System.out.println("-InterfaceA: default interface method A-");
+            return RESULT_A;
+        }
+        default int defaultMethodB() {
+            System.out.println("-InterfaceA: default interface method B-");
+            return RESULT_A;
+        }
+        default int defaultMethodC() {
+            System.out.println("-InterfaceA: default interface method C-");
+            return RESULT_A;
+        }
+
+        int implementedMethod();
+    }
+
+    static interface InterfaceB extends InterfaceA {
+        @Override
+        default int defaultMethodC() {
+            System.out.println("-InterfaceB: overridden default interface method C-");
+            return RESULT_B;
+        }
+        default int defaultMethodD() {
+            System.out.println("-InterfaceB: default interface method D-");
+            return RESULT_B;
+        }
+
+        static int staticMethodB() {
+            System.out.println("-InterfaceB: overridden static interface method B-");
+            return RESULT_B;
+        }
+
+        static int staticMethodC() {
+            System.out.println("-InterfaceB: static interface method C-");
+            return RESULT_B;
+        }
+    }
+
+    final static class TargetClass implements InterfaceB {
+        public int classMethod() {
+            System.out.println("-TargetClass: class only method-");
+            return RESULT_TARGET;
+        }
+
+        @Override
+        public int implementedMethod() {
+            System.out.println("-TargetClass: implemented non-default interface method-");
+            return RESULT_TARGET;
+        }
+
+        @Override
+        public int defaultMethodB() {
+            System.out.println("-TargetClass: overridden default interface method D");
+
+            return RESULT_TARGET;
+        }
+
+        public static void main(String[] args) {
+            TargetClass tc = new TargetClass();
+            tc.doTests(tc);
+        }
+
+        private void doTests(TargetClass ref) {
+            // break
+        }
+    }
+
+    public InterfaceMethodsTest(String[] args) {
+        super(args);
+    }
+
+    public static void main(String[] args) throws Exception {
+        new InterfaceMethodsTest(args).startTests();
+    }
+
+    private static final String TEST_CLASS_NAME = InterfaceMethodsTest.class.getName().replace('.', '/');
+    private static final String TARGET_CLASS_NAME = TargetClass.class.getName().replace('.', '/');
+    private static final String INTERFACEA_NAME = InterfaceA.class.getName().replace('.', '/');
+    private static final String INTERFACEB_NAME = InterfaceB.class.getName().replace('.', '/');
+
+    protected void runTests() throws Exception {
+        /*
+         * Get to the top of main()
+         * to determine targetClass and mainThread
+         */
+        BreakpointEvent bpe = startToMain(TARGET_CLASS_NAME);
+
+        bpe = resumeTo(TARGET_CLASS_NAME, "doTests", "(L" + TARGET_CLASS_NAME +";)V");
+
+        mainThread = bpe.thread();
+
+        StackFrame frame = mainThread.frame(0);
+        ObjectReference thisObject = frame.thisObject();
+        ObjectReference ref = (ObjectReference)frame.getArgumentValues().get(0);
+
+        ReferenceType targetClass = bpe.location().declaringType();
+        testImplementationClass(targetClass, thisObject);
+
+        testInterfaceA(ref);
+
+        testInterfaceB(ref);
+
+        /*
+         * resume the target listening for events
+         */
+        listenUntilVMDisconnect();
+
+        /*
+         * deal with results of test
+         * if anything has called failure("foo") testFailed will be true
+         */
+        if (!testFailed) {
+            println("InterfaceMethodsTest: passed");
+        } else {
+            throw new Exception("InterfaceMethodsTest: failed");
+        }
+    }
+
+    private void testInterfaceA(ObjectReference ref) {
+        // Test non-virtual calls on InterfaceA
+
+        ReferenceType ifaceClass = (ReferenceType)vm().classesByName(INTERFACEA_NAME).get(0);
+        /* Default method calls */
+
+        // invoke the InterfaceA's "defaultMethodA"
+        testInvokePos(ifaceClass, ref, "defaultMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the InterfaceA's "defaultMethodB"
+        testInvokePos(ifaceClass, ref, "defaultMethodB", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the InterfaceA's "defaultMethodC"
+        testInvokePos(ifaceClass, ref, "defaultMethodC", "()I", vm().mirrorOf(RESULT_A));
+
+        // "defaultMethodD" from InterfaceB is not accessible from here
+        testInvokeNeg(ifaceClass, ref, "defaultMethodD", "()I", vm().mirrorOf(RESULT_B),
+                "Attempted to invoke non-existing method");
+
+        // trying to invoke the asbtract method "implementedMethod"
+        testInvokeNeg(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(TARGET_CLASS_NAME),
+                "Invocation of non-default methods is not supported");
+
+
+        /* Static method calls */
+
+        // invoke interface static method A
+        testInvokePos(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // try to invoke static method A on the instance
+        testInvokePos(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke interface static method B
+        testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
+
+        // try to invoke static method B on the instance
+        testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_A));
+    }
+
+    private void testInterfaceB(ObjectReference ref) {
+        // Test non-virtual calls on InterfaceB
+        ReferenceType ifaceClass = (ReferenceType)vm().classesByName(INTERFACEB_NAME).get(0);
+
+        /* Default method calls */
+
+        // invoke the inherited "defaultMethodA"
+        testInvokePos(ifaceClass, ref, "defaultMethodA", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the inherited "defaultMethodB"
+        testInvokePos(ifaceClass, ref, "defaultMethodB", "()I", vm().mirrorOf(RESULT_A));
+
+        // invoke the inherited and overridden "defaultMethodC"
+        testInvokePos(ifaceClass, ref, "defaultMethodC", "()I", vm().mirrorOf(RESULT_B));
+
+        // invoke InterfaceB only "defaultMethodD"
+        testInvokePos(ifaceClass, ref, "defaultMethodD", "()I", vm().mirrorOf(RESULT_B));
+
+        // "implementedMethod" is not present in InterfaceB
+        testInvokeNeg(ifaceClass, ref, "implementedMethod", "()I", vm().mirrorOf(RESULT_TARGET),
+                "Invocation of non-default methods is not supported");
+
+
+        /* Static method calls*/
+
+        // "staticMethodA" must not be inherited by InterfaceB
+        testInvokeNeg(ifaceClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        // however it is possible to call "staticMethodA" on the actual instance
+        testInvokeNeg(ifaceClass, ref, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        // "staticMethodB" is overridden in InterfaceB
+        testInvokePos(ifaceClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
+
+        // the instance invokes the overriden form of "staticMethodB" from InterfaceB
+        testInvokePos(ifaceClass, ref, "staticMethodB", "()I", vm().mirrorOf(RESULT_B));
+
+        // "staticMethodC" is present only in InterfaceB
+        testInvokePos(ifaceClass, null, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
+
+        // "staticMethodC" should be reachable from the instance too
+        testInvokePos(ifaceClass, ref, "staticMethodC", "()I", vm().mirrorOf(RESULT_B));
+    }
+
+    private void testImplementationClass(ReferenceType targetClass, ObjectReference thisObject) {
+        // Test invocations on the implementation object
+
+        /* Default method calls */
+
+        // "defaultMethodA" is accessible and not overridden
+        testInvokePos(targetClass, thisObject, "defaultMethodA", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // "defaultMethodB" is accessible and overridden in TargetClass
+        testInvokePos(targetClass, thisObject, "defaultMethodB", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // "defaultMethodC" is accessible and overridden in InterfaceB
+        testInvokePos(targetClass, thisObject, "defaultMethodC", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // "defaultMethodD" is accessible
+        testInvokePos(targetClass, thisObject, "defaultMethodD", "()I", vm().mirrorOf(RESULT_TARGET));
+
+
+        /* Non-default instance method calls */
+
+        // "classMethod" declared in TargetClass is accessible
+        testInvokePos(targetClass, thisObject, "classMethod", "()I", vm().mirrorOf(RESULT_TARGET));
+
+        // the abstract "implementedMethod" has been implemented in TargetClass
+        testInvokePos(targetClass, thisObject, "implementedMethod", "()I", vm().mirrorOf(RESULT_TARGET));
+
+
+        /* Static method calls */
+
+        // All the static methods declared by the interfaces are not reachable from the instance of the implementor class
+        testInvokeNeg(targetClass, thisObject, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, thisObject, "staticMethodB", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, thisObject, "staticMethodC", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+
+        // All the static methods declared by the interfaces are not reachable through the implementor class
+        testInvokeNeg(targetClass, null, "staticMethodA", "()I", vm().mirrorOf(RESULT_A),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, null, "staticMethodB", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+
+        testInvokeNeg(targetClass, null, "staticMethodC", "()I", vm().mirrorOf(RESULT_B),
+                "Static interface methods are not inheritable");
+    }
+
+    private void testInvokePos(ReferenceType targetClass, ObjectReference ref, String methodName,
+                               String methodSig, Value value) {
+        logInvocation(ref, methodName, methodSig, targetClass);
+        try {
+            invoke(targetClass, ref, methodName, methodSig, value);
+            System.err.println("--- PASSED");
+        } catch (Exception e) {
+            System.err.println("--- FAILED");
+            failure("FAILED: Invocation failed with error message " + e.getLocalizedMessage());
+        }
+    }
+
+    private void testInvokeNeg(ReferenceType targetClass, ObjectReference ref, String methodName,
+                               String methodSig, Value value, String msg) {
+        logInvocation(ref, methodName, methodSig, targetClass);
+        try {
+            invoke(targetClass, ref, methodName, methodSig, value);
+            System.err.println("--- FAILED");
+            failure("FAILED: " + msg);
+        } catch (Exception e) {
+            System.err.println("--- PASSED");
+
+        }
+    }
+
+    private void invoke(ReferenceType targetClass, ObjectReference ref, String methodName,
+                        String methodSig, Value value)
+    throws Exception {
+        Method method = getMethod(targetClass, methodName, methodSig);
+        if (method == null) {
+            throw new Exception("Can't find method: " + methodName  + " for class = " + targetClass);
+        }
+
+        println("Invoking " + (method.isAbstract() ? "abstract " : " ") + "method: " + method);
+
+        Value returnValue = null;
+        if (ref != null) {
+            returnValue = invokeInstance(ref, method);
+        } else {
+            returnValue = invokeStatic(targetClass, method);
+        }
+
+        println("        return val = " + returnValue);
+        // It has to be the same value as what we passed in!
+        if (returnValue.equals(value)) {
+            println("         " + method.name() + " return value matches: "
+                    + value);
+        } else {
+            if (value != null) {
+                throw new Exception(method.name() + " returned: " + returnValue +
+                                    " expected: " + value );
+            } else {
+                println("         " + method.name() + " return value : " + returnValue);
+            }
+
+        }
+    }
+
+    private Value invokeInstance(ObjectReference ref, Method method) throws Exception {
+        return ref.invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
+    }
+
+    private Value invokeStatic(ReferenceType refType, Method method) throws Exception {
+        if (refType instanceof ClassType) {
+            return ((ClassType)refType).invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
+        } else {
+            return ((InterfaceType)refType).invokeMethod(mainThread, method, Collections.emptyList(), ObjectReference.INVOKE_NONVIRTUAL);
+        }
+    }
+
+    private Method getMethod(ReferenceType rt, String name, String signature) {
+        if (rt == null) return null;
+        Method m = findMethod(rt, name, signature);
+        if (m == null) {
+            if (rt instanceof ClassType) {
+                for (Object ifc : ((ClassType)rt).interfaces()) {
+                    m = getMethod((ReferenceType)ifc, name, signature);
+                    if (m != null) {
+                        break;
+                    }
+                }
+                if (m == null) {
+                    m = getMethod(((ClassType)rt).superclass(), name, signature);
+                } else {
+                    if (m.isStatic()) {
+                        // interface static methods are not inherited
+                        m = null;
+                    }
+                }
+            } else if (rt instanceof InterfaceType) {
+                for(Object ifc : ((InterfaceType)rt).superinterfaces()) {
+                    m = getMethod((ReferenceType)ifc, name, signature);
+                    if (m != null) {
+                        if (m.isStatic()) {
+                            // interface static methods are not inherited
+                            m = null;
+                        }
+                        break;
+                    }
+                }
+            }
+        }
+
+        return m;
+    }
+
+    private void logInvocation(ObjectReference ref, String methodName, String methodSig, ReferenceType targetClass) {
+        if (ref != null) {
+            System.err.println("Invoking: " + ref.referenceType().name() + "." +
+                    methodName + methodSig + " with target of type " +
+                    targetClass.name());
+        } else {
+            System.err.println("Invoking static : " + targetClass.name() + "." +
+                    methodName + methodSig);
+        }
+    }
+}
+
+
+
--- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java	Mon May 05 12:49:13 2014 -0700
@@ -98,13 +98,13 @@
             monitorProxy.start();
 
             final int initGetCount = observedProxy.getGetCount();
-            int getCount = initGetCount;
-            for (int i = 0; i < 500; i++) { // 500 * 10 = 5 seconds
-                getCount = observedProxy.getGetCount();
-                if (getCount != initGetCount)
-                    break;
-                Thread.sleep(10);
-            }
+            int getCount;
+            System.out.println("Checking GetCount, possible deadlock if timeout.");
+            do { // 8038322. Until timeout of testing harness
+                Thread.sleep(200);
+            } while ((getCount=observedProxy.getGetCount()) == initGetCount);
+            System.out.println("Done!");
+
             if (getCount <= initGetCount)
                 throw new Exception("Test failed: presumable deadlock");
             // This won't show up as a deadlock in CTRL-\ or in
@@ -131,10 +131,11 @@
                 };
                 mbs.addNotificationListener(monitorName, listener, null, null);
                 observedProxy.setThing(1000);
-                for (int i = 0; i < 500 && notifCount.get() == 0; i++)
-                    Thread.sleep(10);
-                if (notifCount.get() == 0)
-                    throw new Exception("Test failed: presumable deadlock");
+                System.out.println("Waiting notifCount.get() != 0, possible deadlock if timeout.");
+                do {
+                    Thread.sleep(200);
+                } while(notifCount.get() == 0); // 8038322. Until timeout of testing harness
+                System.out.println("Done");
             }
 
         }
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java	Mon May 05 12:49:13 2014 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184
+ * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
@@ -80,9 +80,10 @@
     private static KeyInfoFactory kifac;
     private static DocumentBuilder db;
     private static CanonicalizationMethod withoutComments;
-    private static SignatureMethod dsaSha1, rsaSha1, rsaSha256, rsaSha384, rsaSha512;
+    private static SignatureMethod dsaSha1, dsaSha256, rsaSha1,
+                                   rsaSha256, rsaSha384, rsaSha512;
     private static DigestMethod sha1, sha256, sha384, sha512;
-    private static KeyInfo dsa, rsa, rsa1024;
+    private static KeyInfo dsa1024, dsa2048, rsa, rsa1024;
     private static KeySelector kvks = new KeySelectors.KeyValueKeySelector();
     private static KeySelector sks;
     private static Key signingKey;
@@ -106,10 +107,13 @@
         "http://www.w3.org/TR/xml-stylesheet";
     private final static String STYLESHEET_B64 =
         "http://www.w3.org/Signature/2002/04/xml-stylesheet.b64";
+    private final static String DSA_SHA256 =
+        "http://www.w3.org/2009/xmldsig11#dsa-sha256";
 
     public static void main(String args[]) throws Exception {
         setup();
-        test_create_signature_enveloped_dsa();
+        test_create_signature_enveloped_dsa(1024);
+        test_create_signature_enveloped_dsa(2048);
         test_create_signature_enveloping_b64_dsa();
         test_create_signature_enveloping_dsa();
         test_create_signature_enveloping_hmac_sha1_40();
@@ -157,15 +161,18 @@
         withoutComments = fac.newCanonicalizationMethod
             (CanonicalizationMethod.INCLUSIVE, (C14NMethodParameterSpec)null);
         dsaSha1 = fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null);
+        dsaSha256 = fac.newSignatureMethod(DSA_SHA256, null);
         sha1 = fac.newDigestMethod(DigestMethod.SHA1, null);
         sha256 = fac.newDigestMethod(DigestMethod.SHA256, null);
         sha384 = fac.newDigestMethod
             ("http://www.w3.org/2001/04/xmldsig-more#sha384", null);
         sha512 = fac.newDigestMethod(DigestMethod.SHA512, null);
-        dsa = kifac.newKeyInfo(Collections.singletonList
+        dsa1024 = kifac.newKeyInfo(Collections.singletonList
             (kifac.newKeyValue(validatingKey)));
+        dsa2048 = kifac.newKeyInfo(Collections.singletonList
+            (kifac.newKeyValue(getPublicKey("DSA", 2048))));
         rsa = kifac.newKeyInfo(Collections.singletonList
-            (kifac.newKeyValue(getPublicKey("RSA"))));
+            (kifac.newKeyValue(getPublicKey("RSA", 512))));
         rsa1024 = kifac.newKeyInfo(Collections.singletonList
             (kifac.newKeyValue(getPublicKey("RSA", 1024))));
         rsaSha1 = fac.newSignatureMethod(SignatureMethod.RSA_SHA1, null);
@@ -180,11 +187,25 @@
         httpUd = new HttpURIDereferencer();
     }
 
-    static void test_create_signature_enveloped_dsa() throws Exception {
-        System.out.println("* Generating signature-enveloped-dsa.xml");
+    static void test_create_signature_enveloped_dsa(int size) throws Exception {
+        System.out.println("* Generating signature-enveloped-dsa-"
+                           + size + ".xml");
+        SignatureMethod sm = null;
+        KeyInfo ki = null;
+        Key privKey;
+        if (size == 1024) {
+            sm = dsaSha1;
+            ki = dsa1024;
+            privKey = signingKey;
+        } else if (size == 2048) {
+            sm = dsaSha256;
+            ki = dsa2048;
+            privKey = getPrivateKey("DSA", 2048);
+        } else throw new RuntimeException("unsupported keysize:" + size);
+
         // create SignedInfo
         SignedInfo si = fac.newSignedInfo
-            (withoutComments, dsaSha1, Collections.singletonList
+            (withoutComments, sm, Collections.singletonList
                 (fac.newReference
                     ("", sha1, Collections.singletonList
                         (fac.newTransform(Transform.ENVELOPED,
@@ -192,7 +213,7 @@
                  null, null)));
 
         // create XMLSignature
-        XMLSignature sig = fac.newXMLSignature(si, dsa);
+        XMLSignature sig = fac.newXMLSignature(si, ki);
 
         Document doc = db.newDocument();
         Element envelope = doc.createElementNS
@@ -201,12 +222,12 @@
             "xmlns", "http://example.org/envelope");
         doc.appendChild(envelope);
 
-        DOMSignContext dsc = new DOMSignContext(signingKey, envelope);
+        DOMSignContext dsc = new DOMSignContext(privKey, envelope);
 
         sig.sign(dsc);
-//      StringWriter sw = new StringWriter();
-//      dumpDocument(doc, sw);
-//      System.out.println(sw.toString());
+//        StringWriter sw = new StringWriter();
+//        dumpDocument(doc, sw);
+//        System.out.println(sw.toString());
 
         DOMValidateContext dvc = new DOMValidateContext
             (kvks, envelope.getFirstChild());
@@ -226,21 +247,21 @@
     static void test_create_signature_enveloping_b64_dsa() throws Exception {
         System.out.println("* Generating signature-enveloping-b64-dsa.xml");
         test_create_signature_enveloping
-            (sha1, dsaSha1, dsa, signingKey, kvks, true);
+            (sha1, dsaSha1, dsa1024, signingKey, kvks, true);
         System.out.println();
     }
 
     static void test_create_signature_enveloping_dsa() throws Exception {
         System.out.println("* Generating signature-enveloping-dsa.xml");
         test_create_signature_enveloping
-            (sha1, dsaSha1, dsa, signingKey, kvks, false);
+            (sha1, dsaSha1, dsa1024, signingKey, kvks, false);
         System.out.println();
     }
 
     static void test_create_signature_enveloping_sha256_dsa() throws Exception {
         System.out.println("* Generating signature-enveloping-sha256-dsa.xml");
         test_create_signature_enveloping
-            (sha256, dsaSha1, dsa, signingKey, kvks, false);
+            (sha256, dsaSha1, dsa1024, signingKey, kvks, false);
         System.out.println();
     }
 
@@ -293,7 +314,7 @@
     static void test_create_signature_enveloping_rsa() throws Exception {
         System.out.println("* Generating signature-enveloping-rsa.xml");
         test_create_signature_enveloping(sha1, rsaSha1, rsa,
-            getPrivateKey("RSA"), kvks, false);
+            getPrivateKey("RSA", 512), kvks, false);
         System.out.println();
     }
 
@@ -301,7 +322,7 @@
         throws Exception {
         System.out.println("* Generating signature-enveloping-sha384-rsa_sha256.xml");
         test_create_signature_enveloping(sha384, rsaSha256, rsa,
-            getPrivateKey("RSA"), kvks, false);
+            getPrivateKey("RSA", 512), kvks, false);
         System.out.println();
     }
 
@@ -323,13 +344,13 @@
 
     static void test_create_signature_external_b64_dsa() throws Exception {
         System.out.println("* Generating signature-external-b64-dsa.xml");
-        test_create_signature_external(dsaSha1, dsa, signingKey, kvks, true);
+        test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, true);
         System.out.println();
     }
 
     static void test_create_signature_external_dsa() throws Exception {
         System.out.println("* Generating signature-external-dsa.xml");
-        test_create_signature_external(dsaSha1, dsa, signingKey, kvks, false);
+        test_create_signature_external(dsaSha1, dsa1024, signingKey, kvks, false);
         System.out.println();
     }
 
@@ -441,7 +462,7 @@
 
         // create XMLSignature
         XMLSignature sig = fac.newXMLSignature(si, rsa, objs, "signature", null);
-        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
 
         sig.sign(dsc);
 
@@ -487,7 +508,7 @@
         XMLSignature sig = fac.newXMLSignature(si, rsa,
                                                Collections.singletonList(obj),
                                                "signature", null);
-        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
         dsc.setIdAttributeNS(nc, null, "Id");
 
         sig.sign(dsc);
@@ -530,7 +551,7 @@
         XMLSignature sig = fac.newXMLSignature(si, rsa,
                                                Collections.singletonList(obj),
                                                "signature", null);
-        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA"), doc);
+        DOMSignContext dsc = new DOMSignContext(getPrivateKey("RSA", 512), doc);
         sig.sign(dsc);
     }
 
@@ -1116,6 +1137,16 @@
         "90670890367185141189796";
     private static final String DSA_X =
         "0527140396812450214498055937934275626078768840117";
+    private static final String DSA_2048_Y =
+        "15119007057343785981993995134621348945077524760182795513668325877793414638620983617627033248732235626178802906346261435991040697338468329634416089753032362617771631199351767336660070462291411472735835843440140283101463231807789628656218830720378705090795271104661936237385140354825159080766174663596286149653433914842868551355716015585570827642835307073681358328172009941968323702291677280809277843998510864653406122348712345584706761165794179850728091522094227603562280855104749858249588234915206290448353957550635709520273178475097150818955098638774564910092913714625772708285992586894795017709678223469405896699928";
+    private static final String DSA_2048_P =
+        "18111848663142005571178770624881214696591339256823507023544605891411707081617152319519180201250440615163700426054396403795303435564101919053459832890139496933938670005799610981765220283775567361483662648340339405220348871308593627647076689407931875483406244310337925809427432681864623551598136302441690546585427193224254314088256212718983105131138772434658820375111735710449331518776858786793875865418124429269409118756812841019074631004956409706877081612616347900606555802111224022921017725537417047242635829949739109274666495826205002104010355456981211025738812433088757102520562459649777989718122219159982614304359";
+    private static final String DSA_2048_Q =
+        "19689526866605154788513693571065914024068069442724893395618704484701";
+    private static final String DSA_2048_G =
+        "2859278237642201956931085611015389087970918161297522023542900348087718063098423976428252369340967506010054236052095950169272612831491902295835660747775572934757474194739347115870723217560530672532404847508798651915566434553729839971841903983916294692452760249019857108409189016993380919900231322610083060784269299257074905043636029708121288037909739559605347853174853410208334242027740275688698461842637641566056165699733710043802697192696426360843173620679214131951400148855611740858610821913573088059404459364892373027492936037789337011875710759208498486908611261954026964574111219599568903257472567764789616958430";
+    private static final String DSA_2048_X =
+        "14562787764977288900757387442281559936279834964901963465277698843172";
     private static final String RSA_MOD =
         "010800185049102889923150759252557522305032794699952150943573164381" +
         "936603255999071981574575044810461362008102247767482738822150129277" +
@@ -1138,43 +1169,48 @@
         "204903524890556839550490384015324575598723478554854070823335021842" +
         "210112348400928769";
 
-    private static PublicKey getPublicKey(String algo) throws Exception {
-        return getPublicKey(algo, 512);
-    }
-
     private static PublicKey getPublicKey(String algo, int keysize)
         throws Exception {
         KeyFactory kf = KeyFactory.getInstance(algo);
         KeySpec kspec;
         if (algo.equalsIgnoreCase("DSA")) {
-            kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
-                                         new BigInteger(DSA_P),
-                                         new BigInteger(DSA_Q),
-                                         new BigInteger(DSA_G));
+            if (keysize == 1024) {
+                kspec = new DSAPublicKeySpec(new BigInteger(DSA_Y),
+                                             new BigInteger(DSA_P),
+                                             new BigInteger(DSA_Q),
+                                             new BigInteger(DSA_G));
+            } else if (keysize == 2048) {
+                kspec = new DSAPublicKeySpec(new BigInteger(DSA_2048_Y),
+                                             new BigInteger(DSA_2048_P),
+                                             new BigInteger(DSA_2048_Q),
+                                             new BigInteger(DSA_2048_G));
+            } else throw new RuntimeException("Unsupported keysize:" + keysize);
         } else if (algo.equalsIgnoreCase("RSA")) {
             if (keysize == 512) {
                 kspec = new RSAPublicKeySpec(new BigInteger(RSA_MOD),
                                              new BigInteger(RSA_PUB));
-            } else {
+            } else if (keysize == 1024) {
                 kspec = new RSAPublicKeySpec(new BigInteger(RSA_1024_MOD),
                                              new BigInteger(RSA_PUB));
-            }
+            } else throw new RuntimeException("Unsupported keysize:" + keysize);
         } else throw new RuntimeException("Unsupported key algorithm " + algo);
         return kf.generatePublic(kspec);
     }
 
-    private static PrivateKey getPrivateKey(String algo) throws Exception {
-        return getPrivateKey(algo, 512);
-    }
-
     private static PrivateKey getPrivateKey(String algo, int keysize)
         throws Exception {
         KeyFactory kf = KeyFactory.getInstance(algo);
         KeySpec kspec;
         if (algo.equalsIgnoreCase("DSA")) {
-            kspec = new DSAPrivateKeySpec
-                (new BigInteger(DSA_X), new BigInteger(DSA_P),
-                 new BigInteger(DSA_Q), new BigInteger(DSA_G));
+            if (keysize == 1024) {
+                kspec = new DSAPrivateKeySpec
+                    (new BigInteger(DSA_X), new BigInteger(DSA_P),
+                     new BigInteger(DSA_Q), new BigInteger(DSA_G));
+            } else if (keysize == 2048) {
+                kspec = new DSAPrivateKeySpec
+                    (new BigInteger(DSA_2048_X), new BigInteger(DSA_2048_P),
+                     new BigInteger(DSA_2048_Q), new BigInteger(DSA_2048_G));
+            } else throw new RuntimeException("Unsupported keysize:" + keysize);
         } else if (algo.equalsIgnoreCase("RSA")) {
             if (keysize == 512) {
                 kspec = new RSAPrivateKeySpec
--- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,8 @@
         //@@@FIXME: this should also work for key types other than DSA/RSA
         static boolean algEquals(String algURI, String algName) {
             if (algName.equalsIgnoreCase("DSA") &&
-                algURI.equals(SignatureMethod.DSA_SHA1)) {
+                algURI.equals(SignatureMethod.DSA_SHA1) ||
+                algURI.equals("http://www.w3.org/2009/xmldsig11#dsa-sha256")) {
                 return true;
             } else if (algName.equalsIgnoreCase("RSA") &&
                 (algURI.equals(SignatureMethod.RSA_SHA1) ||
--- a/jdk/test/tools/launcher/FXLauncherTest.java	Mon May 05 09:41:41 2014 -0700
+++ b/jdk/test/tools/launcher/FXLauncherTest.java	Mon May 05 12:49:13 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8001533 8004547
+ * @bug 8001533 8004547 8035782
  * @summary Test launching FX application with java -jar
  * Test uses main method and blank main method, a jfx app class and an incorrest
  * jfx app class, a main-class for the manifest, a bogus one and none.
@@ -373,6 +373,11 @@
                 System.out.println(tr);
                 throw new Exception("jfxrt.jar is being loaded, it should not be!");
             }
+            if (!tr.notContains("sun.launcher.LauncherHelper$FXHelper")) {
+                System.out.println("testing for extraneous 'sun.launcher.LauncherHelper$FXHelper'");
+                System.out.println(tr);
+                throw new Exception("FXHelper is being loaded, it should not be!");
+            }
             for (String p : APP_PARMS) {
                 if (!tr.contains(p)) {
                     System.err.println("ERROR: Did not find "
--- a/langtools/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -253,3 +253,4 @@
 ea02d24b3f1dd1417132d6587dd38b056cca0be2 jdk9-b08
 2d13524486b46a0f879361fbadf68fe42d02d221 jdk9-b09
 7736a820af6f15cef9a1499f122e40abc83b2fbd jdk9-b10
+f04fccfbd880c819affc3ef33e0083aab9556409 jdk9-b11
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,9 +49,9 @@
 public abstract class AbstractPackageIndexWriter extends HtmlDocletWriter {
 
     /**
-     * Array of Packages to be documented.
+     * A Set of Packages to be documented.
      */
-    protected PackageDoc[] packages;
+    protected SortedSet<PackageDoc> packages;
 
     /**
      * Constructor. Also initializes the packages variable.
@@ -89,12 +89,12 @@
     /**
      * Adds the packages list to the documentation tree.
      *
-     * @param packages an array of packagedoc objects
+     * @param packages a collection of packagedoc objects
      * @param text caption for the table
      * @param tableSummary summary for the table
      * @param body the document tree to which the packages list will be added
      */
-    protected abstract void addPackagesList(PackageDoc[] packages, String text,
+    protected abstract void addPackagesList(Collection<PackageDoc> packages, String text,
             String tableSummary, Content body);
 
     /**
@@ -141,15 +141,14 @@
      * Adds package index contents. Call appropriate methods from
      * the sub-classes. Adds it to the body HtmlTree
      *
-     * @param packages array of packages to be documented
+     * @param packages a collection of packages to be documented
      * @param text string which will be used as the heading
      * @param tableSummary summary for the table
      * @param body the document tree to which the index contents will be added
      */
-    protected void addIndexContents(PackageDoc[] packages, String text,
+    protected void addIndexContents(Collection<PackageDoc> packages, String text,
             String tableSummary, Content body) {
-        if (packages.length > 0) {
-            Arrays.sort(packages);
+        if (!packages.isEmpty()) {
             HtmlTree div = new HtmlTree(HtmlTag.DIV);
             div.addStyle(HtmlStyle.indexHeader);
             addAllClassesLink(div);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -180,7 +180,7 @@
         Map<String,List<ProgramElementDoc>> map = new HashMap<>();
         List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
         if (list != null) {
-            Collections.sort(list);
+            list.sort(Util.makeComparatorForClassUse());
             for (ProgramElementDoc doc : list) {
                 PackageDoc pkg = doc.containingPackage();
                 pkgSet.add(pkg);
@@ -245,7 +245,7 @@
     protected void addClassUse(Content contentTree) throws IOException {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
-        if (configuration.packages.length > 1) {
+        if (configuration.packages.size() > 1) {
             addPackageList(ul);
             addPackageAnnotationList(ul);
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Mon May 05 12:49:13 2014 -0700
@@ -495,15 +495,15 @@
         if (createoverview) {
             topFile = DocPaths.OVERVIEW_SUMMARY;
         } else {
-            if (packages.length == 1 && packages[0].name().equals("")) {
+            if (packages.size() == 1 && packages.first().name().equals("")) {
                 if (root.classes().length > 0) {
                     ClassDoc[] classarr = root.classes();
                     Arrays.sort(classarr);
                     ClassDoc cd = getValidClass(classarr);
                     topFile = DocPath.forClass(cd);
                 }
-            } else {
-                topFile = DocPath.forPackage(packages[0]).resolve(DocPaths.PACKAGE_SUMMARY);
+            } else if (!packages.isEmpty()) {
+                topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY);
             }
         }
     }
@@ -534,7 +534,7 @@
      * packages is more than one. Sets {@link #createoverview} field to true.
      */
     protected void setCreateOverview() {
-        if ((overview || packages.length > 1) && !nooverview) {
+        if ((overview || packages.size() > 1) && !nooverview) {
             createoverview = true;
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/FrameOutputWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
     public FrameOutputWriter(ConfigurationImpl configuration,
                              DocPath filename) throws IOException {
         super(configuration, filename);
-        noOfPackages = configuration.packages.length;
+        noOfPackages = configuration.packages.size();
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -215,22 +215,22 @@
                 if (!configuration.shouldDocumentProfile(profileName))
                     continue;
                 ProfilePackageIndexFrameWriter.generate(configuration, profileName);
-                PackageDoc[] packages = configuration.profilePackages.get(
+                List<PackageDoc> packages = configuration.profilePackages.get(
                         profileName);
                 PackageDoc prev = null, next;
-                for (int j = 0; j < packages.length; j++) {
+                for (int j = 0; j < packages.size(); j++) {
                     // if -nodeprecated option is set and the package is marked as
                     // deprecated, do not generate the profilename-package-summary.html
                     // and profilename-package-frame.html pages for that package.
-                    if (!(configuration.nodeprecated && Util.isDeprecated(packages[j]))) {
-                        ProfilePackageFrameWriter.generate(configuration, packages[j], i);
-                        next = (j + 1 < packages.length
-                                && packages[j + 1].name().length() > 0) ? packages[j + 1] : null;
+                    PackageDoc pkg = packages.get(j);
+                    if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                        ProfilePackageFrameWriter.generate(configuration, pkg, i);
+                        next = getNamedPackage(packages, j + 1);
                         AbstractBuilder profilePackageSummaryBuilder =
                                 configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
-                                packages[j], prev, next, Profile.lookup(i));
+                                pkg, prev, next, Profile.lookup(i));
                         profilePackageSummaryBuilder.build();
-                        prev = packages[j];
+                        prev = pkg;
                     }
                 }
                 nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
@@ -244,35 +244,47 @@
         }
     }
 
+    PackageDoc getNamedPackage(List<PackageDoc> list, int idx) {
+        if (idx < list.size()) {
+            PackageDoc pkg = list.get(idx);
+            if (!pkg.name().isEmpty()) {
+                return pkg;
+            }
+        }
+        return null;
+    }
+
     /**
      * {@inheritDoc}
      */
     protected void generatePackageFiles(ClassTree classtree) throws Exception {
-        PackageDoc[] packages = configuration.packages;
-        if (packages.length > 1) {
+        Set<PackageDoc> packages = configuration.packages;
+        if (packages.size() > 1) {
             PackageIndexFrameWriter.generate(configuration);
         }
+        List<PackageDoc> pList = new ArrayList<>(configuration.packages);
         PackageDoc prev = null, next;
-        for (int i = 0; i < packages.length; i++) {
+        for (int i = 0; i < pList.size(); i++) {
             // if -nodeprecated option is set and the package is marked as
             // deprecated, do not generate the package-summary.html, package-frame.html
             // and package-tree.html pages for that package.
-            if (!(configuration.nodeprecated && Util.isDeprecated(packages[i]))) {
-                PackageFrameWriter.generate(configuration, packages[i]);
-                next = (i + 1 < packages.length &&
-                        packages[i + 1].name().length() > 0) ? packages[i + 1] : null;
+            PackageDoc pkg = pList.get(i);
+            if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                PackageFrameWriter.generate(configuration, pkg);
+                next = getNamedPackage(pList, i + 1);
                 //If the next package is unnamed package, skip 2 ahead if possible
-                next = (i + 2 < packages.length && next == null) ? packages[i + 2] : next;
+                if (next == null)
+                    next = getNamedPackage(pList, i + 2);
                 AbstractBuilder packageSummaryBuilder =
                         configuration.getBuilderFactory().getPackageSummaryBuilder(
-                        packages[i], prev, next);
+                        pkg, prev, next);
                 packageSummaryBuilder.build();
                 if (configuration.createtree) {
                     PackageTreeWriter.generate(configuration,
-                            packages[i], prev, next,
+                            pkg, prev, next,
                             configuration.nodeprecated);
                 }
-                prev = packages[i];
+                prev = pkg;
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -524,9 +524,9 @@
             if (configuration.createoverview) {
                 navList.addContent(getNavLinkContents());
             }
-            if (configuration.packages.length == 1) {
-                navList.addContent(getNavLinkPackage(configuration.packages[0]));
-            } else if (configuration.packages.length > 1) {
+            if (configuration.packages.size() == 1) {
+                navList.addContent(getNavLinkPackage(configuration.packages.first()));
+            } else if (configuration.packages.size() > 1) {
                 navList.addContent(getNavLinkPackage());
             }
             navList.addContent(getNavLinkClass());
@@ -916,7 +916,7 @@
      * @return package name content
      */
     public Content getPackageName(PackageDoc packageDoc) {
-        return packageDoc == null || packageDoc.name().length() == 0 ?
+        return packageDoc == null || packageDoc.name().isEmpty() ?
             defaultPackageLabel :
             getPackageLabel(packageDoc.name());
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 
 package com.sun.tools.doclets.formats.html;
 
-import java.io.*;
+import java.io.IOException;
+import java.util.Collection;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.formats.html.markup.*;
@@ -78,7 +79,7 @@
     /**
      * {@inheritDoc}
      */
-    protected void addPackagesList(PackageDoc[] packages, String text,
+    protected void addPackagesList(Collection<PackageDoc> packages, String text,
             String tableSummary, Content body) {
         Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true,
                 packagesLabel);
@@ -106,7 +107,7 @@
     protected Content getPackage(PackageDoc pd) {
         Content packageLinkContent;
         Content packageLabel;
-        if (pd.name().length() > 0) {
+        if (!pd.name().isEmpty()) {
             packageLabel = getPackageLabel(pd.name());
             packageLinkContent = getHyperLink(pathString(pd,
                      DocPaths.PACKAGE_FRAME), packageLabel, "",
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 +111,8 @@
     protected void addIndex(Content body) {
         for (String groupname : groupList) {
             List<PackageDoc> list = groupPackageMap.get(groupname);
-            if (list != null && list.size() > 0) {
-                addIndexContents(list.toArray(new PackageDoc[list.size()]),
+            if (list != null && !list.isEmpty()) {
+                addIndexContents(list,
                                  groupname, configuration.getText("doclet.Member_Table_Summary",
                                                                   groupname, configuration.getText("doclet.packages")), body);
             }
@@ -146,7 +146,7 @@
     /**
      * {@inheritDoc}
      */
-    protected void addPackagesList(PackageDoc[] packages, String text,
+    protected void addPackagesList(Collection<PackageDoc> packages, String text,
             String tableSummary, Content body) {
         Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, tableSummary,
                 getTableCaption(new RawHtml(text)));
@@ -164,25 +164,23 @@
      * @param packages Packages to which link is to be generated
      * @param tbody the documentation tree to which the list will be added
      */
-    protected void addPackagesList(PackageDoc[] packages, Content tbody) {
-        for (int i = 0; i < packages.length; i++) {
-            if (packages[i] != null && packages[i].name().length() > 0) {
-                if (configuration.nodeprecated && Util.isDeprecated(packages[i]))
-                    continue;
-                Content packageLinkContent = getPackageLink(packages[i],
-                        getPackageName(packages[i]));
-                Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
-                HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
-                tdSummary.addStyle(HtmlStyle.colLast);
-                addSummaryComment(packages[i], tdSummary);
-                HtmlTree tr = HtmlTree.TR(tdPackage);
-                tr.addContent(tdSummary);
-                if (i%2 == 0)
-                    tr.addStyle(HtmlStyle.altColor);
-                else
-                    tr.addStyle(HtmlStyle.rowColor);
-                tbody.addContent(tr);
+    protected void addPackagesList(Collection<PackageDoc> packages, Content tbody) {
+        boolean altColor = true;
+        for (PackageDoc pkg : packages) {
+            if (pkg != null && !pkg.name().isEmpty()) {
+                if (!(configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                    Content packageLinkContent = getPackageLink(pkg, getPackageName(pkg));
+                    Content tdPackage = HtmlTree.TD(HtmlStyle.colFirst, packageLinkContent);
+                    HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
+                    tdSummary.addStyle(HtmlStyle.colLast);
+                    addSummaryComment(pkg, tdSummary);
+                    HtmlTree tr = HtmlTree.TR(tdPackage);
+                    tr.addContent(tdSummary);
+                    tr.addStyle(altColor ? HtmlStyle.altColor : HtmlStyle.rowColor);
+                    tbody.addContent(tr);
+                }
             }
+            altColor = !altColor;
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageTreeWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false,
                 HtmlStyle.title, headContent);
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
-        if (configuration.packages.length > 1) {
+        if (configuration.packages.size() > 1) {
             addLinkToMainTree(div);
         }
         body.addContent(div);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +135,7 @@
     protected void addPackageUse(Content contentTree) throws IOException {
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.addStyle(HtmlStyle.blockList);
-        if (configuration.packages.length > 1) {
+        if (configuration.packages.size() > 1) {
             addPackageList(ul);
         }
         addClassList(ul);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 
 package com.sun.tools.doclets.formats.html;
 
-import java.io.*;
+import java.io.IOException;
+import java.util.List;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.sym.Profiles;
@@ -92,7 +93,7 @@
         Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
         HtmlTree ul = new HtmlTree(HtmlTag.UL);
         ul.setTitle(packagesLabel);
-        PackageDoc[] packages = configuration.profilePackages.get(profileName);
+        List<PackageDoc> packages = configuration.profilePackages.get(profileName);
         for (PackageDoc packageDoc : packages) {
             if ((!(configuration.nodeprecated && Util.isDeprecated(packageDoc)))) {
                 ul.addContent(getPackage(packageDoc, profileName));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TreeWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 
 package com.sun.tools.doclets.formats.html;
 
-import java.io.*;
+import java.io.IOException;
+import java.util.SortedSet;
 
 import com.sun.javadoc.*;
 import com.sun.tools.doclets.formats.html.markup.*;
@@ -51,7 +52,7 @@
     /**
      * Packages in this run.
      */
-    private PackageDoc[] packages;
+    SortedSet<PackageDoc> packages;
 
     /**
      * True if there are no packages specified on the command line,
@@ -67,11 +68,10 @@
      * @param classtree the tree being built.
      */
     public TreeWriter(ConfigurationImpl configuration,
-            DocPath filename, ClassTree classtree)
-    throws IOException {
+            DocPath filename, ClassTree classtree) throws IOException {
         super(configuration, filename, classtree);
         packages = configuration.packages;
-    classesonly = packages.length == 0;
+        classesonly = packages.isEmpty();
     }
 
     /**
@@ -127,7 +127,7 @@
      */
     protected void addPackageTreeLinks(Content contentTree) {
         //Do nothing if only unnamed package is used
-        if (packages.length == 1 && packages[0].name().length() == 0) {
+        if (isUnnamedPackage()) {
             return;
         }
         if (!classesonly) {
@@ -136,21 +136,24 @@
             contentTree.addContent(span);
             HtmlTree ul = new HtmlTree(HtmlTag.UL);
             ul.addStyle(HtmlStyle.horizontal);
-            for (int i = 0; i < packages.length; i++) {
+            int i = 0;
+            for (PackageDoc pkg : packages) {
                 // If the package name length is 0 or if -nodeprecated option
                 // is set and the package is marked as deprecated, do not include
                 // the page in the list of package hierarchies.
-                if (packages[i].name().length() == 0 ||
-                        (configuration.nodeprecated && Util.isDeprecated(packages[i]))) {
+                if (pkg.name().isEmpty() ||
+                        (configuration.nodeprecated && Util.isDeprecated(pkg))) {
+                    i++;
                     continue;
                 }
-                DocPath link = pathString(packages[i], DocPaths.PACKAGE_TREE);
+                DocPath link = pathString(pkg, DocPaths.PACKAGE_TREE);
                 Content li = HtmlTree.LI(getHyperLink(
-                        link, new StringContent(packages[i].name())));
-                if (i < packages.length - 1) {
+                        link, new StringContent(pkg.name())));
+                if (i < packages.size() - 1) {
                     li.addContent(", ");
                 }
                 ul.addContent(li);
+                i++;
             }
             contentTree.addContent(ul);
         }
@@ -168,4 +171,8 @@
         addNavLinks(true, bodyTree);
         return bodyTree;
     }
+
+    private boolean isUnnamedPackage() {
+        return packages.size() == 1 && packages.first().name().isEmpty();
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -289,16 +289,16 @@
     public Profiles profiles;
 
     /**
-     * An map of the profiles to packages.
+     * A map of the profiles to packages.
      */
-    public Map<String,PackageDoc[]> profilePackages;
+    public Map<String, List<PackageDoc>> profilePackages;
 
     /**
-     * An array of the packages specified on the command-line merged
-     * with the array of packages that contain the classes specified on the
-     * command-line.  The array is sorted.
+     * A sorted set of packages specified on the command-line merged with a
+     * collection of packages that contain the classes specified on the
+     * command-line.
      */
-    public PackageDoc[] packages;
+    public SortedSet<PackageDoc> packages;
 
     /**
      * Constructor. Constructs the message retriever with resource file.
@@ -423,7 +423,7 @@
             // For a profile, if there are no packages to be documented, do not add
             // it to profilePackages map.
             if (size > 0)
-                profilePackages.put(p.name, pkgs.toArray(new PackageDoc[pkgs.size()]));
+                profilePackages.put(p.name, pkgs);
             prev = pkgs;
         }
 
@@ -432,14 +432,11 @@
         showProfiles = !prev.isEmpty();
     }
 
-    private void initPackageArray() {
-        Set<PackageDoc> set = new HashSet<>(Arrays.asList(root.specifiedPackages()));
+    private void initPackages() {
+        packages = new TreeSet<>(Arrays.asList(root.specifiedPackages()));
         for (ClassDoc aClass : root.specifiedClasses()) {
-            set.add(aClass.containingPackage());
+            packages.add(aClass.containingPackage());
         }
-        ArrayList<PackageDoc> results = new ArrayList<>(set);
-        Collections.sort(results);
-        packages = results.toArray(new PackageDoc[] {});
     }
 
     /**
@@ -547,7 +544,7 @@
      * @throws DocletAbortException
      */
     public void setOptions() throws Fault {
-        initPackageArray();
+        initPackages();
         setOptions(root.options());
         try {
             initProfiles();
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AbstractBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -29,6 +29,7 @@
 import java.lang.reflect.*;
 import java.util.*;
 
+import com.sun.javadoc.PackageDoc;
 import com.sun.tools.doclets.internal.toolkit.*;
 import com.sun.tools.doclets.internal.toolkit.util.*;
 
@@ -63,7 +64,7 @@
          * efficiency purposes.  We don't want to copy the
          * doc files multiple times for a single package.
          */
-        final Set<String> containingPackagesSeen;
+        final Set<PackageDoc> containingPackagesSeen;
 
         /**
          * Shared parser for the builder XML file
@@ -71,7 +72,7 @@
         final LayoutParser layoutParser;
 
         Context(Configuration configuration,
-                Set<String> containingPackagesSeen,
+                Set<PackageDoc> containingPackagesSeen,
                 LayoutParser layoutParser) {
             this.configuration = configuration;
             this.containingPackagesSeen = containingPackagesSeen;
@@ -89,7 +90,7 @@
      * efficiency purposes.  We don't want to copy the
      * doc files multiple times for a single package.
      */
-    protected final Set<String> containingPackagesSeen;
+    protected final Set<PackageDoc> containingPackagesSeen;
 
     protected final LayoutParser layoutParser;
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -133,14 +133,13 @@
      private void copyDocFiles() {
         PackageDoc containingPackage = annotationTypeDoc.containingPackage();
         if((configuration.packages == null ||
-                Arrays.binarySearch(configuration.packages,
-                                    containingPackage) < 0) &&
-           ! containingPackagesSeen.contains(containingPackage.name())){
+            !configuration.packages.contains(containingPackage) &&
+            !containingPackagesSeen.contains(containingPackage))){
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
             Util.copyDocFiles(configuration, containingPackage);
-            containingPackagesSeen.add(containingPackage.name());
+            containingPackagesSeen.add(containingPackage);
         }
      }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/BuilderFactory.java	Mon May 05 12:49:13 2014 -0700
@@ -68,7 +68,7 @@
         this.configuration = configuration;
         this.writerFactory = configuration.getWriterFactory();
 
-        Set<String> containingPackagesSeen = new HashSet<>();
+        Set<PackageDoc> containingPackagesSeen = new HashSet<>();
         context = new AbstractBuilder.Context(configuration, containingPackagesSeen,
                 LayoutParser.getInstance(configuration));
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -271,14 +271,13 @@
      private void copyDocFiles() {
         PackageDoc containingPackage = classDoc.containingPackage();
         if((configuration.packages == null ||
-                Arrays.binarySearch(configuration.packages,
-                containingPackage) < 0) &&
-                ! containingPackagesSeen.contains(containingPackage.name())){
+            !configuration.packages.contains(containingPackage)) &&
+            ! containingPackagesSeen.contains(containingPackage)){
             //Only copy doc files dir if the containing package is not
             //documented AND if we have not documented a class from the same
             //package already. Otherwise, we are making duplicate copies.
             Util.copyDocFiles(configuration, containingPackage);
-            containingPackagesSeen.add(containingPackage.name());
+            containingPackagesSeen.add(containingPackage);
         }
      }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,8 @@
 
 package com.sun.tools.doclets.internal.toolkit.builders;
 
-import java.io.*;
+import java.io.IOException;
+import java.util.List;
 
 import com.sun.javadoc.*;
 import com.sun.tools.javac.jvm.Profile;
@@ -165,7 +166,7 @@
      *                           be added
      */
     public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
-        PackageDoc[] packages = configuration.profilePackages.get(profile.name);
+        List<PackageDoc> packages = configuration.profilePackages.get(profile.name);
         for (PackageDoc aPackage : packages) {
             this.pkg = aPackage;
             Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
      * @param configuration the current configuration of the doclet.
      */
     private void buildDeprecatedAPIInfo(Configuration configuration) {
-        PackageDoc[] packages = configuration.packages;
+        Set<PackageDoc> packages = configuration.packages;
         for (PackageDoc pkg : packages) {
             if (Util.isDeprecated(pkg)) {
                 getList(PACKAGE).add(pkg);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -175,7 +175,7 @@
      *
      * @param packages Packages specified on the command line.
      */
-    public Map<String,List<PackageDoc>> groupPackages(PackageDoc[] packages) {
+    public Map<String, List<PackageDoc>> groupPackages(Set<PackageDoc> packages) {
         Map<String,List<PackageDoc>> groupPackageMap = new HashMap<>();
         String defaultGroupName =
             (pkgNameGroupMap.isEmpty() && regExpGroupMap.isEmpty())?
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * 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,27 +72,6 @@
     protected final Object[] elements;
 
     /**
-     * A comparator used to sort classes and members.
-     * Note:  Maybe this compare code belongs in the tool?
-     */
-    private class DocComparator implements Comparator<Doc> {
-        public int compare(Doc d1, Doc d2) {
-            String doc1 = d1.name();
-            String doc2 = d2.name();
-            int compareResult;
-            if ((compareResult = doc1.compareToIgnoreCase(doc2)) != 0) {
-                return compareResult;
-            } else if (d1 instanceof ProgramElementDoc && d2 instanceof ProgramElementDoc) {
-                 doc1 = (((ProgramElementDoc) d1).qualifiedName());
-                 doc2 = (((ProgramElementDoc) d2).qualifiedName());
-                 return doc1.compareToIgnoreCase(doc2);
-            } else {
-                return 0;
-            }
-        }
-    }
-
-    /**
      * Constructor. Build the index map.
      *
      * @param configuration the current configuration of the doclet.
@@ -133,7 +112,7 @@
      */
     protected void sortIndexMap() {
         for (List<Doc> docs : indexmap.values()) {
-            Collections.sort(docs, new DocComparator());
+            docs.sort(Util.makeComparatorForIndexUse());
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
+import java.text.Collator;
 import java.util.*;
 import javax.tools.StandardLocation;
 
@@ -49,7 +50,6 @@
  * @author Jamie Ho
  */
 public class Util {
-
     /**
      * Return array of class members whose documentation is to be generated.
      * If the member is deprecated do not include such a member in the
@@ -781,4 +781,163 @@
                 elt.name().contentEquals(ElementType.PARAMETER.name()) ||
                 elt.name().contentEquals(ElementType.TYPE.name());
     }
+
+    /**
+     * A general purpose String comparator, which compares two Strings using a Collator
+     * strength of "SECONDARY", thus providing  optimum case insensitive comparisons in
+     * most Locales.
+     *
+     * @param s1 first String to compare.
+     * @param s2 second String to compare.
+     * @return a negative integer, zero, or a positive integer as the first
+     *         argument is less than, equal to, or greater than the second.
+     */
+    public static int compareStrings(String s1, String s2) {
+        Collator collator = Collator.getInstance();
+        collator.setStrength(Collator.SECONDARY);
+        return collator.compare(s1, s2);
+    }
+
+    /**
+     * A comparator for index file uses, this sorts first on names, then on
+     * parameter types and finally on the fully qualified name.
+     * @return a comparator for index file use
+     */
+    public static Comparator<Doc> makeComparatorForIndexUse() {
+        return new Util.DocComparator<Doc>() {
+            /**
+             * compare two given Doc entities, first sort on name, if
+             * applicable on the method's parameter types, and finally on the
+             * fully qualified name of the entity.
+             *
+             * @param d1 - a Doc element.
+             * @param d2 - a Doc element.
+             * @return a negative integer, zero, or a positive integer as the first
+             *         argument is less than, equal to, or greater than the second.
+             */
+            public int compare(Doc d1, Doc d2) {
+                int result = compareStrings(d1.name(), d2.name());
+                if (result != 0) {
+                    return result;
+                }
+                if (d1 instanceof ExecutableMemberDoc && d2 instanceof ExecutableMemberDoc) {
+                    result = compareExecutableMembers(
+                            (ExecutableMemberDoc) d1,
+                            (ExecutableMemberDoc) d2);
+                    if (result != 0) {
+                        return result;
+                    }
+                }
+                if (d1 instanceof ProgramElementDoc && d2 instanceof ProgramElementDoc) {
+                    return compareProgramElementDoc((ProgramElementDoc)d1, (ProgramElementDoc)d2);
+                }
+                return 0;
+            }
+        };
+    }
+
+    /**
+     * Comparator for ClassUse representations, this sorts on member names,
+     * fully qualified member names and then the parameter types if applicable.
+     * @return a comparator to sort classes and members for class use
+     */
+    public static Comparator<Doc> makeComparatorForClassUse() {
+        return new Util.DocComparator<Doc>() {
+            /**
+             * compare two given Doc entities, first sort on name, and if
+             * applicable on the fully qualified name, and finally if applicable
+             * on the parameter types.
+             * @param d1 - a Doc element.
+             * @param d2 - a Doc element.
+             * @return a negative integer, zero, or a positive integer as the first
+             *         argument is less than, equal to, or greater than the second.
+             */
+            public int compare(Doc d1, Doc d2) {
+                int result = compareStrings(d1.name(), d2.name());
+                if (result != 0) {
+                    return result;
+                }
+                if (d1 instanceof ProgramElementDoc && d2 instanceof ProgramElementDoc) {
+                    result = compareProgramElementDoc((ProgramElementDoc) d1, (ProgramElementDoc) d2);
+                    if (result != 0) {
+                        return result;
+                    }
+                }
+                if (d1 instanceof ExecutableMemberDoc && d2 instanceof ExecutableMemberDoc) {
+                    return compareExecutableMembers((ExecutableMemberDoc)d1, (ExecutableMemberDoc)d2);
+                }
+                return 0;
+            }
+        };
+    }
+
+    /**
+     * A general purpose comparator to sort Doc entities, basically provides the building blocks
+     * for creating specific comparators for an use-case.
+     * @param <T> a Doc entity
+     */
+    static abstract class DocComparator<T extends Doc> implements Comparator<Doc> {
+        /**
+         * compares two parameter arrays by first comparing the length of the arrays, and
+         * then each Type of the parameter in the array.
+         * @param params1 the first parameter array.
+         * @param params2 the first parameter array.
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareParameters(Parameter[] params1, Parameter[] params2) {
+            if (params1.length == 0 && params2.length == 0) {
+                return 0;
+            }
+            int result = Integer.compare(params1.length, params2.length);
+            if (result != 0) {
+                return result;
+            }
+            for (int i = 0; i < params1.length; i++) {
+                result = compareStrings(params1[i].typeName(), params2[i].typeName());
+                if (result != 0) {
+                    return result;
+                }
+            }
+            return 0;
+        }
+
+        /**
+         * Compares two MemberDocs, typically the name of a method,
+         * field or constructor.
+         * @param e1 the first MemberDoc.
+         * @param e2 the second MemberDoc.
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareMembers(MemberDoc e1, MemberDoc e2) {
+            return compareStrings(e1.name(), e2.name());
+        }
+
+        /**
+         * Compares two ExecutableMemberDocs such as methods and constructors,
+         * as well as the parameters the entity might take.
+         * @param m1 the first ExecutableMemberDoc.
+         * @param m2 the second  ExecutableMemberDoc.
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareExecutableMembers(ExecutableMemberDoc m1, ExecutableMemberDoc m2) {
+            int result = compareMembers(m1, m2);
+            if (result == 0)
+                result = compareParameters(m1.parameters(), m2.parameters());
+            return result;
+        }
+
+        /**
+         * Compares the fully qualified names of the entities
+         * @param p1 the first ProgramElementDoc.
+         * @param p2 the first ProgramElementDoc.
+         * @return a negative integer, zero, or a positive integer as the first
+         *         argument is less than, equal to, or greater than the second.
+         */
+        protected int compareProgramElementDoc(ProgramElementDoc p1, ProgramElementDoc p2) {
+            return compareStrings(p1.qualifiedName(), p2.qualifiedName());
+        }
+    }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java	Mon May 05 12:49:13 2014 -0700
@@ -195,6 +195,9 @@
     public boolean allowObjectToPrimitiveCast() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean enforceThisDotInit() {
+        return compareTo(JDK1_7) >= 0;
+    }
     public boolean allowPoly() {
         return compareTo(JDK1_8) >= 0;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Mon May 05 12:49:13 2014 -0700
@@ -383,7 +383,7 @@
     /** A class is an inner class if it it has an enclosing instance class.
      */
     public boolean isInner() {
-        return type.getEnclosingType().hasTag(CLASS);
+        return kind == TYP && type.getEnclosingType().hasTag(CLASS);
     }
 
     /** An inner class has an outer instance if it is not an interface
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Mon May 05 12:49:13 2014 -0700
@@ -43,6 +43,7 @@
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.jvm.ClassReader;
+import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.util.*;
 import static com.sun.tools.javac.code.BoundKind.*;
 import static com.sun.tools.javac.code.Flags.*;
@@ -304,8 +305,8 @@
     }
 
     /**
-     * Is t a subtype of or convertiable via boxing/unboxing
-     * convertions to s?
+     * Is t a subtype of or convertible via boxing/unboxing
+     * conversions to s?
      */
     public boolean isConvertible(Type t, Type s) {
         return isConvertible(t, s, noWarnings);
@@ -1933,6 +1934,17 @@
      * @param sym a symbol
      */
     public Type asSuper(Type t, Symbol sym) {
+        /* Some examples:
+         *
+         * (Enum<E>, Comparable) => Comparable<E>
+         * (c.s.s.d.AttributeTree.ValueKind, Enum) => Enum<c.s.s.d.AttributeTree.ValueKind>
+         * (c.s.s.t.ExpressionTree, c.s.s.t.Tree) => c.s.s.t.Tree
+         * (j.u.List<capture#160 of ? extends c.s.s.d.DocTree>, Iterable) =>
+         *     Iterable<capture#160 of ? extends c.s.s.d.DocTree>
+         */
+        if (sym.type == syms.objectType) { //optimization
+            return syms.objectType;
+        }
         return asSuper.visit(t, sym);
     }
     // where
@@ -3867,9 +3879,11 @@
         }
         return buf.reverse();
     }
+
     public Type capture(Type t) {
-        if (!t.hasTag(CLASS))
+        if (!t.hasTag(CLASS)) {
             return t;
+        }
         if (t.getEnclosingType() != Type.noType) {
             Type capturedEncl = capture(t.getEnclosingType());
             if (capturedEncl != t.getEnclosingType()) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon May 05 12:49:13 2014 -0700
@@ -2141,6 +2141,11 @@
                     cdef.extending = clazz;
                 }
 
+                if (resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK &&
+                    isSerializable(clazztype)) {
+                    localEnv.info.isSerializable = true;
+                }
+
                 attribStat(cdef, localEnv);
 
                 checkLambdaCandidate(tree, cdef.sym, clazztype);
@@ -2296,6 +2301,9 @@
                 resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK;
         try {
             Type currentTarget = pt();
+            if (needsRecovery && isSerializable(currentTarget)) {
+                localEnv.info.isSerializable = true;
+            }
             List<Type> explicitParamTypes = null;
             if (that.paramKind == JCLambda.ParameterKind.EXPLICIT) {
                 //attribute lambda parameters
@@ -2700,17 +2708,20 @@
                 typeargtypes = attribTypes(that.typeargs, localEnv);
             }
 
-            Type target;
             Type desc;
-            if (pt() != Type.recoveryType) {
-                target = targetChecker.visit(pt(), that);
-                desc = types.findDescriptorType(target);
+            Type currentTarget = pt();
+            boolean isTargetSerializable =
+                    resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.CHECK &&
+                    isSerializable(currentTarget);
+            if (currentTarget != Type.recoveryType) {
+                currentTarget = targetChecker.visit(currentTarget, that);
+                desc = types.findDescriptorType(currentTarget);
             } else {
-                target = Type.recoveryType;
+                currentTarget = Type.recoveryType;
                 desc = fallbackDescriptorType(that);
             }
 
-            setFunctionalInfo(localEnv, that, pt(), desc, target, resultInfo.checkContext);
+            setFunctionalInfo(localEnv, that, pt(), desc, currentTarget, resultInfo.checkContext);
             List<Type> argtypes = desc.getParameterTypes();
             Resolve.MethodCheck referenceCheck = rs.resolveMethodCheck;
 
@@ -2761,10 +2772,10 @@
                 JCDiagnostic diag = diags.create(diagKind, log.currentSource(), that,
                         "invalid.mref", Kinds.kindName(that.getMode()), detailsDiag);
 
-                if (targetError && target == Type.recoveryType) {
+                if (targetError && currentTarget == Type.recoveryType) {
                     //a target error doesn't make sense during recovery stage
                     //as we don't know what actual parameter types are
-                    result = that.type = target;
+                    result = that.type = currentTarget;
                     return;
                 } else {
                     if (targetError) {
@@ -2772,7 +2783,7 @@
                     } else {
                         log.report(diag);
                     }
-                    result = that.type = types.createErrorType(target);
+                    result = that.type = types.createErrorType(currentTarget);
                     return;
                 }
             }
@@ -2783,7 +2794,7 @@
 
             if (desc.getReturnType() == Type.recoveryType) {
                 // stop here
-                result = that.type = target;
+                result = that.type = currentTarget;
                 return;
             }
 
@@ -2801,7 +2812,7 @@
                     //static ref with class type-args
                     log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
                             diags.fragment("static.mref.with.targs"));
-                    result = that.type = types.createErrorType(target);
+                    result = that.type = types.createErrorType(currentTarget);
                     return;
                 }
 
@@ -2810,7 +2821,7 @@
                     //no static bound mrefs
                     log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()),
                             diags.fragment("static.bound.mref"));
-                    result = that.type = types.createErrorType(target);
+                    result = that.type = types.createErrorType(currentTarget);
                     return;
                 }
 
@@ -2818,6 +2829,10 @@
                     // Check that super-qualified symbols are not abstract (JLS)
                     rs.checkNonAbstract(that.pos(), that.sym);
                 }
+
+                if (isTargetSerializable) {
+                    chk.checkElemAccessFromSerializableLambda(that);
+                }
             }
 
             ResultInfo checkInfo =
@@ -2849,9 +2864,9 @@
                     resultInfo.checkContext.deferredAttrContext().mode == DeferredAttr.AttrMode.SPECULATIVE;
             checkReferenceCompatible(that, desc, refType, resultInfo.checkContext, isSpeculativeRound);
             if (!isSpeculativeRound) {
-                checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), desc, target);
+                checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), desc, currentTarget);
             }
-            result = check(that, target, VAL, resultInfo);
+            result = check(that, currentTarget, VAL, resultInfo);
         } catch (Types.FunctionDescriptorLookupError ex) {
             JCDiagnostic cause = ex.getDiagnostic();
             resultInfo.checkContext.report(that, cause);
@@ -3191,6 +3206,11 @@
             while (env1.outer != null && !rs.isAccessible(env, env1.enclClass.sym.type, sym))
                 env1 = env1.outer;
         }
+
+        if (env.info.isSerializable) {
+            chk.checkElemAccessFromSerializableLambda(tree);
+        }
+
         result = checkId(tree, env1.enclClass.sym.type, sym, env, resultInfo);
     }
 
@@ -3315,6 +3335,10 @@
             }
         }
 
+        if (env.info.isSerializable) {
+            chk.checkElemAccessFromSerializableLambda(tree);
+        }
+
         env.info.selectSuper = selectSuperPrev;
         result = checkId(tree, site, sym, env, resultInfo);
     }
@@ -4181,6 +4205,11 @@
                     ((c.flags_field & (Flags.ENUM | Flags.COMPOUND)) == 0)) {
                     log.error(env.tree.pos(), "enum.types.not.extensible");
                 }
+
+                if (isSerializable(c.type)) {
+                    env.info.isSerializable = true;
+                }
+
                 attribClassBody(env, c);
 
                 chk.checkDeprecatedAnnotation(env.tree.pos(), c);
@@ -4294,7 +4323,7 @@
 
         // Check for proper use of serialVersionUID
         if (env.info.lint.isEnabled(LintCategory.SERIAL) &&
-            isSerializable(c) &&
+            isSerializable(c.type) &&
             (c.flags() & Flags.ENUM) == 0 &&
             checkForSerial(c)) {
             checkSerialVersionUID(tree, c);
@@ -4334,15 +4363,15 @@
             return null;
         }
 
-        /** check if a class is a subtype of Serializable, if that is available. */
-        private boolean isSerializable(ClassSymbol c) {
+        /** check if a type is a subtype of Serializable, if that is available. */
+        boolean isSerializable(Type t) {
             try {
                 syms.serializableType.complete();
             }
             catch (CompletionFailure e) {
                 return false;
             }
-            return types.isSubtype(c.type, syms.serializableType);
+            return types.isSubtype(t, syms.serializableType);
         }
 
         /** Check that an appropriate serialVersionUID member is defined. */
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/AttrContext.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,10 @@
      */
     boolean selectSuper = false;
 
+    /** Is the current target of lambda expression or method reference serializable?
+     */
+    boolean isSerializable = false;
+
     /** Are arguments to current function applications boxed into an array for varargs?
      */
     Resolve.MethodResolutionPhase pendingResolutionPhase = null;
@@ -89,6 +93,7 @@
         info.enclVar = enclVar;
         info.returnResult = returnResult;
         info.defaultSuperCallSite = defaultSuperCallSite;
+        info.isSerializable = isSerializable;
         return info;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon May 05 12:49:13 2014 -0700
@@ -81,6 +81,7 @@
     private final TreeInfo treeinfo;
     private final JavaFileManager fileManager;
     private final Profile profile;
+    private final boolean warnOnAccessToSensitiveMembers;
 
     // The set of lint options currently in effect. It is initialized
     // from the context, and then is set/reset as needed by Attr as it
@@ -130,6 +131,7 @@
         warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
         suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
         enableSunApiLintControl = options.isSet("enableSunApiLintControl");
+        warnOnAccessToSensitiveMembers = options.isSet("warnOnAccessToSensitiveMembers");
 
         Target target = Target.instance(context);
         syntheticNameChar = target.syntheticNameChar();
@@ -513,6 +515,11 @@
         public DeferredAttrContext deferredAttrContext() {
             return deferredAttr.emptyDeferredAttrContext;
         }
+
+        @Override
+        public String toString() {
+            return "CheckContext: basicHandler";
+        }
     };
 
     /** Check that a given type is assignable to a given proto-type.
@@ -2588,6 +2595,44 @@
         }
     }
 
+    void checkElemAccessFromSerializableLambda(final JCTree tree) {
+        if (warnOnAccessToSensitiveMembers) {
+            Symbol sym = TreeInfo.symbol(tree);
+            if ((sym.kind & (VAR | MTH)) == 0) {
+                return;
+            }
+
+            if (sym.kind == VAR) {
+                if ((sym.flags() & PARAMETER) != 0 ||
+                    sym.isLocal() ||
+                    sym.name == names._this ||
+                    sym.name == names._super) {
+                    return;
+                }
+            }
+
+            if (!types.isSubtype(sym.owner.type, syms.serializableType) &&
+                    isEffectivelyNonPublic(sym)) {
+                log.warning(tree.pos(),
+                        "access.to.sensitive.member.from.serializable.element", sym);
+            }
+        }
+    }
+
+    private boolean isEffectivelyNonPublic(Symbol sym) {
+        if (sym.packge() == syms.rootPackage) {
+            return false;
+        }
+
+        while (sym.kind != Kinds.PCK) {
+            if ((sym.flags() & PUBLIC) == 0) {
+                return true;
+            }
+            sym = sym.owner;
+        }
+        return false;
+    }
+
     /** Report a conflict between a user symbol and a synthetic symbol.
      */
     private void syntheticError(DiagnosticPosition pos, Symbol sym) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Mon May 05 12:49:13 2014 -0700
@@ -109,6 +109,11 @@
                 void complete() {
                     Assert.error("Empty deferred context!");
                 }
+
+                @Override
+                public String toString() {
+                    return "Empty deferred context!";
+                }
             };
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Mon May 05 12:49:13 2014 -0700
@@ -196,6 +196,7 @@
     private final boolean allowImprovedRethrowAnalysis;
     private final boolean allowImprovedCatchAnalysis;
     private final boolean allowEffectivelyFinalInInnerClasses;
+    private final boolean enforceThisDotInit;
 
     public static Flow instance(Context context) {
         Flow instance = context.get(flowKey);
@@ -206,7 +207,7 @@
 
     public void analyzeTree(Env<AttrContext> env, TreeMaker make) {
         new AliveAnalyzer().analyzeTree(env, make);
-        new AssignAnalyzer(log, syms, lint, names).analyzeTree(env);
+        new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit).analyzeTree(env);
         new FlowAnalyzer().analyzeTree(env, make);
         new CaptureAnalyzer().analyzeTree(env, make);
     }
@@ -238,7 +239,7 @@
         //related errors, which will allow for more errors to be detected
         Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log);
         try {
-            new AssignAnalyzer(log, syms, lint, names).analyzeTree(env);
+            new AssignAnalyzer(log, syms, lint, names, enforceThisDotInit).analyzeTree(env);
             LambdaFlowAnalyzer flowAnalyzer = new LambdaFlowAnalyzer();
             flowAnalyzer.analyzeTree(env, that, make);
             return flowAnalyzer.inferredThrownTypes;
@@ -288,6 +289,7 @@
         allowImprovedRethrowAnalysis = source.allowImprovedRethrowAnalysis();
         allowImprovedCatchAnalysis = source.allowImprovedCatchAnalysis();
         allowEffectivelyFinalInInnerClasses = source.allowEffectivelyFinalInInnerClasses();
+        enforceThisDotInit = source.enforceThisDotInit();
     }
 
     /**
@@ -1422,6 +1424,8 @@
 
         protected Names names;
 
+        final boolean enforceThisDotInit;
+
         public static class AbstractAssignPendingExit extends BaseAnalyzer.PendingExit {
 
             final Bits inits;
@@ -1444,7 +1448,7 @@
             }
         }
 
-        public AbstractAssignAnalyzer(Bits inits, Symtab syms, Names names) {
+        public AbstractAssignAnalyzer(Bits inits, Symtab syms, Names names, boolean enforceThisDotInit) {
             this.inits = inits;
             uninits = new Bits();
             uninitsTry = new Bits();
@@ -1454,6 +1458,7 @@
             uninitsWhenFalse = new Bits(true);
             this.syms = syms;
             this.names = names;
+            this.enforceThisDotInit = enforceThisDotInit;
         }
 
         private boolean isInitialConstructor = false;
@@ -2275,12 +2280,34 @@
 
         public void visitAssign(JCAssign tree) {
             JCTree lhs = TreeInfo.skipParens(tree.lhs);
-            if (!(lhs instanceof JCIdent)) {
+            if (!isIdentOrThisDotIdent(lhs))
                 scanExpr(lhs);
-            }
             scanExpr(tree.rhs);
             letInit(lhs);
         }
+        private boolean isIdentOrThisDotIdent(JCTree lhs) {
+            if (lhs.hasTag(IDENT))
+                return true;
+            if (!lhs.hasTag(SELECT))
+                return false;
+
+            JCFieldAccess fa = (JCFieldAccess)lhs;
+            return fa.selected.hasTag(IDENT) &&
+                   ((JCIdent)fa.selected).name == names._this;
+        }
+
+        // check fields accessed through this.<field> are definitely
+        // assigned before reading their value
+        public void visitSelect(JCFieldAccess tree) {
+            super.visitSelect(tree);
+            if (enforceThisDotInit &&
+                tree.selected.hasTag(IDENT) &&
+                ((JCIdent)tree.selected).name == names._this &&
+                tree.sym.kind == VAR)
+            {
+                checkInit(tree.pos(), (VarSymbol)tree.sym);
+            }
+        }
 
         public void visitAssignop(JCAssignOp tree) {
             scanExpr(tree.lhs);
@@ -2410,8 +2437,8 @@
             }
         }
 
-        public AssignAnalyzer(Log log, Symtab syms, Lint lint, Names names) {
-            super(new Bits(), syms, names);
+        public AssignAnalyzer(Log log, Symtab syms, Lint lint, Names names, boolean enforceThisDotInit) {
+            super(new Bits(), syms, names, enforceThisDotInit);
             this.log = log;
             this.lint = lint;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon May 05 12:49:13 2014 -0700
@@ -141,24 +141,24 @@
      * Main inference entry point - instantiate a generic method type
      * using given argument types and (possibly) an expected target-type.
      */
-    public Type instantiateMethod(Env<AttrContext> env,
-                                  List<Type> tvars,
-                                  MethodType mt,
-                                  Attr.ResultInfo resultInfo,
-                                  Symbol msym,
-                                  List<Type> argtypes,
-                                  boolean allowBoxing,
-                                  boolean useVarargs,
-                                  Resolve.MethodResolutionContext resolveContext,
-                                  Warner warn) throws InferenceException {
+    Type instantiateMethod( Env<AttrContext> env,
+                            List<Type> tvars,
+                            MethodType mt,
+                            Attr.ResultInfo resultInfo,
+                            MethodSymbol msym,
+                            List<Type> argtypes,
+                            boolean allowBoxing,
+                            boolean useVarargs,
+                            Resolve.MethodResolutionContext resolveContext,
+                            Warner warn) throws InferenceException {
         //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
-        final InferenceContext inferenceContext = new InferenceContext(tvars);
+        final InferenceContext inferenceContext = new InferenceContext(tvars);  //B0
         inferenceException.clear();
         try {
             DeferredAttr.DeferredAttrContext deferredAttrContext =
                         resolveContext.deferredAttrContext(msym, inferenceContext, resultInfo, warn);
 
-            resolveContext.methodCheck.argumentsAcceptable(env, deferredAttrContext,
+            resolveContext.methodCheck.argumentsAcceptable(env, deferredAttrContext,   //B2
                     argtypes, mt.getParameterTypes(), warn);
 
             if (allowGraphInference &&
@@ -166,7 +166,8 @@
                     !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
                 //inject return constraints earlier
                 checkWithinBounds(inferenceContext, warn); //propagation
-                Type newRestype = generateReturnConstraints(resultInfo, mt, inferenceContext);
+                Type newRestype = generateReturnConstraints(env.tree, resultInfo,  //B3
+                        mt, inferenceContext);
                 mt = (MethodType)types.createMethodTypeWithReturn(mt, newRestype);
                 //propagate outwards if needed
                 if (resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
@@ -192,7 +193,7 @@
                     inferenceContext.restvars().nonEmpty() &&
                     resultInfo != null &&
                     !warn.hasNonSilentLint(Lint.LintCategory.UNCHECKED)) {
-                generateReturnConstraints(resultInfo, mt, inferenceContext);
+                generateReturnConstraints(env.tree, resultInfo, mt, inferenceContext);
                 inferenceContext.solveLegacy(false, warn, LegacyInferenceSteps.EQ_UPPER.steps); //maximizeInst
                 mt = (MethodType)inferenceContext.asInstType(mt);
             }
@@ -209,6 +210,12 @@
             } else {
                 inferenceContext.notifyChange(inferenceContext.boundedVars());
             }
+            if (resultInfo == null) {
+                /* if the is no result info then we can clear the capture types
+                 * cache without affecting any result info check
+                 */
+                inferenceContext.captureTypeCache.clear();
+            }
         }
     }
 
@@ -217,7 +224,7 @@
      * call occurs in a context where a type T is expected, use the expected
      * type to derive more constraints on the generic method inference variables.
      */
-    Type generateReturnConstraints(Attr.ResultInfo resultInfo,
+    Type generateReturnConstraints(JCTree tree, Attr.ResultInfo resultInfo,
             MethodType mt, InferenceContext inferenceContext) {
         InferenceContext rsInfoInfContext = resultInfo.checkContext.inferenceContext();
         Type from = mt.getReturnType();
@@ -231,13 +238,29 @@
                 }
             }
         }
-        Type qtype1 = inferenceContext.asUndetVar(from);
-        Type to = returnConstraintTarget(qtype1, resultInfo.pt);
+        Type qtype = inferenceContext.asUndetVar(from);
+        Type to = resultInfo.pt;
+
+        if (qtype.hasTag(VOID)) {
+            to = syms.voidType;
+        } else if (to.hasTag(NONE)) {
+            to = from.isPrimitive() ? from : syms.objectType;
+        } else if (qtype.hasTag(UNDETVAR)) {
+            if (resultInfo.pt.isReference()) {
+                to = generateReturnConstraintsUndetVarToReference(
+                        tree, (UndetVar)qtype, to, resultInfo, inferenceContext);
+            } else {
+                if (to.isPrimitive()) {
+                    to = generateReturnConstraintsPrimitive(tree, (UndetVar)qtype, to,
+                        resultInfo, inferenceContext);
+                }
+            }
+        }
         Assert.check(allowGraphInference || !rsInfoInfContext.free(to),
                 "legacy inference engine cannot handle constraints on both sides of a subtyping assertion");
         //we need to skip capture?
         Warner retWarn = new Warner();
-        if (!resultInfo.checkContext.compatible(qtype1, rsInfoInfContext.asUndetVar(to), retWarn) ||
+        if (!resultInfo.checkContext.compatible(qtype, rsInfoInfContext.asUndetVar(to), retWarn) ||
                 //unchecked conversion is not allowed in source 7 mode
                 (!allowGraphInference && retWarn.hasLint(Lint.LintCategory.UNCHECKED))) {
             throw inferenceException
@@ -247,30 +270,96 @@
         return from;
     }
 
-    Type returnConstraintTarget(Type from, Type to) {
-        if (from.hasTag(VOID)) {
-            return syms.voidType;
-        } else if (to.hasTag(NONE)) {
-            return from.isPrimitive() ? from : syms.objectType;
-        } else if (from.hasTag(UNDETVAR) && to.isPrimitive()) {
-            if (!allowGraphInference) {
-                //if legacy, just return boxed type
-                return types.boxedClass(to).type;
+    private Type generateReturnConstraintsPrimitive(JCTree tree, UndetVar from,
+            Type to, Attr.ResultInfo resultInfo, InferenceContext inferenceContext) {
+        if (!allowGraphInference) {
+            //if legacy, just return boxed type
+            return types.boxedClass(to).type;
+        }
+        //if graph inference we need to skip conflicting boxed bounds...
+        for (Type t : from.getBounds(InferenceBound.EQ, InferenceBound.UPPER,
+                InferenceBound.LOWER)) {
+            Type boundAsPrimitive = types.unboxedType(t);
+            if (boundAsPrimitive == null || boundAsPrimitive.hasTag(NONE)) {
+                continue;
             }
-            //if graph inference we need to skip conflicting boxed bounds...
-            UndetVar uv = (UndetVar)from;
-            for (Type t : uv.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
-                Type boundAsPrimitive = types.unboxedType(t);
-                if (boundAsPrimitive == null) continue;
-                if (types.isConvertible(boundAsPrimitive, to)) {
-                    //effectively skip return-type constraint generation (compatibility)
-                    return syms.objectType;
+            return generateReferenceToTargetConstraint(tree, from, to,
+                    resultInfo, inferenceContext);
+        }
+        return types.boxedClass(to).type;
+    }
+
+    private Type generateReturnConstraintsUndetVarToReference(JCTree tree,
+            UndetVar from, Type to, Attr.ResultInfo resultInfo,
+            InferenceContext inferenceContext) {
+        Type captureOfTo = types.capture(to);
+        /* T is a reference type, but is not a wildcard-parameterized type, and either
+         */
+        if (captureOfTo == to) { //not a wildcard parameterized type
+            /* i) B2 contains a bound of one of the forms alpha = S or S <: alpha,
+             *      where S is a wildcard-parameterized type, or
+             */
+            for (Type t : from.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
+                Type captureOfBound = types.capture(t);
+                if (captureOfBound != t) {
+                    return generateReferenceToTargetConstraint(tree, from, to,
+                            resultInfo, inferenceContext);
                 }
             }
-            return types.boxedClass(to).type;
-        } else {
-            return to;
+
+            /* ii) B2 contains two bounds of the forms S1 <: alpha and S2 <: alpha,
+             * where S1 and S2 have supertypes that are two different
+             * parameterizations of the same generic class or interface.
+             */
+            for (Type aLowerBound : from.getBounds(InferenceBound.LOWER)) {
+                for (Type anotherLowerBound : from.getBounds(InferenceBound.LOWER)) {
+                    if (aLowerBound != anotherLowerBound &&
+                        commonSuperWithDiffParameterization(aLowerBound, anotherLowerBound)) {
+                        /* self comment check if any lower bound may be and undetVar,
+                         * in that case the result of this call may be a false positive.
+                         * Should this be restricted to non free types?
+                         */
+                        return generateReferenceToTargetConstraint(tree, from, to,
+                            resultInfo, inferenceContext);
+                    }
+                }
+            }
         }
+
+        /* T is a parameterization of a generic class or interface, G,
+         * and B2 contains a bound of one of the forms alpha = S or S <: alpha,
+         * where there exists no type of the form G<...> that is a
+         * supertype of S, but the raw type G is a supertype of S
+         */
+        if (to.isParameterized()) {
+            for (Type t : from.getBounds(InferenceBound.EQ, InferenceBound.LOWER)) {
+                Type sup = types.asSuper(t, to.tsym);
+                if (sup != null && sup.isRaw()) {
+                    return generateReferenceToTargetConstraint(tree, from, to,
+                            resultInfo, inferenceContext);
+                }
+            }
+        }
+        return to;
+    }
+
+    private boolean commonSuperWithDiffParameterization(Type t, Type s) {
+        Pair<Type, Type> supers = getParameterizedSupers(t, s);
+        return (supers != null && !types.isSameType(supers.fst, supers.snd));
+    }
+
+    private Type generateReferenceToTargetConstraint(JCTree tree, UndetVar from,
+            Type to, Attr.ResultInfo resultInfo,
+            InferenceContext inferenceContext) {
+        inferenceContext.solve(List.of(from.qtype), new Warner());
+        Type capturedType = resultInfo.checkContext.inferenceContext()
+                .cachedCapture(tree, from.inst, false);
+        if (types.isConvertible(capturedType,
+                resultInfo.checkContext.inferenceContext().asUndetVar(to))) {
+            //effectively skip additional return-type constraint generation (compatibility)
+            return syms.objectType;
+        }
+        return to;
     }
 
     /**
@@ -2132,8 +2221,10 @@
          * Copy variable in this inference context to the given context
          */
         void dupTo(final InferenceContext that) {
-            that.inferencevars = that.inferencevars.appendList(inferencevars);
-            that.undetvars = that.undetvars.appendList(undetvars);
+            that.inferencevars = that.inferencevars.appendList(
+                    inferencevars.diff(that.inferencevars));
+            that.undetvars = that.undetvars.appendList(
+                    undetvars.diff(that.undetvars));
             //set up listeners to notify original inference contexts as
             //propagated vars are inferred in new context
             for (Type t : inferencevars) {
@@ -2252,6 +2343,30 @@
             return "Inference vars: " + inferencevars + '\n' +
                    "Undet vars: " + undetvars;
         }
+
+        /* Method Types.capture() generates a new type every time it's applied
+         * to a wildcard parameterized type. This is intended functionality but
+         * there are some cases when what you need is not to generate a new
+         * captured type but to check that a previously generated captured type
+         * is correct. There are cases when caching a captured type for later
+         * reuse is sound. In general two captures from the same AST are equal.
+         * This is why the tree is used as the key of the map below. This map
+         * stores a Type per AST.
+         */
+        Map<JCTree, Type> captureTypeCache = new HashMap<>();
+
+        Type cachedCapture(JCTree tree, Type t, boolean readOnly) {
+            Type captured = captureTypeCache.get(tree);
+            if (captured != null) {
+                return captured;
+            }
+
+            Type result = types.capture(t);
+            if (result != t && !readOnly) { // then t is a wildcard parameterized type
+                captureTypeCache.put(tree, result);
+            }
+            return result;
+        }
     }
 
     final InferenceContext emptyContext = new InferenceContext(List.<Type>nil());
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Mon May 05 12:49:13 2014 -0700
@@ -36,6 +36,7 @@
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.DynamicMethodSymbol;
 import com.sun.tools.javac.code.Symbol.MethodSymbol;
+import com.sun.tools.javac.code.Symbol.TypeSymbol;
 import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
@@ -50,8 +51,10 @@
 
 import java.util.EnumMap;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Set;
 
 import static com.sun.tools.javac.comp.LambdaToMethod.LambdaSymbolKind.*;
 import static com.sun.tools.javac.code.Flags.*;
@@ -437,13 +440,9 @@
     public void visitVarDef(JCVariableDecl tree) {
         LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context;
         if (context != null && lambdaContext.getSymbolMap(LOCAL_VAR).containsKey(tree.sym)) {
-            JCExpression init = translate(tree.init);
-            int prevPos = make.pos;
-            try {
-                result = make.at(tree).VarDef((VarSymbol)lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym), init);
-            } finally {
-                make.at(prevPos);
-            }
+            tree.init = translate(tree.init);
+            tree.sym = (VarSymbol) lambdaContext.getSymbolMap(LOCAL_VAR).get(tree.sym);
+            result = tree;
         } else if (context != null && lambdaContext.getSymbolMap(TYPE_VAR).containsKey(tree.sym)) {
             JCExpression init = translate(tree.init);
             VarSymbol xsym = (VarSymbol)lambdaContext.getSymbolMap(TYPE_VAR).get(tree.sym);
@@ -1284,7 +1283,10 @@
 
         @Override
         public void visitNewClass(JCNewClass tree) {
-            if (lambdaNewClassFilter(context(), tree)) {
+            TypeSymbol def = tree.type.tsym;
+            boolean inReferencedClass = currentlyInClass(def);
+            boolean isLocal = def.isLocal();
+            if ((inReferencedClass && isLocal || lambdaNewClassFilter(context(), tree))) {
                 TranslationContext<?> localContext = context();
                 while (localContext != null) {
                     if (localContext.tree.getTag() == LAMBDA) {
@@ -1294,16 +1296,16 @@
                     localContext = localContext.prev;
                 }
             }
-            if (context() != null && tree.type.tsym.owner.kind == MTH) {
+            if (context() != null && !inReferencedClass && isLocal) {
                 LambdaTranslationContext lambdaContext = (LambdaTranslationContext)context();
-                captureLocalClassDefs(tree.type.tsym, lambdaContext);
+                captureLocalClassDefs(def, lambdaContext);
             }
             super.visitNewClass(tree);
         }
         //where
             void captureLocalClassDefs(Symbol csym, final LambdaTranslationContext lambdaContext) {
                 JCClassDecl localCDef = localClassDefs.get(csym);
-                if (localCDef != null && localCDef.pos < lambdaContext.tree.pos) {
+                if (localCDef != null && lambdaContext.freeVarProcessedLocalClasses.add(csym)) {
                     BasicFreeVarCollector fvc = lower.new BasicFreeVarCollector() {
                         @Override
                         void addFreeVars(ClassSymbol c) {
@@ -1329,6 +1331,18 @@
                     fvc.scan(localCDef);
                 }
         }
+        //where
+        boolean currentlyInClass(Symbol csym) {
+            for (Frame frame : frameStack) {
+                if (frame.tree.hasTag(JCTree.Tag.CLASSDEF)) {
+                    JCClassDecl cdef = (JCClassDecl) frame.tree;
+                    if (cdef.sym == csym) {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
 
         /**
          * Method references to local class constructors, may, if the local
@@ -1754,6 +1768,11 @@
 
             List<JCVariableDecl> syntheticParams;
 
+            /**
+             * to prevent recursion, track local classes processed
+             */
+            final Set<Symbol> freeVarProcessedLocalClasses;
+
             LambdaTranslationContext(JCLambda tree) {
                 super(tree);
                 Frame frame = frameStack.head;
@@ -1783,6 +1802,8 @@
                 translatedSymbols.put(CAPTURED_VAR, new LinkedHashMap<Symbol, Symbol>());
                 translatedSymbols.put(CAPTURED_THIS, new LinkedHashMap<Symbol, Symbol>());
                 translatedSymbols.put(TYPE_VAR, new LinkedHashMap<Symbol, Symbol>());
+
+                freeVarProcessedLocalClasses = new HashSet<>();
             }
 
              /**
@@ -1893,7 +1914,7 @@
                         };
                         break;
                     case LOCAL_VAR:
-                        ret = new VarSymbol(sym.flags() & FINAL, name, types.erasure(sym.type), translatedSym);
+                        ret = new VarSymbol(sym.flags() & FINAL, name, sym.type, translatedSym);
                         ((VarSymbol) ret).pos = ((VarSymbol) sym).pos;
                         break;
                     case PARAM:
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon May 05 12:49:13 2014 -0700
@@ -564,7 +564,7 @@
                                     tvars,
                                     (MethodType)mt,
                                     resultInfo,
-                                    m,
+                                    (MethodSymbol)m,
                                     argtypes,
                                     allowBoxing,
                                     useVarargs,
@@ -772,6 +772,7 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return nilMethodCheck;
         }
+
     }
 
     /**
@@ -783,6 +784,11 @@
         void checkArg(DiagnosticPosition pos, boolean varargs, Type actual, Type formal, DeferredAttrContext deferredAttrContext, Warner warn) {
             //do nothing - actual always compatible to formals
         }
+
+        @Override
+        public String toString() {
+            return "arityMethodCheck";
+        }
     };
 
     List<Type> dummyArgs(int length) {
@@ -868,6 +874,11 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return new MostSpecificCheck(strict, actuals);
         }
+
+        @Override
+        public String toString() {
+            return "resolveMethodCheck";
+        }
     };
 
     /**
@@ -899,7 +910,9 @@
                 @Override
                 public boolean compatible(Type found, Type req, Warner warn) {
                     found = pendingInferenceContext.asUndetVar(found);
-                    req = infer.returnConstraintTarget(found, req);
+                    if (found.hasTag(UNDETVAR) && req.isPrimitive()) {
+                        req = types.boxedClass(req).type;
+                    }
                     return super.compatible(found, req, warn);
                 }
 
@@ -915,6 +928,11 @@
         public MethodCheck mostSpecificCheck(List<Type> actuals, boolean strict) {
             return new MostSpecificCheck(strict, actuals);
         }
+
+        @Override
+        public String toString() {
+            return "MethodReferenceCheck";
+        }
     }
 
     /**
@@ -954,6 +972,11 @@
         public DeferredAttrContext deferredAttrContext() {
             return deferredAttrContext;
         }
+
+        @Override
+        public String toString() {
+            return "MethodCheckContext";
+        }
     }
 
     /**
@@ -972,7 +995,12 @@
                 DeferredType dt = (DeferredType)found;
                 return dt.check(this);
             } else {
-                return super.check(pos, chk.checkNonVoid(pos, types.capture(U(found.baseType()))));
+                Type uResult = U(found.baseType());
+                Type capturedType = pos == null || pos.getTree() == null ?
+                        types.capture(uResult) :
+                        checkContext.inferenceContext()
+                            .cachedCapture(pos.getTree(), uResult, true);
+                return super.check(pos, chk.checkNonVoid(pos, capturedType));
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java	Mon May 05 12:49:13 2014 -0700
@@ -82,8 +82,10 @@
             for (StringTokenizer st = new StringTokenizer(path);
                  st.hasMoreTokens(); ) {
                 String elt = st.nextToken();
-                File f = (parent == null ? new File(elt) : new File(parent, elt));
-                list.add(f);
+                try {
+                    File f = parent == null ? new File(elt): new File(file.toURI().resolve(elt));
+                    list.add(f);
+                } catch (IllegalArgumentException ex) {}
             }
 
             return list;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon May 05 12:49:13 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2812,7 +2812,7 @@
         }
 
         private LVTAssignAnalyzer(LVTRanges lvtRanges, Symtab syms, Names names) {
-            super(new LVTBits(), syms, names);
+            super(new LVTBits(), syms, names, false);
             lvtInits = (LVTBits)inits;
             this.lvtRanges = lvtRanges;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon May 05 12:49:13 2014 -0700
@@ -1627,6 +1627,10 @@
 compiler.warn.varargs.redundant.trustme.anno=\
     Redundant {0} annotation. {1}
 
+# 0: symbol
+compiler.warn.access.to.sensitive.member.from.serializable.element=\
+    access to sensitive member {0} from serializable element can be publicly accessible to untrusted code
+
 #####
 
 ## The following are tokens which are non-terminals in the language. They should
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon May 05 12:49:13 2014 -0700
@@ -851,6 +851,8 @@
             return symbol(((JCTypeApply) tree).clazz);
         case ANNOTATED_TYPE:
             return symbol(((JCAnnotatedType) tree).underlyingType);
+        case REFERENCE:
+            return ((JCMemberReference) tree).sym;
         default:
             return null;
         }
--- a/langtools/test/com/sun/javadoc/lib/JavadocTester.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/lib/JavadocTester.java	Mon May 05 12:49:13 2014 -0700
@@ -114,6 +114,46 @@
     private File outputDir;
 
     /**
+     * Alternatives for checking the contents of a directory.
+     */
+    enum DirectoryCheck {
+        /**
+         * Check that the directory is empty.
+         */
+        EMPTY((file, name) -> true),
+        /**
+         * Check that the directory does not contain any HTML files,
+         * such as may have been generated by a prior run of javadoc
+         * using this directory.
+         * For now, the check is only performed on the top level directory.
+         */
+        NO_HTML_FILES((file, name) -> name.endsWith(".html")),
+        /**
+         * No check is performed on the directory contents.
+         */
+        NONE(null) { @Override void check(File dir) { } };
+
+        /** The filter used to detect that files should <i>not</i> be present. */
+        FilenameFilter filter;
+
+        DirectoryCheck(FilenameFilter f) {
+            filter = f;
+        }
+
+        void check(File dir) {
+            if (dir.isDirectory()) {
+                String[] contents = dir.list(filter);
+                if (contents == null)
+                    throw new Error("cannot list directory: " + dir);
+                if (contents.length > 0)
+                    throw new Error("directory has unexpected content: " + dir);
+            }
+        }
+    }
+
+    private DirectoryCheck outputDirectoryCheck = DirectoryCheck.EMPTY;
+
+    /**
      * The current subtest number.
      */
     private static int numTestsRun = 0;
@@ -206,6 +246,8 @@
             }
         }
 
+        outputDirectoryCheck.check(outputDir);
+
         ByteArrayOutputStream stdout = new ByteArrayOutputStream();
         PrintStream prevOut = System.out;
         System.setOut(new PrintStream(stdout));
@@ -232,6 +274,15 @@
     }
 
     /**
+     * Set a filter to check the initial contents of the output directory
+     * before javadoc is run.
+     * The filter should return true for files that should <b>not</b> appear.
+     */
+    public void setCheckOutputDirectoryCheck(DirectoryCheck c) {
+        outputDirectoryCheck = c;
+    }
+
+    /**
      * Create new string writer buffers
      */
     private void initOutputBuffers() {
--- a/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testDocFileDir/TestDocFileDir.java	Mon May 05 12:49:13 2014 -0700
@@ -86,10 +86,12 @@
      */
     public static void main(String[] args) {
         TestDocFileDir tester = new TestDocFileDir();
+        tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
         copyDir(SRC_DIR + "/pkg", ".");
         tester.run(ARGS0, TEST0, NO_TEST);
         copyDir(SRC_DIR + "/pkg", OUTPUT_DIR + "-1");
         tester.run(ARGS1, TEST1, NO_TEST);
+        tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
         tester.run(ARGS2, NO_TEST, NO_TEST, FILE_TEST2, FILE_NEGATED_TEST2);
         tester.printSummary();
     }
--- a/langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testGeneratedBy/TestGeneratedBy.java	Mon May 05 12:49:13 2014 -0700
@@ -58,7 +58,7 @@
     private static final String[] NO_TIMESTAMP_ARGS =
         new String[] {
             "-notimestamp",
-            "-d", OUTPUT_DIR,
+            "-d", OUTPUT_DIR + "-1",
             "-sourcepath", SRC_DIR,
             "pkg"
         };
--- a/langtools/test/com/sun/javadoc/testGroupOption/TestGroupOption.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testGroupOption/TestGroupOption.java	Mon May 05 12:49:13 2014 -0700
@@ -45,7 +45,7 @@
     };
 
     private static final String[] ARGS2 = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR,
+        "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR,
         "-group", "Package One", "pkg1",
         "-group", "Package One", "pkg2",
         "-group", "Package One", "pkg3",
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Mon May 05 12:49:13 2014 -0700
@@ -40,127 +40,134 @@
     // Optional Element should print properly nested definition list tags
     // for default value.
     private static final String[][] TEST_ALL = {
-        { "pkg1/C1.html", "<pre>public class " +
-                 "<span class=\"typeNameLabel\">C1</span>\n" +
-                 "extends java.lang.Object\n" +
-                 "implements java.io.Serializable</pre>"},
-        { "pkg1/C4.html", "<dl>\n" +
-                 "<dt>Default:</dt>\n" +
-                 "<dd>true</dd>\n" +
-                 "</dl>"}};
+        { "pkg1/C1.html",
+                "<pre>public class <span class=\"typeNameLabel\">C1</span>\n" +
+                "extends java.lang.Object\n" +
+                "implements java.io.Serializable</pre>"},
+        { "pkg1/C4.html",
+                "<dl>\n" +
+                "<dt>Default:</dt>\n" +
+                "<dd>true</dd>\n" +
+                "</dl>"}};
 
     // Test for normal run of javadoc in which various ClassDocs and
     // serialized form should have properly nested definition list tags
     // enclosing comments, tags and deprecated information.
     private static final String[][] TEST_CMNT_DEPR = {
-        { "pkg1/package-summary.html", "<dl>\n" +
-                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>JDK1.0</dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>JDK1.0</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                 "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
-                 "C2</code></a>, \n" +
-                 "<a href=\"../serialized-form.html#pkg1.C1\">" +
-                 "Serialized Form</a></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>1.4</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                 "<dd>" +
-                 "<a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-                 "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
-                 "<dd><code>title" +
-                 "</code> - the title</dd>\n" +
-                 "<dd><code>test</code> - boolean value" +
-                 "</dd>\n" +
-                 "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
-                 "<dd><code>java.lang.IllegalArgumentException</code> - if the " +
-                 "<code>owner</code>'s\n" +
-                 "     <code>GraphicsConfiguration</code> is not from a screen " +
-                 "device</dd>\n" +
-                 "<dd><code>HeadlessException</code></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
-        "<dd><code>undecorated" +
-                 "</code> - <code>true</code> if no decorations are\n" +
-                 "         to be enabled;\n" +
-                 "         <code>false</code> " +
-                 "if decorations are to be enabled.</dd>\n" +
-                 "<dt><span class=\"simpleTagLabel\">Since:" +
-                 "</span></dt>\n" +
-                 "<dd>1.4</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                 "<dd>" +
-                 "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
-                 "</code></a></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
-                 "<dd><code>java.io.IOException</code></dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:" +
-                 "</span></dt>\n" +
-                 "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C2.html", "<dl>\n" +
-        "<dt><span class=\"paramLabel\">Parameters:" +
-                 "</span></dt>\n" +
-                 "<dd><code>set</code> - boolean</dd>\n" +
-                 "<dt><span class=\"simpleTagLabel\">" +
-                 "Since:</span></dt>\n" +
-                 "<dd>1.4</dd>\n" +
-                 "</dl>"},
-        { "serialized-form.html", "<dl>\n" +
-        "<dt><span class=\"throwsLabel\">Throws:</span>" +
-                 "</dt>\n" +
-                 "<dd><code>" +
-                 "java.io.IOException</code></dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span>" +
-                 "</dt>\n" +
-                 "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
+        { "pkg1/package-summary.html",
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>JDK1.0</dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>JDK1.0</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
+                "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\"><code>" +
+                "C2</code></a>, \n" +
+                "<a href=\"../serialized-form.html#pkg1.C1\">" +
+                "Serialized Form</a></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>1.4</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
+                "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
+                "<dd><code>title</code> - the title</dd>\n" +
+                "<dd><code>test</code> - boolean value" +
+                "</dd>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
+                "<dd><code>java.lang.IllegalArgumentException</code> - if the " +
+                "<code>owner</code>'s\n" +
+                "     <code>GraphicsConfiguration</code> is not from a screen " +
+                "device</dd>\n" +
+                "<dd><code>HeadlessException</code></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"paramLabel\">Parameters:</span></dt>\n" +
+                "<dd><code>undecorated" +
+                "</code> - <code>true</code> if no decorations are\n" +
+                "         to be enabled;\n" +
+                "         <code>false</code> " +
+                "if decorations are to be enabled.</dd>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:" +
+                "</span></dt>\n" +
+                "<dd>1.4</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
+                "<dd>" +
+                "<a href=\"../pkg1/C1.html#readObject--\"><code>readObject()" +
+                "</code></a></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:</span></dt>\n" +
+                "<dd><code>java.io.IOException</code></dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:" +
+                "</span></dt>\n" +
+                "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
+        { "pkg1/C2.html",
+                "<dl>\n" +
+                "<dt><span class=\"paramLabel\">Parameters:" +
+                "</span></dt>\n" +
+                "<dd><code>set</code> - boolean</dd>\n" +
+                "<dt><span class=\"simpleTagLabel\">" +
+                "Since:</span></dt>\n" +
+                "<dd>1.4</dd>\n" +
+                "</dl>"},
         { "serialized-form.html",
-                 "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                 "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                 "<div class=\"block\">This field indicates whether the C1 is " +
-                 "undecorated.</div>\n" +
-                 "&nbsp;\n" +
-                 "<dl>\n" +
-                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>1.4</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span>" +
-                 "</dt>\n" +
-                 "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
+                "<dl>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:</span>" +
+                "</dt>\n" +
+                "<dd><code>" +
+                "java.io.IOException</code></dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span>" +
+                "</dt>\n" +
+                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
         { "serialized-form.html",
-                 "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                 "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                 "<div class=\"block\">Reads the object stream.</div>\n" +
-                 "<dl>\n" +
-                 "<dt><span class=\"throwsLabel\">Throws:" +
-                 "</span></dt>\n" +
-                 "<dd><code><code>" +
-                 "IOException</code></code></dd>\n" +
-                 "<dd><code>java.io.IOException</code></dd>\n" +
-                 "</dl>"},
+                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
+                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
+                "<div class=\"block\">This field indicates whether the C1 is " +
+                "undecorated.</div>\n" +
+                "&nbsp;\n" +
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>1.4</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span>" +
+                "</dt>\n" +
+                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
         { "serialized-form.html",
-                 "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                 "&nbsp;</div>\n" +
-                 "<div class=\"block\">The name for this class.</div>"}};
+                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
+                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
+                "<div class=\"block\">Reads the object stream.</div>\n" +
+                "<dl>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:" +
+                "</span></dt>\n" +
+                "<dd><code><code>" +
+                "IOException</code></code></dd>\n" +
+                "<dd><code>java.io.IOException</code></dd>\n" +
+                "</dl>"},
+        { "serialized-form.html",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+                "&nbsp;</div>\n" +
+                "<div class=\"block\">The name for this class.</div>"}};
 
     // Test with -nodeprecated option. The ClassDocs should have properly nested
     // definition list tags enclosing comments and tags. The ClassDocs should not
@@ -168,183 +175,210 @@
     // should display properly nested definition list tags for comments, tags
     // and deprecated information.
     private static final String[][] TEST_NODEPR = {
-        { "pkg1/package-summary.html", "<dl>\n" +
-                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>JDK1.0</dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"simpleTagLabel\">Since:</span>" +
-                 "</dt>\n" +
-                 "<dd>JDK1.0</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:" +
-                 "</span></dt>\n" +
-                 "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
-                 "<code>C2</code></a>, \n" +
-                 "<a href=\"../serialized-form.html#pkg1.C1\">" +
-                 "Serialized Form</a></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"paramLabel\">Parameters:" +
-                 "</span></dt>\n" +
-                 "<dd><code>title</code> - the title</dd>\n" +
-                 "<dd><code>" +
-                 "test</code> - boolean value</dd>\n" +
-                 "<dt><span class=\"throwsLabel\">Throws:" +
-                 "</span></dt>\n" +
-                 "<dd><code>java.lang.IllegalArgumentException" +
-                 "</code> - if the <code>owner</code>'s\n" +
-                 "     <code>GraphicsConfiguration" +
-                 "</code> is not from a screen device</dd>\n" +
-                 "<dd><code>" +
-                 "HeadlessException</code></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"paramLabel\">Parameters:" +
-                 "</span></dt>\n" +
-                 "<dd><code>undecorated</code> - <code>true</code>" +
-                 " if no decorations are\n" +
-                 "         to be enabled;\n" +
-                 "         <code>false</code> if decorations are to be enabled." +
-                 "</dd>\n" +
-                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>1.4</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
-                 "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
-                 "<code>readObject()</code></a></dd>\n" +
-                 "</dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "<dt><span class=\"throwsLabel\">Throws:</span>" +
-                 "</dt>\n" +
-                 "<dd><code>java.io.IOException</code></dd>\n" +
-                 "<dt>" +
-                 "<span class=\"seeLabel\">See Also:</span></dt>\n" +
-                 "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
-        { "serialized-form.html", "<dl>\n" +
-        "<dt><span class=\"throwsLabel\">Throws:</span>" +
-                 "</dt>\n" +
-                 "<dd><code>" +
-                 "java.io.IOException</code></dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span>" +
-                 "</dt>\n" +
-                 "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
+        { "pkg1/package-summary.html",
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>JDK1.0</dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span>" +
+                "</dt>\n" +
+                "<dd>JDK1.0</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:" +
+                "</span></dt>\n" +
+                "<dd><a href=\"../pkg1/C2.html\" title=\"class in pkg1\">" +
+                "<code>C2</code></a>, \n" +
+                "<a href=\"../serialized-form.html#pkg1.C1\">" +
+                "Serialized Form</a></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"paramLabel\">Parameters:" +
+                "</span></dt>\n" +
+                "<dd><code>title</code> - the title</dd>\n" +
+                "<dd><code>" +
+                "test</code> - boolean value</dd>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:" +
+                "</span></dt>\n" +
+                "<dd><code>java.lang.IllegalArgumentException" +
+                "</code> - if the <code>owner</code>'s\n" +
+                "     <code>GraphicsConfiguration" +
+                "</code> is not from a screen device</dd>\n" +
+                "<dd><code>" +
+                "HeadlessException</code></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"paramLabel\">Parameters:" +
+                "</span></dt>\n" +
+                "<dd><code>undecorated</code> - <code>true</code>" +
+                " if no decorations are\n" +
+                "         to be enabled;\n" +
+                "         <code>false</code> if decorations are to be enabled." +
+                "</dd>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>1.4</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" +
+                "<dd><a href=\"../pkg1/C1.html#readObject--\">" +
+                "<code>readObject()</code></a></dd>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:</span>" +
+                "</dt>\n" +
+                "<dd><code>java.io.IOException</code></dd>\n" +
+                "<dt>" +
+                "<span class=\"seeLabel\">See Also:</span></dt>\n" +
+                "<dd><a href=\"../pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
         { "serialized-form.html",
-                 "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                 "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                 "<div class=\"block\">This field indicates whether the C1 is " +
-                 "undecorated.</div>\n" +
-                 "&nbsp;\n" +
-                 "<dl>\n" +
-                 "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
-                 "<dd>1.4</dd>\n" +
-                 "<dt><span class=\"seeLabel\">See Also:</span>" +
-                 "</dt>\n" +
-                 "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
-                 "</dl>"},
+                "<dl>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:</span>" +
+                "</dt>\n" +
+                "<dd><code>" +
+                "java.io.IOException</code></dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span>" +
+                "</dt>\n" +
+                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
         { "serialized-form.html",
-                 "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                 "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                 "<div class=\"block\">Reads the object stream.</div>\n" +
-                 "<dl>\n" +
-                 "<dt><span class=\"throwsLabel\">Throws:" +
-                 "</span></dt>\n" +
-                 "<dd><code><code>" +
-                 "IOException</code></code></dd>\n" +
-                 "<dd><code>java.io.IOException</code></dd>\n" +
-                 "</dl>"},
+                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
+                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
+                "<div class=\"block\">This field indicates whether the C1 is " +
+                "undecorated.</div>\n" +
+                "&nbsp;\n" +
+                "<dl>\n" +
+                "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" +
+                "<dd>1.4</dd>\n" +
+                "<dt><span class=\"seeLabel\">See Also:</span>" +
+                "</dt>\n" +
+                "<dd><a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>C1.setUndecorated(boolean)</code></a></dd>\n" +
+                "</dl>"},
         { "serialized-form.html",
-                 "<span class=\"deprecatedLabel\">Deprecated.</span>" +
-                 "&nbsp;</div>\n" +
-                 "<div class=\"block\">" +
-                 "The name for this class.</div>"}};
+                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+                "&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
+                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
+                "<div class=\"block\">Reads the object stream.</div>\n" +
+                "<dl>\n" +
+                "<dt><span class=\"throwsLabel\">Throws:" +
+                "</span></dt>\n" +
+                "<dd><code><code>" +
+                "IOException</code></code></dd>\n" +
+                "<dd><code>java.io.IOException</code></dd>\n" +
+                "</dl>"},
+        { "serialized-form.html",
+                "<span class=\"deprecatedLabel\">Deprecated.</span>" +
+                "&nbsp;</div>\n" +
+                "<div class=\"block\">" +
+                "The name for this class.</div>"}};
 
     // Test with -nocomment and -nodeprecated options. The ClassDocs whould
     // not display definition lists for any member details.
     private static final String[][] TEST_NOCMNT_NODEPR = {
         { "pkg1/C1.html",
-                 "<pre>public&nbsp;void&nbsp;readObject()\n" +
-                 "                throws java.io.IOException</pre>\n" +
-                 "</li>"},
+                "<pre>public&nbsp;void&nbsp;readObject()\n" +
+                "                throws java.io.IOException</pre>\n" +
+                "</li>"},
         { "pkg1/C2.html", "<pre>public&nbsp;C2()</pre>\n" +
-                 "</li>"},
+                "</li>"},
         { "pkg1/C1.ModalExclusionType.html", "<pre>public " +
-                 "static final&nbsp;<a href=\"../pkg1/C1.ModalExclusionType.html\" " +
-                 "title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
-                 "APPLICATION_EXCLUDE</pre>\n" +
-                 "</li>"},
+                "static final&nbsp;<a href=\"../pkg1/C1.ModalExclusionType.html\" " +
+                "title=\"enum in pkg1\">C1.ModalExclusionType</a> " +
+                "APPLICATION_EXCLUDE</pre>\n" +
+                "</li>"},
         { "serialized-form.html", "<pre>boolean " +
-                 "undecorated</pre>\n" +
-                 "<div class=\"block\"><span class=\"deprecatedLabel\">" +
-                 "Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
-                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
-                 "setUndecorated(boolean)</code></a>.</span></div>\n" +
-                 "</li>"},
+                "undecorated</pre>\n" +
+                "<div class=\"block\"><span class=\"deprecatedLabel\">" +
+                "Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version 1.5, replaced by\n" +
+                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\"><code>" +
+                "setUndecorated(boolean)</code></a>.</span></div>\n" +
+                "</li>"},
         { "serialized-form.html", "<span class=\"deprecatedLabel\">" +
-                 "Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version" +
-                 " 1.5, replaced by\n" +
-                 " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
-                 "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
-                 "</li>"}};
+                "Deprecated.</span>&nbsp;<span class=\"deprecationComment\">As of JDK version" +
+                " 1.5, replaced by\n" +
+                " <a href=\"pkg1/C1.html#setUndecorated-boolean-\">" +
+                "<code>setUndecorated(boolean)</code></a>.</span></div>\n" +
+                "</li>"}};
 
     // Test for valid HTML generation which should not comprise of empty
     // definition list tags.
-    private static final String[][] NEGATED_TEST = {
-        { "pkg1/package-summary.html", "<dl></dl>"},
-        { "pkg1/package-summary.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C1.html", "<dl></dl>"},
-        { "pkg1/C1.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C1.ModalExclusionType.html", "<dl></dl>"},
-        { "pkg1/C1.ModalExclusionType.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C2.html", "<dl></dl>"},
-        { "pkg1/C2.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C2.ModalType.html", "<dl></dl>"},
-        { "pkg1/C2.ModalType.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C3.html", "<dl></dl>"},
-        { "pkg1/C3.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C4.html", "<dl></dl>"},
-        { "pkg1/C4.html", "<dl>\n" +
-        "</dl>"},
-        { "pkg1/C5.html", "<dl></dl>"},
-        { "pkg1/C5.html", "<dl>\n" +
-        "</dl>"},
-        { "overview-tree.html", "<dl></dl>"},
-        { "overview-tree.html", "<dl>\n" +
-        "</dl>"},
-        { "serialized-form.html", "<dl></dl>"},
-        { "serialized-form.html", "<dl>\n" +
-        "</dl>"}};
+    private static final String[][] NEGATED_TEST_NO_C5 = {
+        { "pkg1/package-summary.html",
+                "<dl></dl>"},
+        { "pkg1/package-summary.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "pkg1/C1.html",
+                "<dl></dl>"},
+        { "pkg1/C1.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "pkg1/C1.ModalExclusionType.html",
+                "<dl></dl>"},
+        { "pkg1/C1.ModalExclusionType.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "pkg1/C2.html",
+                "<dl></dl>"},
+        { "pkg1/C2.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "pkg1/C2.ModalType.html",
+                "<dl></dl>"},
+        { "pkg1/C2.ModalType.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "pkg1/C3.html",
+                "<dl></dl>"},
+        { "pkg1/C3.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "pkg1/C4.html",
+                "<dl></dl>"},
+        { "pkg1/C4.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "overview-tree.html",
+                "<dl></dl>"},
+        { "overview-tree.html",
+                "<dl>\n" +
+                "</dl>"},
+        { "serialized-form.html",
+                "<dl></dl>"},
+        { "serialized-form.html",
+                "<dl>\n" +
+                "</dl>"}};
+    private static final String[][] NEGATED_TEST_C5 = {
+        { "pkg1/C5.html",
+                "<dl></dl>"},
+        { "pkg1/C5.html",
+                "<dl>\n" +
+                "</dl>"}};
 
     private static final String[] ARGS1 =
         new String[] {
-            "-Xdoclint:none", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
+            "-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS2 =
         new String[] {
-            "-Xdoclint:none", "-d", OUTPUT_DIR, "-nocomment", "-sourcepath",
+            "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath",
             SRC_DIR, "pkg1"};
 
     private static final String[] ARGS3 =
         new String[] {
-            "-Xdoclint:none", "-d", OUTPUT_DIR, "-nodeprecated", "-sourcepath",
+            "-Xdoclint:none", "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath",
             SRC_DIR, "pkg1"};
 
     private static final String[] ARGS4 =
         new String[] {
-            "-Xdoclint:none", "-d", OUTPUT_DIR, "-nocomment", "-nodeprecated",
+            "-Xdoclint:none", "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated",
             "-sourcepath", SRC_DIR, "pkg1"};
 
     /**
@@ -353,14 +387,20 @@
      */
     public static void main(String[] args) {
         TestHtmlDefinitionListTag tester = new TestHtmlDefinitionListTag();
-        tester.run(ARGS1, TEST_ALL, NEGATED_TEST);
-        tester.run(ARGS1, TEST_CMNT_DEPR, NEGATED_TEST);
-        tester.run(ARGS2, TEST_ALL, NEGATED_TEST);
-        tester.run(ARGS2, NO_TEST, TEST_CMNT_DEPR);
-        tester.run(ARGS3, TEST_ALL, NEGATED_TEST);
-        tester.run(ARGS3, TEST_NODEPR, TEST_NOCMNT_NODEPR);
-        tester.run(ARGS4, TEST_ALL, NEGATED_TEST);
-        tester.run(ARGS4, TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
+        tester.run(ARGS1, TEST_ALL, NEGATED_TEST_NO_C5);
+        tester.runTestsOnHTML(NO_TEST,  NEGATED_TEST_C5);
+        tester.runTestsOnHTML(TEST_CMNT_DEPR, NO_TEST);
+
+        tester.run(ARGS2, TEST_ALL, NEGATED_TEST_NO_C5);
+        tester.runTestsOnHTML(NO_TEST,  NEGATED_TEST_C5);
+        tester.runTestsOnHTML(NO_TEST, TEST_CMNT_DEPR);
+
+        tester.run(ARGS3, TEST_ALL, NEGATED_TEST_NO_C5);
+        tester.runTestsOnHTML(TEST_NODEPR, TEST_NOCMNT_NODEPR);
+
+        tester.run(ARGS4, TEST_ALL, NEGATED_TEST_NO_C5);
+        tester.runTestsOnHTML(TEST_NOCMNT_NODEPR, TEST_CMNT_DEPR);
+
         tester.printSummary();
     }
 }
--- a/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlStrongTag/TestHtmlStrongTag.java	Mon May 05 12:49:13 2014 -0700
@@ -47,16 +47,14 @@
     private static final String[][] TEST2 = {
         { "pkg2/C2.html", "<B>Comments:</B>"}};
     private static final String[][] NEGATED_TEST2 = {
-        { "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"},
-        { "pkg1/package-summary.html",
-            "<STRONG>Class Summary</STRONG>"}};
+        { "pkg2/C2.html", "<STRONG>Method Summary</STRONG>"}};
 
     private static final String[] ARGS1 =
         new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
+            "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
     private static final String[] ARGS2 =
         new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg2"};
+            "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
 
     /**
      * The entry point of the test.
--- a/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlTag/TestHtmlTag.java	Mon May 05 12:49:13 2014 -0700
@@ -58,13 +58,13 @@
 
     private static final String[] ARGS1 =
         new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
+            "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
     private static final String[] ARGS2 =
         new String[] {
-            "-locale", "ja", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg2"};
+            "-locale", "ja", "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "pkg2"};
     private static final String[] ARGS3 =
         new String[] {
-            "-locale", "en_US", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
+            "-locale", "en_US", "-d", OUTPUT_DIR + "-3", "-sourcepath", SRC_DIR, "pkg1"};
 
     /**
      * The entry point of the test.
--- a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java	Mon May 05 12:49:13 2014 -0700
@@ -79,8 +79,8 @@
 
     private static final String[][] TEST2 = {
         { "pkg2/C2.html",
-            "This is a link to <a href=\"../../" + OUTPUT_DIR +
-            "-1/pkg/C.html?is-external=true\" " +
+            "This is a link to <a href=\"../../" +
+            OUTPUT_DIR + "-1/pkg/C.html?is-external=true\" " +
             "title=\"class or interface in pkg\"><code>Class C</code></a>."
         }
     };
@@ -119,7 +119,6 @@
     public static void main(String[] args) {
         TestLinkOption tester = new TestLinkOption();
         tester.run(ARGS1, TEST1, NEGATED_TEST1);
-        tester.run(ARGS1, TEST1, NEGATED_TEST1);
         tester.run(ARGS2, TEST2, NO_TEST);
         tester.runJavadoc(createArguments(true));  // with trailing slash
         tester.runJavadoc(createArguments(false)); // without trailing slash
--- a/langtools/test/com/sun/javadoc/testNotifications/TestNotifications.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testNotifications/TestNotifications.java	Mon May 05 12:49:13 2014 -0700
@@ -67,7 +67,9 @@
         tester.run(ARGS, TEST, NO_TEST);
         // No need to notify that the destination must be created because
         // it already exists.
+        tester.setCheckOutputDirectoryCheck(DirectoryCheck.NONE);
         tester.run(ARGS, NO_TEST, NEGATED_TEST);
+        tester.setCheckOutputDirectoryCheck(DirectoryCheck.NO_HTML_FILES);
         //Make sure classname is not include in javadoc usage message.
         tester.run(ARGS2, NO_TEST, NEGATED_TEST2);
         tester.printSummary();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/C.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Class in an unnamed package.
+ */
+
+public class C {
+    /**
+     * A ctor
+     * @param c a param
+     */
+    public C(UsedInC c){}
+
+    /**
+     * another ctor
+     * @param c  a param
+     * @param s  a param
+     */
+    public C(UsedInC c, String s) {}
+
+    /**
+     * yet another ctor
+     * @param c  a param
+     * @param i  a param
+     */
+    public C(UsedInC c, int i) {}
+
+    /**
+     * Field in C.
+     */
+    public UsedInC fieldInC;
+
+    /**
+     * Method in C.
+     * @param p  a param
+     * @return UsedInC
+     */
+    public UsedInC methodInC(UsedInC p) { return p;}
+
+    /**
+     * A static method
+     * @param s  a param
+     * @return UsedInC
+     */
+    public static UsedInC ymethod(String s) {return null;}
+
+    /**
+     * Another static method variant
+     * @param value  a param
+     * @return UsedInC
+     */
+    public static UsedInC ymethod(int value) {return -1;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/TestOrdering.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8039410
+ * @summary test to determine if members are ordered correctly
+ * @author ksrini
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestOrdering
+ * @run main TestOrdering
+ */
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class TestOrdering extends JavadocTester {
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) throws Exception {
+        TestOrdering tester = new TestOrdering();
+        // test unnamed packages
+        String[] ARGS = {
+            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-use",
+             SRC_DIR + "/C.java", SRC_DIR + "/UsedInC.java"
+        };
+        tester.runJavadoc(ARGS);
+        checkExecutableMemberOrdering(tester.readFileToString("class-use/UsedInC.html"));
+
+        // next test using packages
+        String[] ARGS1 = {
+            "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "-use",
+            "pkg1"
+        };
+        tester.runJavadoc(ARGS1);
+        checkClassUseOrdering(tester.readFileToString("pkg1/class-use/UsedClass.html"));
+        checkIndexPathOrdering(tester.readFileToString("index-all.html"));
+    }
+
+    static void checkExecutableMemberOrdering(String usePage) {
+        // check constructors
+        int idx1 = usePage.indexOf("C.html#C-UsedInC");
+        int idx2 = usePage.indexOf("C.html#C-UsedInC-int");
+        int idx3 = usePage.indexOf("C.html#C-UsedInC-java.lang.String");
+        if (idx1 == -1 || idx2 == -1 || idx3 == -1) {
+            throw new Error("ctor strings not found");
+        }
+        if (idx1 > idx2 || idx2 > idx3 || idx1 > idx3) {
+            throw new Error("ctor strings are out of order");
+        }
+
+        // check methods
+        idx1 = usePage.indexOf("C.html#ymethod-int");
+        idx2 = usePage.indexOf("C.html#ymethod-java.lang.String");
+        if (idx1 == -1 || idx2 == -1) {
+            throw new Error("#ymethod strings not found");
+        }
+        if (idx1 > idx2) {
+            throw new Error("#ymethod strings are out of order");
+        }
+        System.out.println("Executable Member Ordering: OK");
+    }
+
+    static void checkClassUseOrdering(String usePage) {
+        checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zfield");
+        checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#fieldInC#ITERATION#");
+        checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#zmethod-pkg1.UsedClass");
+        checkClassUseOrdering(usePage, "pkg1/C#ITERATION#.html#methodInC#ITERATION#");
+    }
+
+    static void checkClassUseOrdering(String usePage, String searchString) {
+        int lastidx = 0;
+        System.out.println("testing for " + searchString);
+        for (int i = 1; i < 5; i++) {
+            String s = searchString.replaceAll("#ITERATION#", Integer.toString(i));
+            System.out.println(s);
+            int idx = usePage.indexOf(s);
+            if (idx < lastidx) {
+                throw new Error(s + ", member ordering error, last:" + lastidx + ", got:" + idx);
+            }
+            System.out.println("\tlast: " + lastidx + " got:" + idx);
+            lastidx = idx;
+        }
+    }
+
+    static void checkIndexPathOrdering(String indexPage) {
+        String[] OrderedExpectedStrings = {
+            "pkg1/UsedClass.html#add-java.lang.Double",
+            "pkg1/ZZTop.html#add-double",
+            "pkg1/ZZTop.html#add-java.lang.Double",
+            "pkg1/UsedClass.html#add-float",
+            "pkg1/ZZTop.html#add-float",
+            "pkg1/UsedClass.html#add-int",
+            "pkg1/ZZTop.html#add-int",
+            "pkg1/UsedClass.html#add-java.lang.Integer",
+            "pkg1/ZZTop.html#add-java.lang.Integer",
+            "pkg1/UsedClass.html#add-double-double",
+            "pkg1/UsedClass.html#add-double-java.lang.Double",
+            "pkg1/ZZTop.html#add-double-double",
+            "pkg1/ZZTop.html#add-double-java.lang.Double"
+        };
+        int lastidx = 0;
+        for (String x : OrderedExpectedStrings) {
+            int idx = indexPage.indexOf(x);
+            if (idx < lastidx) {
+                throw new Error(x + ", index is out of order, last:" + lastidx + ", got:" + idx);
+            }
+            System.out.println(x + ": OK");
+            lastidx = idx;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/UsedInC.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * An empty class
+ */
+public class UsedInC {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/C1.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+/**
+ * C1
+ */
+
+public class C1 {
+
+    /**
+     * Field in C1.
+     */
+    public UsedClass fieldInC1;
+
+    /**
+     * A duplicated field
+     */
+    public UsedClass zfield;
+
+    /**
+     * Method in C1.
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass methodInC1(UsedClass p) {return p;}
+
+    /**
+     * A duplicated method to test ordering
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass zmethod(UsedClass p) {return p;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/C2.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class C2 {
+
+    /**
+     * Field in C2.
+     */
+    public UsedClass fieldInC2;
+
+    /**
+     * another field
+     */
+    public C1 field = null;
+
+    /**
+     * A duplicated field
+     */
+    public UsedClass zfield;
+
+    /**
+     * Method in C2.
+     * @return C1
+     */
+    public C1 methodInC2() {return null;}
+
+    /**
+     * @param c1 a param
+     */
+    public void method(pkg1.C1 c1) {}
+
+    /**
+     * Method in C2.
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass methodInC2(UsedClass p) {return p;}
+
+    /**
+     * A duplicated method to test ordering
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass zmethod(UsedClass p) {
+        return p;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/C3.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class C3 {
+    /**
+     * Field in C3.
+     */
+    public UsedClass fieldInC3;
+
+    /**
+     * A duplicated field
+     */
+    public UsedClass zfield;
+
+    /**
+     * Method in C3.
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass methodInC3(UsedClass p) {return p;}
+
+    /**
+     * A duplicated method to test ordering
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass zmethod(UsedClass p) {return p;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/C4.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+
+public class C4 {
+    /**
+     * Field in C4.
+     */
+    public UsedClass fieldInC4;
+
+    /**
+     * A duplicated field
+     */
+    public UsedClass zfield;
+
+    /**
+     * Method in C4.
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass methodInC4(UsedClass p) {return p;}
+
+    /**
+     * A duplicated method to test ordering
+     * @param p a param
+     * @return UsedClass
+     */
+    public UsedClass zmethod(UsedClass p) {return p;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/UsedClass.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+/**
+ * For index and class-use testing
+ */
+public class UsedClass {
+    // This is the exact order we expect to see
+
+    /**
+     * @param i param
+     */
+    public void   add(int i){}
+
+    /**
+     * @param i param
+     * @return double
+     */
+    public int    add(Integer i) {return 0;}
+
+    /**
+     * @param d param
+     */
+    public void   add(double d){}
+
+    /**
+     * @param d param
+     * @return Double
+     */
+    public Double add(Double d) {return (double) 22/7;}
+
+    /**
+     * @param f param
+     * @return Float
+     */
+    public Float  add(float f) {return (float) 22/7;}
+
+    /**
+     * @param d1 param
+     * @param d2 param
+     * @return double
+     */
+    public double add(double d1, double d2) {return d1 + d2;}
+
+    /**
+     * @param d1 param
+     * @param d2 param
+     * @return double
+     */
+    public double add(double d1, Double  d2) {return d1 + d2;}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testOrdering/pkg1/ZZTop.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg1;
+/**
+ * For index testing only
+ */
+public class ZZTop {
+    // This is the exact order we expect to see
+
+    /**
+     * @param i param
+     */
+    public void   add(int i){}
+
+    /**
+     * @param i param
+     * @return double
+     */
+    public int    add(Integer i) {return 0;}
+
+    /**
+     * @param d param
+     */
+    public void   add(double d){}
+
+    /**
+     * @param d param
+     * @return Double
+     */
+    public Double add(Double d) {return (double) 22/7;}
+
+    /**
+     * @param f param
+     * @return Float
+     */
+    public Float  add(float f) {return (float) 22/7;}
+    /**
+     * @param d1 param
+     * @param d2 param
+     * @return double
+     */
+    public double add(double d1, double d2) {return d1 + d2;}
+
+    /**
+     * @param d1 param
+     * @param d2 param
+     * @return double
+     */
+    public double add(double d1, Double  d2) {return d1 + d2;}
+}
--- a/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSerializedFormDeprecationInfo/TestSerializedFormDeprecationInfo.java	Mon May 05 12:49:13 2014 -0700
@@ -115,19 +115,19 @@
 
     private static final String[] ARGS1 =
         new String[] {
-            "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"};
+            "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS2 =
         new String[] {
-            "-d", OUTPUT_DIR, "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
+            "-d", OUTPUT_DIR + "-2", "-nocomment", "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS3 =
         new String[] {
-            "-d", OUTPUT_DIR, "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
+            "-d", OUTPUT_DIR + "-3", "-nodeprecated", "-sourcepath", SRC_DIR, "pkg1"};
 
     private static final String[] ARGS4 =
         new String[] {
-            "-d", OUTPUT_DIR, "-nocomment", "-nodeprecated", "-sourcepath",
+            "-d", OUTPUT_DIR + "-4", "-nocomment", "-nodeprecated", "-sourcepath",
             SRC_DIR, "pkg1"};
 
     /**
--- a/langtools/test/com/sun/javadoc/testSinceTag/TestSinceTag.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testSinceTag/TestSinceTag.java	Mon May 05 12:49:13 2014 -0700
@@ -35,11 +35,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS1 = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg1"
+        "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg1"
     };
 
     private static final String[] ARGS2 = new String[] {
-        "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "-nosince", "pkg1"
+        "-d", OUTPUT_DIR + "-2", "-sourcepath", SRC_DIR, "-nosince", "pkg1"
     };
 
     //Input for string search tests.
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Mon May 05 12:49:13 2014 -0700
@@ -39,11 +39,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS1 = new String[]{
-        "-d", OUTPUT_DIR, "-use", "-sourcepath", SRC_DIR,
+        "-d", OUTPUT_DIR + "-1", "-use", "-sourcepath", SRC_DIR,
         "pkg"
     };
     private static final String[] ARGS2 = new String[]{
-        "-d", OUTPUT_DIR, "-linksource", "-sourcepath", SRC_DIR,
+        "-d", OUTPUT_DIR + "-2", "-linksource", "-sourcepath", SRC_DIR,
         "pkg"
     };
 
--- a/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testWarnings/TestWarnings.java	Mon May 05 12:49:13 2014 -0700
@@ -40,11 +40,11 @@
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
-        "-Xdoclint:none", "-d", OUTPUT_DIR, "-sourcepath", SRC_DIR, "pkg"
+        "-Xdoclint:none", "-d", OUTPUT_DIR + "-1", "-sourcepath", SRC_DIR, "pkg"
     };
 
     private static final String[] ARGS2 = new String[] {
-        "-Xdoclint:none", "-d", OUTPUT_DIR, "-private", "-sourcepath", SRC_DIR,
+        "-Xdoclint:none", "-d", OUTPUT_DIR + "-2", "-private", "-sourcepath", SRC_DIR,
         "pkg"
     };
 
@@ -78,7 +78,6 @@
     public static void main(String[] args) {
         TestWarnings tester = new TestWarnings();
         tester.run(ARGS, TEST, NEGATED_TEST);
-        tester.run(ARGS, TEST, NEGATED_TEST);
         tester.run(ARGS2, TEST2, NO_TEST);
         tester.printSummary();
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/DefiniteAssignment/T8039026.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8039026
+ * @summary Definitely unassigned field can be accessed
+ * @compile/fail/ref=T8039026.out -XDrawDiagnostics T8039026.java
+ */
+
+public class T8039026 {
+    final int x,y,z;
+    final int a = this.y;  // <- error
+    {
+        int b = true ? this.x : 0;  // <- error
+        System.out.println(this.x); // <- error
+        this.y = 1;
+    }
+    T8039026() {
+        this.x = 1;      // <- no error!
+        this.y = 1;      // <- error
+        this.z = this.x; // <- no error
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/DefiniteAssignment/T8039026.out	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,4 @@
+T8039026.java:10:23: compiler.err.var.might.not.have.been.initialized: y
+T8039026.java:12:28: compiler.err.var.might.not.have.been.initialized: x
+T8039026.java:18:13: compiler.err.var.might.already.be.assigned: y
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/Paths/AbsolutePathTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8030046
+ * @summary javac incorrectly handles absolute paths in manifest classpath
+ * @author govereau
+ * @library /tools/javac/lib
+ * @build ToolBox
+ * @run main AbsolutePathTest
+ */
+
+import java.io.File;
+
+public class AbsolutePathTest {
+    public static void main(String... cmdline) throws Exception {
+        // compile test.Test
+        ToolBox.JavaToolArgs args = new ToolBox.JavaToolArgs();
+        args.appendArgs("-d", "."); // this is needed to get the classfiles in test
+        ToolBox.javac(args.setSources("package test; public class Test{}"));
+
+        // build test.jar containing test.Test
+        // we need the jars in a directory different from the working
+        // directory to trigger the bug. I will reuse test/
+        ToolBox.jar("cf", "test/test.jar", "test/Test.class");
+
+        // build second jar in test directory using
+        // an absolute path reference to the first jar
+        String path = new File("test/test.jar").getAbsolutePath();
+        ToolBox.mkManifestWithClassPath(null, path);
+        ToolBox.jar("cfm", "test/test2.jar", "MANIFEST.MF");
+
+        // this should not fail
+        args.appendArgs("-cp", ".");
+        ToolBox.javac(args.setSources("import test.Test; class Test2 {}"));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029102/WarnSerializableLambdaTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,241 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8029102
+ * @summary Enhance compiler warnings for Lambda
+ *     Checks that the warning for accessing non public members of a class is
+ *     fired correctly.
+ * @compile/fail/ref=WarnSerializableLambdaTest.out -XDrawDiagnostics -Werror -XDwarnOnAccessToSensitiveMembers WarnSerializableLambdaTest.java
+ */
+
+import java.io.Serializable;
+
+public class WarnSerializableLambdaTest {
+
+    void warnLambda() throws Exception {
+        SAM t3 = (SAM & Serializable)WarnSerializableLambdaTest::packageClassMethod;
+        SAM t4 = (SAM & Serializable)WarnSerializableLambdaTest::protectedClassMethod;
+        SAM t5 = (SAM & Serializable)WarnSerializableLambdaTest::privateClassMethod;
+
+        WarnSerializableLambdaTest test = new WarnSerializableLambdaTest();
+        SAM t6 = (SAM & Serializable)test::packageInstanceMethod;
+        SAM t7 = (SAM & Serializable)test::protectedInstanceMethod;
+        SAM t8 = (SAM & Serializable)test::privateInstanceMethod;
+
+        SAM t9 = (SAM & Serializable) c -> {
+
+            WarnSerializableLambdaTest.staticPackageField = "";
+            WarnSerializableLambdaTest.staticProtectedField = "";
+            WarnSerializableLambdaTest.staticPrivateField = "";
+
+            packageField = "";
+            protectedField = "";
+            privateField = "";
+
+            WarnSerializableLambdaTest.packageClassMethod(null);
+            WarnSerializableLambdaTest.protectedClassMethod(null);
+            WarnSerializableLambdaTest.privateClassMethod(null);
+
+            packageInstanceMethod(null);
+            protectedInstanceMethod(null);
+            privateInstanceMethod(null);
+
+            PrivateClass.effectivelyNonPublicStaticField = "";
+            PrivateClass.effectivelyNonPublicClassMethod();
+
+            PrivateClass p = new PrivateClass();
+            p.effectivelyNonPublicInstanceField = "";
+            p.effectivelyNonPublicInstanceMethod();
+
+            return null;
+        };
+    }
+
+    private void warnAnoInnerClass() throws Exception {
+        new SerializableDesc() {
+            public void m(Object param) throws Exception {
+                WarnSerializableLambdaTest.staticPackageField = "";
+                WarnSerializableLambdaTest.staticProtectedField = "";
+                WarnSerializableLambdaTest.staticPrivateField = "";
+
+                packageField = "";
+                protectedField = "";
+                privateField = "";
+
+                WarnSerializableLambdaTest.packageClassMethod(null);
+                WarnSerializableLambdaTest.protectedClassMethod(null);
+                WarnSerializableLambdaTest.privateClassMethod(null);
+
+                packageInstanceMethod(null);
+                protectedInstanceMethod(null);
+                privateInstanceMethod(null);
+
+                PrivateClass.effectivelyNonPublicStaticField = "";
+                PrivateClass.effectivelyNonPublicClassMethod();
+
+                PrivateClass p = new PrivateClass();
+                p.effectivelyNonPublicInstanceField = "";
+                p.effectivelyNonPublicInstanceMethod();
+            }
+        };
+    }
+
+    void dontWarnLambda() throws Exception {
+        SAM t1 = (SAM & Serializable)WarnSerializableLambdaTest::publicClassMethod;
+
+        WarnSerializableLambdaTest test = new WarnSerializableLambdaTest();
+        SAM t2 = (SAM & Serializable)test::publicInstanceMethod;
+
+        int[] buffer = {0};
+
+        SAM t3 = (SAM & Serializable) param -> {
+            Object localVar;
+            localVar = null;
+            param = null;
+
+            WarnSerializableLambdaTest.staticPublicField = "";
+            publicField = "";
+            WarnSerializableLambdaTest.publicClassMethod(null);
+            publicInstanceMethod(null);
+
+            PublicClass.effectivelyPublicStaticField = "";
+            PublicClass.effectivelyPublicClassMethod();
+
+            PublicClass p = new PublicClass();
+            p.effectivelyPublicInstanceField = "";
+            p.effectivelyPublicInstanceMethod();
+
+            int l = buffer.length;
+
+            return null;
+        };
+    }
+
+    private void dontWarnAnoInnerClass() throws Exception {
+        final int[] buffer = {0};
+        new SerializableDesc() {
+            public void m(Object param) throws Exception {
+                Object localVar;
+                localVar = null;
+                param = null;
+
+                WarnSerializableLambdaTest.staticPublicField = "";
+                publicField = "";
+                WarnSerializableLambdaTest.publicClassMethod(null);
+                publicInstanceMethod(null);
+
+                PublicClass.effectivelyPublicStaticField = "";
+                PublicClass.effectivelyPublicClassMethod();
+
+                PublicClass p = new PublicClass();
+                p.effectivelyPublicInstanceField = "";
+                p.effectivelyPublicInstanceMethod();
+
+                int l = buffer.length;
+            }
+        };
+    }
+
+    enum WarnEnum {
+        A {
+            public void m() throws Exception {
+                WarnSerializableLambdaTest.staticPackageField = "";
+                WarnSerializableLambdaTest.staticProtectedField = "";
+                WarnSerializableLambdaTest.staticPrivateField = "";
+
+                WarnSerializableLambdaTest test =
+                        new WarnSerializableLambdaTest();
+
+                test.packageField = "";
+                test.protectedField = "";
+                test.privateField = "";
+
+                WarnSerializableLambdaTest.packageClassMethod(null);
+                WarnSerializableLambdaTest.protectedClassMethod(null);
+                WarnSerializableLambdaTest.privateClassMethod(null);
+
+                test.packageInstanceMethod(null);
+                test.protectedInstanceMethod(null);
+                test.privateInstanceMethod(null);
+
+                PrivateClass.effectivelyNonPublicStaticField = "";
+                PrivateClass.effectivelyNonPublicClassMethod();
+
+                PrivateClass p = new PrivateClass();
+                p.effectivelyNonPublicInstanceField = "";
+                p.effectivelyNonPublicInstanceMethod();
+            }
+        };
+
+        public void m() throws Exception {}
+    }
+
+    static String staticPackageField;
+    static private String staticPrivateField;
+    static protected String staticProtectedField;
+    static public String staticPublicField;
+
+    String packageField;
+    private String privateField;
+    protected String protectedField;
+    public String publicField;
+
+    static Object packageClassMethod(String s) {
+        return null;
+    }
+
+    static private Object privateClassMethod(String s) {
+        return null;
+    }
+
+    static protected Object protectedClassMethod(String s) {
+        return null;
+    }
+
+    static public Object publicClassMethod(String s) {
+        return null;
+    }
+
+    Object packageInstanceMethod(String s) {
+        return null;
+    }
+
+    protected Object protectedInstanceMethod(String s) {
+        return null;
+    }
+
+    private Object privateInstanceMethod(String s) {
+        return null;
+    }
+
+    public Object publicInstanceMethod(String s) {
+        return null;
+    }
+
+    interface SAM {
+        Object apply(String s) throws Exception;
+    }
+
+    interface SAM2 {
+        Object apply(String arg1, String arg2);
+    }
+
+    class SerializableDesc implements Serializable {
+        public void m(Object param) throws Exception {}
+    }
+
+    static private class PrivateClass {
+        static public String effectivelyNonPublicStaticField;
+        public String effectivelyNonPublicInstanceField;
+
+        static public void effectivelyNonPublicClassMethod() {}
+        public void effectivelyNonPublicInstanceMethod() {}
+    }
+
+    static public class PublicClass {
+        static public String effectivelyPublicStaticField;
+        public String effectivelyPublicInstanceField;
+
+        static public void effectivelyPublicClassMethod() {}
+        public void effectivelyPublicInstanceMethod() {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029102/WarnSerializableLambdaTest.out	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,57 @@
+WarnSerializableLambdaTest.java:15:38: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:16:38: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:17:38: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:20:38: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:21:38: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:22:38: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:26:39: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPackageField
+WarnSerializableLambdaTest.java:27:39: compiler.warn.access.to.sensitive.member.from.serializable.element: staticProtectedField
+WarnSerializableLambdaTest.java:28:39: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPrivateField
+WarnSerializableLambdaTest.java:30:13: compiler.warn.access.to.sensitive.member.from.serializable.element: packageField
+WarnSerializableLambdaTest.java:31:13: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedField
+WarnSerializableLambdaTest.java:32:13: compiler.warn.access.to.sensitive.member.from.serializable.element: privateField
+WarnSerializableLambdaTest.java:34:39: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:35:39: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:36:39: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:38:13: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:39:13: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:40:13: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:42:25: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicStaticField
+WarnSerializableLambdaTest.java:43:25: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicClassMethod()
+WarnSerializableLambdaTest.java:46:14: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceField
+WarnSerializableLambdaTest.java:47:14: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceMethod()
+WarnSerializableLambdaTest.java:56:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPackageField
+WarnSerializableLambdaTest.java:57:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticProtectedField
+WarnSerializableLambdaTest.java:58:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPrivateField
+WarnSerializableLambdaTest.java:60:17: compiler.warn.access.to.sensitive.member.from.serializable.element: packageField
+WarnSerializableLambdaTest.java:61:17: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedField
+WarnSerializableLambdaTest.java:62:17: compiler.warn.access.to.sensitive.member.from.serializable.element: privateField
+WarnSerializableLambdaTest.java:64:43: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:65:43: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:66:43: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:68:17: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:69:17: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:70:17: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:72:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicStaticField
+WarnSerializableLambdaTest.java:73:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicClassMethod()
+WarnSerializableLambdaTest.java:76:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceField
+WarnSerializableLambdaTest.java:77:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceMethod()
+WarnSerializableLambdaTest.java:141:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPackageField
+WarnSerializableLambdaTest.java:142:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticProtectedField
+WarnSerializableLambdaTest.java:143:43: compiler.warn.access.to.sensitive.member.from.serializable.element: staticPrivateField
+WarnSerializableLambdaTest.java:148:21: compiler.warn.access.to.sensitive.member.from.serializable.element: packageField
+WarnSerializableLambdaTest.java:149:21: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedField
+WarnSerializableLambdaTest.java:150:21: compiler.warn.access.to.sensitive.member.from.serializable.element: privateField
+WarnSerializableLambdaTest.java:152:43: compiler.warn.access.to.sensitive.member.from.serializable.element: packageClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:153:43: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:154:43: compiler.warn.access.to.sensitive.member.from.serializable.element: privateClassMethod(java.lang.String)
+WarnSerializableLambdaTest.java:156:21: compiler.warn.access.to.sensitive.member.from.serializable.element: packageInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:157:21: compiler.warn.access.to.sensitive.member.from.serializable.element: protectedInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:158:21: compiler.warn.access.to.sensitive.member.from.serializable.element: privateInstanceMethod(java.lang.String)
+WarnSerializableLambdaTest.java:160:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicStaticField
+WarnSerializableLambdaTest.java:161:29: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicClassMethod()
+WarnSerializableLambdaTest.java:164:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceField
+WarnSerializableLambdaTest.java:165:18: compiler.warn.access.to.sensitive.member.from.serializable.element: effectivelyNonPublicInstanceMethod()
+- compiler.err.warnings.and.werror
+1 error
+54 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029102/WarnSerializableLambdaTestb.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,56 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8029102
+ * @summary Enhance compiler warnings for Lambda
+ *     Checks that the warning for accessing non public members of a class is
+ *     fired correctly.
+ * @compile/fail/ref=WarnSerializableLambdaTestb.out -XDrawDiagnostics -Werror -XDwarnOnAccessToSensitiveMembers WarnSerializableLambdaTestb.java
+ */
+
+import java.io.Serializable;
+
+public class WarnSerializableLambdaTestb {
+     public void foo(Secret1 secret) {
+         Object o = (Runnable & java.io.Serializable) () -> { secret.test(); };
+     }
+
+     public void bar(Secret2 secret) {
+         Object o = (Runnable & java.io.Serializable) () -> { secret.test(); };
+     }
+
+     private class Secret1 {
+         public void test() {}
+     }
+
+     static private class Secret2 {
+         public void test() {}
+     }
+
+     class TestInner {
+        private int j = 0;
+        void m() {
+            Serializable s = new Serializable() {
+                int i;
+                void m() {
+                    i = 0;  // don't warn
+                    System.out.println(j); //warn
+                }
+            };
+        }
+    }
+
+    class TestInner2 {
+        class W implements Serializable {
+            public int p = 0;
+            class I {
+                public int r = 0;
+                class K implements Serializable {
+                    void m() {
+                        p = 1;  // don't warn owner is serializable
+                        r = 2;  // warn owner is not serializable
+                    }
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/T8029102/WarnSerializableLambdaTestb.out	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,7 @@
+WarnSerializableLambdaTestb.java:14:69: compiler.warn.access.to.sensitive.member.from.serializable.element: test()
+WarnSerializableLambdaTestb.java:18:69: compiler.warn.access.to.sensitive.member.from.serializable.element: test()
+WarnSerializableLambdaTestb.java:36:40: compiler.warn.access.to.sensitive.member.from.serializable.element: j
+WarnSerializableLambdaTestb.java:50:25: compiler.warn.access.to.sensitive.member.from.serializable.element: r
+- compiler.err.warnings.and.werror
+1 error
+4 warnings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 local variable table attribute test.
+ * @bug 8040097
+ * @library /tools/javac/lib ../lib
+ * @build LocalVariableTestBase TestBase InMemoryFileManager ToolBox
+ * @compile -g LocalVariableTableTest.java
+ * @run main LocalVariableTableTest
+ */
+
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.LocalVariableTable_attribute;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toList;
+
+public class LocalVariableTableTest extends LocalVariableTestBase {
+
+    public LocalVariableTableTest(Class<?> clazz) {
+        super(clazz);
+    }
+
+    public static void main(String[] args) throws IOException {
+        new LocalVariableTableTest(LocalVariableTableTest.class).test();
+    }
+
+    @ExpectedLocals(name = "l", type = "D")
+    @ExpectedLocals(name = "i", type = "J")
+    public static void onlyTwoCellParameters(double l, long i) {
+    }
+
+    @ExpectedLocals(name = "l", type = "D")
+    @ExpectedLocals(name = "dl", type = "D")
+    @ExpectedLocals(name = "i", type = "J")
+    @ExpectedLocals(name = "il", type = "J")
+    @ExpectedLocals(name = "d", type = "J")
+    @ExpectedLocals(name = "ll", type = "J")
+    public static void onlyTwoCellLocals(double l, long i, long d) {
+        double dl = 1.1;
+        long il = 1;
+        long ll = 1;
+    }
+
+    @Override
+    protected List<VariableTable> getVariableTables(Code_attribute codeAttribute) {
+        return Stream.of(codeAttribute.attributes.attrs)
+                .filter(at -> at instanceof LocalVariableTable_attribute)
+                .map(at -> (LocalVariableTable_attribute) at)
+                .map((t) -> new LocalVariableTable(t)).collect(toList());
+    }
+
+    @ExpectedLocals(name = "l", type = "J")
+    @ExpectedLocals(name = "i", type = "I")
+    @ExpectedLocals(name = "d", type = "D")
+    @ExpectedLocals(name = "ll", type = "J")
+    @ExpectedLocals(name = "obj", type = "Ljava/lang/Object;")
+    @ExpectedLocals(name = "dd", type = "D")
+    @ExpectedLocals(name = "bb", type = "B")
+    @ExpectedLocals(name = "this", type = "LLocalVariableTableTest;")
+    public double longDoubleOverlap(long l, int i, double d) {
+        long ll = 1L;
+        Object obj = 2;
+        double dd = 3.0;
+        byte bb = 0;
+        return l + i + d + ll + Integer.valueOf(obj.toString()) + dd + bb;
+    }
+
+    @ExpectedLocals(name = "bool", type = "Z")
+    @ExpectedLocals(name = "b", type = "B")
+    @ExpectedLocals(name = "ch", type = "C")
+    @ExpectedLocals(name = "sh", type = "S")
+    @ExpectedLocals(name = "i", type = "I")
+    @ExpectedLocals(name = "l", type = "J")
+    @ExpectedLocals(name = "d", type = "D")
+    @ExpectedLocals(name = "f", type = "F")
+    @ExpectedLocals(name = "ref", type = "Ljava/lang/Integer;")
+    @ExpectedLocals(name = "arr", type = "[Ljava/lang/Integer;")
+    @ExpectedLocals(name = "this", type = "LLocalVariableTableTest;")
+    public void allTypesWithoutParameters() {
+        boolean bool = true;
+        byte b = 0x1;
+        char ch = 'a';
+        short sh = 1_1;
+        int i = -2;
+        long l = 1L;
+        float f = 1.1f;
+        double d = 0.1;
+        Integer ref = 2;
+        Integer[] arr = null;
+    }
+
+    @ExpectedLocals(name = "bool", type = "Z")
+    @ExpectedLocals(name = "b", type = "B")
+    @ExpectedLocals(name = "ch", type = "C")
+    @ExpectedLocals(name = "sh", type = "S")
+    @ExpectedLocals(name = "i", type = "I")
+    @ExpectedLocals(name = "l", type = "J")
+    @ExpectedLocals(name = "d", type = "D")
+    @ExpectedLocals(name = "f", type = "F")
+    @ExpectedLocals(name = "ref", type = "Ljava/lang/Integer;")
+    @ExpectedLocals(name = "this", type = "LLocalVariableTableTest;")
+    public void allTypesWithParameters(boolean bool, byte b, char ch) {
+        short sh = 1_1;
+        int i = -2;
+        long l = 1L;
+        float f = 1.1f;
+        double d = 0.1;
+        Integer ref = 2;
+    }
+
+    @ExpectedLocals(name = "list", type = "Ljava/util/List;")
+    @ExpectedLocals(name = "list2", type = "[Ljava/util/List;")
+    @ExpectedLocals(name = "p", type = "Ljava/lang/Object;")
+    @ExpectedLocals(name = "k", type = "Ljava/lang/Integer;")
+    @ExpectedLocals(name = "i", type = "I")
+    @ExpectedLocals(name = "this", type = "LLocalVariableTableTest;")
+    public <T extends List<Integer>, P, K extends Integer> void genericType(K k) {
+        T list = null;
+        int i = 0;
+        P p = null;
+        List<T>[] list2 = null;
+    }
+
+    @ExpectedLocals(name = "this", type = "LLocalVariableTableTest;")
+    @ExpectedLocals(name = "inWhile", type = "I")
+    @ExpectedLocals(name = "inTry", type = "D")
+    @ExpectedLocals(name = "inSync", type = "F")
+    @ExpectedLocals(name = "inDo", type = "B")
+    @ExpectedLocals(name = "inSwitch", type = "S")
+    @ExpectedLocals(name = "inFor", type = "J")
+    @ExpectedLocals(name = "s", type = "Ljava/util/stream/Stream;")
+    public void deepScope() {
+        {
+            while (true) {
+                int inWhile = 0;
+                for (long inFor : Arrays.asList(0)) {
+                    try (Stream<? extends Integer> s = Stream.of(0)) {
+                        double inTry = 0.0;
+                        synchronized (this) {
+                            float inSync = -1.0f;
+                            do {
+                                byte inDo = 0;
+                                switch (1) {
+                                    default:
+                                        short inSwitch = 100;
+                                }
+                            } while (true);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    @ExpectedLocals(name = "i", type = "I", scope = 0)
+    @ExpectedLocals(name = "i", type = "J", scope = 1)
+    public void reuseByLong() {
+        {
+            int i = 0;
+        }
+        {
+            long i = 1;
+        }
+    }
+
+    class LocalVariableTable implements VariableTable {
+
+        final LocalVariableTable_attribute att;
+
+        public LocalVariableTable(LocalVariableTable_attribute att) {
+            this.att = att;
+        }
+
+        @Override
+        public int localVariableTableLength() {
+            return att.local_variable_table_length;
+        }
+
+        @Override
+        public List<Entry> entries() {
+            return Stream.of(att.local_variable_table).map(LocalVariableTableEntry::new).collect(toList());
+        }
+
+        @Override
+        public int attributeLength() {
+            return att.attribute_length;
+        }
+
+        private class LocalVariableTableEntry implements Entry {
+
+            final LocalVariableTable_attribute.Entry entry;
+
+            private LocalVariableTableEntry(LocalVariableTable_attribute.Entry entry) {
+                this.entry = entry;
+            }
+
+            @Override
+            public int index() {
+                return entry.index;
+            }
+
+            @Override
+            public int startPC() {
+                return entry.start_pc;
+            }
+
+            @Override
+            public int length() {
+                return entry.length;
+            }
+
+            @Override
+            public String name() {
+                return getString(entry.name_index);
+            }
+
+            @Override
+            public String type() {
+                return getString(entry.descriptor_index);
+            }
+
+            @Override
+            public String toString() {
+                return dump();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTestBase.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 com.sun.tools.classfile.*;
+
+import java.io.IOException;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+
+import static java.lang.String.format;
+import static java.util.stream.Collectors.*;
+
+
+public abstract class LocalVariableTestBase extends TestBase {
+    public static final int DEFAULT_SCOPE = 0;
+    private final ClassFile classFile;
+    private final Class<?> clazz;
+
+    protected abstract List<VariableTable> getVariableTables(Code_attribute codeAttribute);
+
+    public LocalVariableTestBase(Class<?> clazz) {
+        this.clazz = clazz;
+        try {
+            this.classFile = ClassFile.read(getClassFile(clazz));
+        } catch (IOException | ConstantPoolException e) {
+            throw new IllegalArgumentException("Can't read classfile for specified class", e);
+        }
+    }
+
+
+    //info in the LocalVariableTable attribute is compared against expected info stored in annotations
+    public void test() throws IOException {
+        List<java.lang.reflect.Method> testMethods = Stream.of(clazz.getDeclaredMethods())
+                .filter(m -> m.getAnnotationsByType(ExpectedLocals.class).length > 0)
+                .collect(toList());
+        int failed = 0;
+        for (java.lang.reflect.Method method : testMethods) {
+            try {
+                Map<String, String> expectedLocals2Types = new HashMap<>();
+                Map<String, Integer> sig2scope = new HashMap<>();
+                for (ExpectedLocals anno : method.getDeclaredAnnotationsByType(ExpectedLocals.class)) {
+                    expectedLocals2Types.put(anno.name(), anno.type());
+                    sig2scope.put(anno.name() + "&" + anno.type(), anno.scope());
+                }
+
+                test(method.getName(), expectedLocals2Types, sig2scope);
+            } catch (AssertionFailedException ex) {
+                System.err.printf("Test %s failed.%n", method.getName());
+                ex.printStackTrace();
+                failed++;
+            }
+        }
+        if (failed > 0)
+            throw new RuntimeException(format("Failed %d out of %d. See logs.", failed, testMethods.size()));
+    }
+
+    public void test(String methodName, Map<String, String> expectedLocals2Types, Map<String, Integer> sig2scope)
+            throws IOException {
+
+        for (Method m : classFile.methods) {
+            String mName = getString(m.name_index);
+            if (methodName.equals(mName)) {
+                System.out.println("Testing local variable table in method " + mName);
+                Code_attribute code_attribute = (Code_attribute) m.attributes.get(Attribute.Code);
+
+                List<? extends VariableTable> variableTables = getVariableTables(code_attribute);
+                generalLocalVariableTableCheck(variableTables);
+
+                List<VariableTable.Entry> entries = variableTables.stream()
+                        .flatMap(table -> table.entries().stream())
+                        .collect(toList());
+
+                generalEntriesCheck(entries, code_attribute);
+                assertIndexesAreUnique(entries, sig2scope);
+                checkNamesAndTypes(entries, expectedLocals2Types);
+                checkDoubleAndLongIndexes(entries, sig2scope, code_attribute.max_locals);
+            }
+        }
+    }
+
+    private void generalLocalVariableTableCheck(List<? extends VariableTable> variableTables) {
+        for (VariableTable localTable : variableTables) {
+            //only one per variable.
+            assertEquals(localTable.localVariableTableLength(),
+                    localTable.entries().size(), "Incorrect local variable table length");
+            //attribute length is offset(line_number_table_length) + element_size*element_count
+            assertEquals(localTable.attributeLength(),
+                    2 + (5 * 2) * localTable.localVariableTableLength(), "Incorrect attribute length");
+        }
+    }
+
+    private void generalEntriesCheck(List<VariableTable.Entry> entries, Code_attribute code_attribute) {
+        for (VariableTable.Entry e : entries) {
+            assertTrue(e.index() >= 0 && e.index() < code_attribute.max_locals,
+                    "Index " + e.index() + " out of variable array. Size of array is " + code_attribute.max_locals);
+            assertTrue(e.startPC() >= 0, "StartPC is less then 0. StartPC = " + e.startPC());
+            assertTrue(e.length() >= 0, "Length is less then 0. Length = " + e.length());
+            assertTrue(e.startPC() + e.length() <= code_attribute.code_length,
+                    format("StartPC+Length > code length.%n" +
+                            "%s%n" +
+                            "code_length = %s"
+                            , e, code_attribute.code_length));
+        }
+    }
+
+    private void checkNamesAndTypes(List<LocalVariableTableTest.LocalVariableTable.Entry> entries,
+                                    Map<String, String> expectedLocals2Types) {
+        Map<String, List<String>> actualNames2Types = entries.stream()
+                .collect(
+                        groupingBy(VariableTable.Entry::name,
+                                mapping(VariableTable.Entry::type, toList())));
+        for (Map.Entry<String, String> name2type : expectedLocals2Types.entrySet()) {
+            String name = name2type.getKey();
+            String type = name2type.getValue();
+
+            assertTrue(actualNames2Types.containsKey(name),
+                    format("There is no record for local variable %s%nEntries: %s", name, entries));
+
+            assertTrue(actualNames2Types.get(name).contains(type),
+                    format("Types are different for local variable %s%nExpected type: %s%nActual type: %s",
+                            name, type, actualNames2Types.get(name)));
+        }
+    }
+
+
+    private void assertIndexesAreUnique(Collection<VariableTable.Entry> entries, Map<String, Integer> scopes) {
+        //check every scope separately
+        Map<Object, List<VariableTable.Entry>> entriesByScope = groupByScope(entries, scopes);
+        for (Map.Entry<Object, List<VariableTable.Entry>> mapEntry : entriesByScope.entrySet()) {
+            mapEntry.getValue().stream()
+                    .collect(groupingBy(VariableTable.Entry::index))
+                    .entrySet()
+                    .forEach(e ->
+                            assertTrue(e.getValue().size() == 1,
+                                    "Multiple variables point to the same index in common scope. " + e.getValue()));
+        }
+
+    }
+
+    private void checkDoubleAndLongIndexes(Collection<LocalVariableTableTest.LocalVariableTable.Entry> entries,
+                                           Map<String, Integer> scopes, int maxLocals) {
+        //check every scope separately
+        Map<Object, List<VariableTable.Entry>> entriesByScope = groupByScope(entries, scopes);
+        for (List<VariableTable.Entry> entryList : entriesByScope.values()) {
+            Map<Integer, VariableTable.Entry> index2Entry = entryList.stream()
+                    .collect(toMap(VariableTable.Entry::index, e -> e));
+
+            entryList.stream()
+                    .filter(e -> "J".equals(e.type()) || "D".equals(e.type()))
+                    .forEach(e -> {
+                        assertTrue(e.index() + 1 < maxLocals,
+                                format("Index %s is out of variable array. Long and double occupy 2 cells." +
+                                        " Size of array is %d", e.index() + 1, maxLocals));
+                        assertTrue(!index2Entry.containsKey(e.index() + 1),
+                                format("An entry points to the second cell of long/double entry.%n%s%n%s", e,
+                                        index2Entry.get(e.index() + 1)));
+                    });
+        }
+    }
+
+    private Map<Object, List<VariableTable.Entry>> groupByScope(
+            Collection<LocalVariableTableTest.LocalVariableTable.Entry> entries, Map<String, Integer> scopes) {
+        return entries.stream().collect(groupingBy(e -> scopes.getOrDefault(e.name() + "&" + e.type(), DEFAULT_SCOPE)));
+    }
+
+    protected String getString(int i) {
+        try {
+            return classFile.constant_pool.getUTF8Info(i).value;
+        } catch (ConstantPool.InvalidIndex | ConstantPool.UnexpectedEntry ex) {
+            ex.printStackTrace();
+            throw new AssertionFailedException("Issue while reading constant pool");
+        }
+    }
+
+
+    interface VariableTable {
+
+        int localVariableTableLength();
+
+        List<LocalVariableTableTest.VariableTable.Entry> entries();
+
+        int attributeLength();
+
+        interface Entry {
+
+            int index();
+
+            int startPC();
+
+            int length();
+
+            String name();
+
+            String type();
+
+            default String dump() {
+                return format("Entry{" +
+                        "%n    name    = %s" +
+                        "%n    type    = %s" +
+                        "%n    index   = %d" +
+                        "%n    startPC = %d" +
+                        "%n    length  = %d" +
+                        "%n}", name(), type(), index(), startPC(), length());
+            }
+        }
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @Repeatable(Container.class)
+    @interface ExpectedLocals {
+        String name();
+
+        String type();
+
+        //variables from different scopes can share local variable table index and/or name.
+        int scope() default DEFAULT_SCOPE;
+    }
+
+    @Retention(RetentionPolicy.RUNTIME)
+    @interface Container {
+        ExpectedLocals[] value();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 local variable type table attribute test.
+ * @bug 8040097
+ * @library /tools/javac/lib ../lib
+ * @build LocalVariableTestBase TestBase InMemoryFileManager ToolBox
+ * @compile -g LocalVariableTypeTableTest.java
+ * @run main LocalVariableTypeTableTest
+ */
+
+import com.sun.tools.classfile.Code_attribute;
+import com.sun.tools.classfile.LocalVariableTypeTable_attribute;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.function.Supplier;
+import java.util.stream.Stream;
+
+import static java.util.stream.Collectors.toList;
+
+public class LocalVariableTypeTableTest<THIS> extends LocalVariableTestBase {
+
+    public LocalVariableTypeTableTest(Class<?> clazz) {
+        super(clazz);
+    }
+
+    public static void main(String[] args) throws IOException {
+        new LocalVariableTypeTableTest(LocalVariableTypeTableTest.class).test();
+    }
+
+    @Override
+    protected List<VariableTable> getVariableTables(Code_attribute codeAttribute) {
+        return Stream.of(codeAttribute.attributes.attrs)
+                .filter(at -> at instanceof LocalVariableTypeTable_attribute)
+                .map(at -> (LocalVariableTypeTable_attribute) at)
+                .map(LocalVariableTypeTable::new).collect(toList());
+    }
+
+    @ExpectedLocals(name = "list", type = "TT;")
+    @ExpectedLocals(name = "p", type = "[TP;")
+    @ExpectedLocals(name = "k", type = "TK;")
+    @ExpectedLocals(name = "c1", type = "Ljava/util/Collection<-Ljava/lang/Integer;>;")
+    @ExpectedLocals(name = "c2", type = "Ljava/util/Collection<*>;")
+    @ExpectedLocals(name = "c3", type = "Ljava/util/Collection<+TE;>;")
+    public <T extends List<Integer>, P, K extends Integer, E extends Supplier & Runnable>
+    void genericTypeWithParametersOnly(K k, T list, P[] p,
+                                       Collection<? super Integer> c1,
+                                       Collection<?> c2, Collection<? extends E> c3) {
+    }
+
+    @ExpectedLocals(name = "list", type = "TT;")
+    @ExpectedLocals(name = "p", type = "[TP;")
+    @ExpectedLocals(name = "k", type = "TK;")
+    @ExpectedLocals(name = "c1", type = "Ljava/util/Collection<-Ljava/lang/Integer;>;")
+    @ExpectedLocals(name = "c2", type = "Ljava/util/Collection<*>;")
+    @ExpectedLocals(name = "c3", type = "Ljava/util/Collection<+TE;>;")
+    public <T extends List<Integer>, P, K extends Integer, E extends Supplier & Runnable>
+    void genericType(K k, T list, P[] p) {
+        Collection<? super Integer> c1 = null;
+        Collection<?> c2 = null;
+        Collection<? extends E> c3 = null;
+    }
+
+    @ExpectedLocals(name = "list", type = "TT;")
+    @ExpectedLocals(name = "p", type = "[[TP;")
+    public <T extends List<Integer>, P, K extends Integer> void genericTypeWithoutParameters() {
+        T list = null;
+        list.add(1);
+        int i = 0;
+        P[][] p = null;
+    }
+
+    @ExpectedLocals(name = "this", type = "LLocalVariableTypeTableTest<TTHIS;>;")
+    public void genericThis() {
+    }
+
+    @ExpectedLocals(name = "this", type = "LLocalVariableTypeTableTest<TTHIS;>;")
+    @ExpectedLocals(name = "inWhile", type = "TTHIS;")
+    @ExpectedLocals(name = "inTry", type = "TTHIS;")
+    @ExpectedLocals(name = "inSync", type = "TTHIS;")
+    @ExpectedLocals(name = "inDo", type = "TTHIS;")
+    @ExpectedLocals(name = "inSwitch", type = "TTHIS;")
+    @ExpectedLocals(name = "inFor", type = "LLocalVariableTypeTableTest<-TTHIS;>;")
+    @ExpectedLocals(name = "s", type = "Ljava/util/stream/Stream<+Ljava/lang/Integer;>;")
+    public void deepScope() {
+        {
+            while (true) {
+                THIS inWhile = null;
+                for (LocalVariableTypeTableTest<? super THIS> inFor : Arrays.asList(this)) {
+                    try (Stream<? extends Integer> s = Stream.of(0)) {
+                        THIS inTry = null;
+                        synchronized (this) {
+                            THIS inSync = null;
+                            do {
+                                THIS inDo = null;
+                                switch (1) {
+                                    default:
+                                        THIS inSwitch = null;
+                                }
+                            } while (true);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    @ExpectedLocals(name = "i", type = "TTHIS;", scope = 0)
+    @ExpectedLocals(name = "i", type = "Ljava/util/List<TTHIS;>;", scope = 1)
+    public void reuseByLong() {
+        {
+            THIS i = null;
+        }
+        {
+            List<THIS> i = null;
+        }
+    }
+
+    class LocalVariableTypeTable implements VariableTable {
+
+        final LocalVariableTypeTable_attribute att;
+
+
+        public LocalVariableTypeTable(LocalVariableTypeTable_attribute att) {
+            this.att = att;
+        }
+
+        @Override
+        public int localVariableTableLength() {
+            return att.local_variable_table_length;
+        }
+
+        @Override
+        public List<Entry> entries() {
+            return Stream.of(att.local_variable_table).map(LocalVariableTypeTableEntry::new).collect(toList());
+        }
+
+        @Override
+        public int attributeLength() {
+            return att.attribute_length;
+        }
+
+        private class LocalVariableTypeTableEntry implements Entry {
+
+            final LocalVariableTypeTable_attribute.Entry entry;
+
+            private LocalVariableTypeTableEntry(LocalVariableTypeTable_attribute.Entry entry) {
+                this.entry = entry;
+            }
+
+            @Override
+            public int index() {
+                return entry.index;
+            }
+
+            @Override
+            public int startPC() {
+                return entry.start_pc;
+            }
+
+            @Override
+            public int length() {
+                return entry.length;
+            }
+
+            @Override
+            public String name() {
+                return getString(entry.name_index);
+            }
+
+            @Override
+            public String type() {
+                return getString(entry.signature_index);
+            }
+
+            @Override
+            public String toString() {
+                return dump();
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/classfiles/attributes/lib/TestBase.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Stream;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.ToolProvider;
+
+import static java.lang.String.format;
+import static java.util.Collections.emptyList;
+import static java.util.stream.Collectors.toList;
+
+public class TestBase {
+
+    public Map<String, ? extends JavaFileObject> compile(String... sources) throws IOException,
+            CompilationException {
+        return compile(emptyList(), sources);
+    }
+
+    /**
+     * @param options -  compiler options
+     * @param sources
+     * @return map where key is className, value is corresponding ClassFile.
+     * @throws IOException
+     */
+    public Map<String, ? extends JavaFileObject> compile(List<String> options, String... sources) throws IOException,
+            CompilationException {
+
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        List<? extends JavaFileObject> src = Stream.of(sources).map(ToolBox.JavaSource::new).collect(toList());
+
+        try (InMemoryFileManager fileManager = new InMemoryFileManager(compiler.getStandardFileManager(null, null, null))) {
+            boolean success = compiler.getTask(null, fileManager, null, options, null, src).call();
+            if (!success) throw new CompilationException("Compilation Error");
+            return fileManager.getClasses();
+        }
+    }
+
+    public void assertEquals(Object actual, Object expected, String message) {
+        if (!Objects.equals(actual, expected))
+            throw new AssertionFailedException(format("%s%nGot: %s, Expected: ", message, actual, expected));
+    }
+
+    public void assertNull(Object actual, String message) {
+        assertEquals(actual, null, message);
+    }
+
+    public void assertNotNull(Object actual, String message) {
+        if (Objects.isNull(actual)) {
+            throw new AssertionFailedException(message + " : Expected not null value");
+        }
+    }
+
+    public void assertTrue(boolean actual, String message) {
+        assertEquals(actual, true, message);
+    }
+
+    public File getSourceFile(String fileName) {
+        return new File(System.getProperty("test.src", "."), fileName);
+    }
+
+    public File getClassFile(String fileName) {
+        return new File(System.getProperty("test.classes", TestBase.class.getResource(".").getPath()), fileName);
+    }
+
+    public File getClassFile(Class clazz) {
+        return getClassFile(clazz.getName().replace(".", "/") + ".class");
+    }
+
+    public static class CompilationException extends Exception {
+
+        public CompilationException(String message) {
+            super(message);
+        }
+    }
+
+    public static class AssertionFailedException extends RuntimeException {
+        public AssertionFailedException(String message) {
+            super(message);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/WarnSerializableLambda.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.warn.access.to.sensitive.member.from.serializable.element
+// options: -XDwarnOnAccessToSensitiveMembers
+
+import java.io.Serializable;
+
+public class WarnSerializableLambda {
+    interface SAM {
+        void apply(String s);
+    }
+
+    private void m1() {
+        SAM s = (SAM & Serializable) c -> {
+            packageField = "";
+        };
+    }
+
+    String packageField;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8030741
+ * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
+ * @compile EagerReturnTypeResolutionTesta.java
+ */
+
+public class EagerReturnTypeResolutionTesta {
+
+    abstract class Test1<T>{
+        abstract <S> S foo(S x, S y);
+        <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){}
+
+        void bar(Test1<Long> x, Test1<Integer> y){
+            baz(foo(x, y));
+        }
+    }
+
+    abstract class Test2<T>{
+        abstract <S> S foo(S x, S y);
+        abstract <S1> void baz(Test2<S1> a);
+
+        void bar(Test2<Integer> y, Test2<Long> x){
+             baz(foo(x, y));
+        }
+    }
+
+    abstract class Test3<T>{
+        abstract <S> S foo(S x, S y);
+        <T extends Number & Comparable<?>,
+                S extends Number & Comparable<? extends T>> void baz(Test3<S> a){}
+
+        void bar(Test3<Long> x, Test3<Integer> y){
+            baz(foo(x, y));
+        }
+    }
+
+    abstract class Test4 {
+        abstract class A0<T> {}
+
+        abstract class A1<T> extends A0<T> {}
+
+        abstract class A2<T> extends A0<T> {}
+
+        abstract <S> S foo(S x, S y);
+        abstract <S1> void baz(A0<S1> a);
+
+        void bar(A2<Integer> y, A1<Long> x){
+             baz(foo(x, y));
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,182 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8030741
+ * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
+ * @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java
+ * @author Dan Smith
+ */
+
+import java.util.List;
+
+public class EagerReturnTypeResolutionTestb {
+    interface I<S> {}
+    interface J<S> extends I<S> {}
+    interface K extends I<String> {}
+    interface L<S> extends I {}
+
+    <T> T lower(List<? extends T> l) { return null; }
+    <T> T lower2(List<? extends T> l1, List<? extends T> l2) { return null; }
+
+    <T> T upper(List<? super T> l) { return null; }
+    <T> T upper2(List<? super T> l1, List<? super T> l2) { return null; }
+
+    <T> T eq(List<T> l) { return null; }
+    <T> T eq2(List<T> l1, List<T> l2) { return null; }
+
+    <X> void takeI(I<X> i) {}
+    void takeIString(I<String> i) {}
+    I<String> iStringField;
+
+    void takeLong(long arg) {}
+    long longField;
+
+    void testSimpleCaptureOK(List<I<?>> i1) {
+        takeI(lower(i1)); // ok*
+        takeI(eq(i1)); // ok*
+        takeI(upper(i1)); // ok, no capture
+        takeIString(upper(i1)); // ok
+        iStringField = upper(i1); // ok
+    }
+
+    void testSimpleCaptureKO(List<I<?>> i1) {
+        takeIString(lower(i1)); // ERROR
+        takeIString(eq(i1)); // ERROR
+        iStringField = lower(i1); // ERROR
+        iStringField = eq(i1); // ERROR
+    }
+
+    void testMultiCaptureOK(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3,
+                          List<J<String>> j1, List<J<Integer>> j2, List<K> k1) {
+        /* Lines marked with JDK-8029002 should be uncommented once this bug is
+         * fixed
+         */
+        takeI(lower2(i1, i2)); // ok*
+        takeI(lower2(i1, i3)); // ok*
+        takeI(upper2(i1, i3)); // ok, no capture*  JDK-8029002
+
+        takeIString(upper2(i1, i3)); // ok, no capture
+        iStringField = upper2(i1, i3); // ok, no capture
+
+        takeI(lower2(j1, j2)); // ok*
+        takeI(lower2(j1, k1)); // ok, no capture
+        takeI(upper2(j1, k1)); // ok, no capture*  JDK-8029002
+
+        takeIString(lower2(j1, k1)); // ok, no capture
+        takeIString(upper2(j1, k1)); // ok, no capture
+
+        iStringField = lower2(j1, k1); // ok, no capture
+        iStringField = upper2(j1, k1); // ok, no capture
+        takeI(lower2(j2, k1)); // ok*
+    }
+
+    void testMultiCaptureKO(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3,
+                          List<J<String>> j1, List<J<Integer>> j2, List<K> k1) {
+        takeI(eq2(i1, i2)); // ERROR, bad bounds
+        takeI(upper2(i1, i2)); // ERROR, bad bounds
+
+        takeIString(lower2(i1, i2)); // ERROR
+        takeIString(eq2(i1, i2)); // ERROR, bad bounds
+        takeIString(upper2(i1, i2)); // ERROR, bad bounds
+
+        iStringField = lower2(i1, i2); // ERROR
+        iStringField = eq2(i1, i2); // ERROR, bad bounds
+        iStringField = upper2(i1, i2); // ERROR, bad bounds
+
+        takeI(eq2(i1, i3)); // ERROR, bad bounds
+        takeIString(lower2(i1, i3)); // ERROR
+        takeIString(eq2(i1, i3)); // ERROR, bad bounds
+
+        iStringField = lower2(i1, i3); // ERROR
+        iStringField = eq2(i1, i3); // ERROR, bad bounds
+        takeI(eq2(j1, j2)); // ERROR, bad bounds
+        takeI(upper2(j1, j2)); // ERROR, bad bounds
+
+        takeIString(lower2(j1, j2)); // ERROR
+        takeIString(eq2(j1, j2)); // ERROR, bad bounds
+        takeIString(upper2(j1, j2)); // ERROR, bad bounds
+
+        iStringField = lower2(j1, j2); // ERROR
+        iStringField = eq2(j1, j2); // ERROR, bad bounds
+        iStringField = upper2(j1, j2); // ERROR, bad bounds
+
+        takeI(eq2(j1, k1)); // ERROR, bad bounds
+        takeIString(eq2(j1, k1)); // ERROR, bad bounds
+        iStringField = eq2(j1, k1); // ERROR, bad bounds
+        takeI(eq2(j2, k1)); // ERROR, bad bounds
+        takeI(upper2(j2, k1)); // ERROR, bad bounds; actual: no error, see JDK-8037474
+
+        takeIString(lower2(j2, k1)); // ERROR
+        takeIString(eq2(j2, k1)); // ERROR, bad bounds
+        takeIString(upper2(j2, k1)); // ERROR, bad bounds
+
+        iStringField = lower2(j2, k1); // ERROR
+        iStringField = eq2(j2, k1); // ERROR, bad bounds
+        iStringField = upper2(j2, k1); // ERROR, bad bounds
+    }
+
+    void testRawOK(List<I> i1, List<J> j1, List<L<String>> l1) {
+        takeI(lower(i1)); // ok, unchecked
+        takeI(eq(i1)); // ok, unchecked
+        takeI(upper(i1)); // ok, no capture, not unchecked
+
+        takeIString(lower(i1)); // ok, unchecked
+        takeIString(eq(i1)); // ok, unchecked
+        takeIString(upper(i1)); // ok, no capture, not unchecked
+
+        iStringField = lower(i1); // ok, unchecked
+        iStringField = eq(i1); // ok, unchecked
+        iStringField = upper(i1); // ok, no capture, not unchecked
+
+        takeI(lower(j1)); // ok, unchecked
+        takeI(eq(j1)); // ok, unchecked
+        takeI(upper(j1)); // bad bounds? -- spec is unclear
+
+        takeIString(lower(j1)); // ok, unchecked
+        takeIString(eq(j1)); // ok, unchecked
+        takeIString(upper(j1)); // bad bounds? -- spec is unclear
+
+        iStringField = lower(j1); // ok, unchecked
+        iStringField = eq(j1); // ok, unchecked
+        iStringField = upper(j1); // bad bounds? -- spec is unclear
+
+        takeI(lower(l1)); // ok, unchecked
+        takeI(eq(l1)); // ok, unchecked
+        takeI(upper(l1)); // bad bounds? -- spec is unclear
+
+        takeIString(lower(l1)); // ok, unchecked
+        takeIString(eq(l1)); // ok, unchecked
+        takeIString(upper(l1)); // bad bounds? -- spec is unclear
+
+        iStringField = lower(l1); // ok, unchecked
+        iStringField = eq(l1); // ok, unchecked
+        iStringField = upper(l1); // bad bounds? -- spec is unclear
+    }
+
+    void testPrimOK(List<Integer> i1, List<Long> l1, List<Double> d1) {
+        takeLong(lower(i1)); // ok
+        takeLong(eq(i1)); // ok
+        takeLong(upper(i1)); // ok*
+
+        longField = lower(i1); // ok
+        longField = eq(i1); // ok
+        longField = upper(i1); // ok*
+
+        takeLong(lower(l1)); // ok
+        takeLong(eq(l1)); // ok
+        takeLong(upper(l1)); // ok
+
+        longField = lower(l1); // ok
+        longField = eq(l1); // ok
+        longField = upper(l1); // ok
+    }
+
+    void testPrimKO(List<Integer> i1, List<Long> l1, List<Double> d1) {
+        takeLong(lower(d1)); // ERROR
+        takeLong(eq(d1)); // ERROR
+        takeLong(upper(d1)); // ERROR
+
+        longField = lower(d1); // ERROR
+        longField = eq(d1); // ERROR
+        longField = upper(d1); // ERROR
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,45 @@
+EagerReturnTypeResolutionTestb.java:42:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:43:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:44:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:45:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:75:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:79:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:83:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:86:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:87:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:89:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:92:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:96:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:100:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:103:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
+EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
+EagerReturnTypeResolutionTestb.java:106:9: compiler.err.cant.apply.symbol: kindname.method, takeI, EagerReturnTypeResolutionTestb.I<X>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Integer, java.lang.Integer,java.lang.String)
+EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
+EagerReturnTypeResolutionTestb.java:110:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
+EagerReturnTypeResolutionTestb.java:114:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
+EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
+EagerReturnTypeResolutionTestb.java:176:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long))
+EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long)
+EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long)
+EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long)
+- compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java
+- compiler.note.unchecked.recompile
+42 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,25 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8030741
+ * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
+ * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java
+ */
+
+public class PrimitiveTypeBoxingTest {
+
+    static void foo(long arg) {}
+    static void bar(int arg) {}
+
+    interface F<X> { void get(X arg); }
+
+    <Z> void m1(F<Z> f, Z arg) {}
+    <Z> void m2(Z arg, F<Z> f) {}
+
+    void test() {
+        m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error
+        m2(23, PrimitiveTypeBoxingTest::foo); // expected: error
+
+        m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success
+        m2(23, PrimitiveTypeBoxingTest::bar); // expected: success
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,3 @@
+PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @490,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object)
+PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@559, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaLocalTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8029725
+ * @summary Lambda reference to containing local class causes javac infinite recursion
+ * @author  Robert Field
+ * @run main LambdaLocalTest
+ */
+
+public class LambdaLocalTest {
+    interface F {void f();}
+
+    static F f;
+    static StringBuffer sb = new StringBuffer();
+
+    static void assertEquals(Object val, Object expected) {
+        if (!val.equals(expected)) {
+            throw new AssertionError("expected '" + expected + "' got '" + val + "'");
+        }
+    }
+
+    public static void main(String[] args) {
+        class Local {
+            public Local() {
+                f = () -> new Local();
+                sb.append("+");
+            }
+        }
+        new Local();
+        f.f();
+        assertEquals(sb.toString(), "++");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaMultiCatchTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8036942
+ * @summary javac generates incorrect exception table for multi-catch statements inside a lambda
+ * @run main LambdaMultiCatchTest
+ */
+
+import java.io.IOException;
+import java.util.function.Function;
+
+public class LambdaMultiCatchTest {
+    public static void main(String[] args) {
+        Function<String,String> fi = x -> {
+            String result = "nada";
+            try {
+                switch (x) {
+                    case "IO":  throw new IOException();
+                    case "Illegal": throw new IllegalArgumentException();
+                    case "Run": throw new RuntimeException();
+                }
+            } catch (IOException|IllegalArgumentException ex) {
+               result = "IO/Illegal";
+            } catch (Exception ex) {
+               result = "Any";
+            };
+            return result;
+        };
+        String val = fi.apply("Run");
+        if (!val.equals("Any")) {
+            throw new AssertionError("Fail: Expected 'Any' but got '" + val + "'");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/LambdaOuterLocalTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8029725
+ * @summary Lambda reference to containing local class causes javac infinite recursion
+ * @author  Robert Field
+ * @run main LambdaOuterLocalTest
+ */
+
+public class LambdaOuterLocalTest {
+    interface F {void f();}
+
+    static F f;
+    static StringBuffer sb = new StringBuffer();
+
+    static void assertEquals(Object val, Object expected) {
+        if (!val.equals(expected)) {
+            throw new AssertionError("expected '" + expected + "' got '" + val + "'");
+        }
+    }
+
+    public static void main(String[] args) {
+        class Local1 {
+            public Local1() {
+                class Local2 {
+                    public Local2() {
+                        f = () -> new Local1();
+                        sb.append("2");
+                    }
+                }
+                sb.append("1");
+                new Local2();
+            }
+        }
+        new Local1();
+        f.f();
+        assertEquals(sb.toString(), "1212");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/SingleLocalTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8029852
+ * @summary Bad code generated (VerifyError) when lambda instantiates
+ *          enclosing local class and has captured variables
+ */
+public class SingleLocalTest {
+    interface F {void f();}
+
+    static F f;
+
+    public static void main(String[] args) {
+        StringBuffer sb = new StringBuffer();
+        class Local1 {
+            public Local1() {
+                f = () -> new Local1();
+                sb.append("1");
+            }
+        }
+        new Local1();
+        f.f();
+        String s = sb.toString();
+        if (!s.equals("11")) {
+            throw new AssertionError("Expected '11' got '" + s + "'");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lib/InMemoryFileManager.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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.net.URI;
+import java.util.HashMap;
+import java.util.Map;
+import javax.tools.*;
+
+import static java.util.Collections.unmodifiableMap;
+
+/**
+ * class for storing source/byte code in memory.
+ */
+public class InMemoryFileManager extends ForwardingJavaFileManager {
+
+    private final Map<String, InMemoryJavaFile> classes = new HashMap<>();
+
+    public InMemoryFileManager(JavaFileManager fileManager) {
+        super(fileManager);
+    }
+
+    @Override
+    public JavaFileObject getJavaFileForOutput(Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException {
+
+        InMemoryJavaFile javaFile = new InMemoryJavaFile(className);
+        classes.put(className, javaFile);
+        return javaFile;
+    }
+
+    @Override
+    public ClassLoader getClassLoader(Location location) {
+        return new ClassLoader(this.getClass().getClassLoader()) {
+            @Override
+            protected Class<?> findClass(String name) throws ClassNotFoundException {
+                InMemoryJavaFile classData = classes.get(name);
+                if (classData == null) throw new ClassNotFoundException(name);
+                byte[] byteCode = classData.bos.toByteArray();
+                return defineClass(name, byteCode, 0, byteCode.length);
+            }
+        };
+    }
+
+    public Map<String, ? extends JavaFileObject> getClasses() {
+        return unmodifiableMap(classes);
+    }
+
+    private static class InMemoryJavaFile extends SimpleJavaFileObject {
+
+        private final ByteArrayOutputStream bos =
+                new ByteArrayOutputStream();
+
+
+        protected InMemoryJavaFile(String name) {
+            super(URI.create("mfm:///" + name.replace('.', '/') + Kind.CLASS.extension), Kind.CLASS);
+        }
+
+        @Override
+        public OutputStream openOutputStream() throws IOException {
+            return bos;
+        }
+
+        @Override
+        public InputStream openInputStream() throws IOException {
+            return new ByteArrayInputStream(bos.toByteArray());
+        }
+    }
+}
--- a/langtools/test/tools/javac/lib/ToolBox.java	Mon May 05 09:41:41 2014 -0700
+++ b/langtools/test/tools/javac/lib/ToolBox.java	Mon May 05 12:49:13 2014 -0700
@@ -851,7 +851,7 @@
      * This method is intended for simple files and uses regular expressions,
      * so comments matching the pattern can make the method fail.
      */
-    private static String getJavaFileNameFromSource(String source) {
+    static String getJavaFileNameFromSource(String source) {
         String className = null;
         Matcher matcher = publicClassPattern.matcher(source);
         if (matcher.find()) {
@@ -902,7 +902,9 @@
                       .append("Main-Class: ")
                       .append(mainClass).toString());
         }
-        Files.write(Paths.get("MANIFEST.MF"), lines, null);
+        Files.write(Paths.get("MANIFEST.MF"), lines,
+                    StandardOpenOption.CREATE, StandardOpenOption.WRITE,
+                    StandardOpenOption.TRUNCATE_EXISTING);
     }
 
     /**
--- a/make/common/JavaCompilation.gmk	Mon May 05 09:41:41 2014 -0700
+++ b/make/common/JavaCompilation.gmk	Mon May 05 12:49:13 2014 -0700
@@ -351,7 +351,8 @@
 # 3. Delete all lines starting with #.
 # 4. Delete empty lines.
 # 5. Append lines ending with \ with the next line.
-# 6. Remove leading and trailing white space.
+# 6. Remove leading and trailing white space. Note that tabs must be explicit
+#    as sed on macosx does not understand '\t'.
 # 7. Replace the first \= with just =.
 # 8. Finally it's all sorted to create a stable output.
 # 
@@ -370,7 +371,7 @@
 	    | $(SED) -f "$(SRC_ROOT)/make/common/support/unicode2x.sed" \
 	    | $(SED) -e '/^#/d' -e '/^$$$$/d' \
 	        -e :a -e '/\\$$$$/N; s/\\\n//; ta' \
-	        -e 's/^[ \t]*//;s/[ \t]*$$$$//' \
+	        -e 's/^[ 	]*//;s/[ 	]*$$$$//' \
 	        -e 's/\\=/=/' | LC_ALL=C $(SORT) > $$@
 	$(CHMOD) -f ug+w $$@
 
--- a/nashorn/.hgtags	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/.hgtags	Mon May 05 12:49:13 2014 -0700
@@ -244,3 +244,4 @@
 4764920fd81d631915b13ba03b5d962ab14a50c4 jdk9-b08
 27f6ea87dcbd52c4b59e34a9f18d5b3321d53fa7 jdk9-b09
 0eaa55c7abe5d96023a4b38a326f411209c43f49 jdk9-b10
+4d60c3292e14aac90dc3b8232496ba4af4254cc3 jdk9-b11
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Mon May 05 12:49:13 2014 -0700
@@ -27,16 +27,14 @@
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.referenceError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
 
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.io.Reader;
 import java.lang.invoke.MethodHandles;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.net.URL;
-import java.nio.charset.Charset;
 import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.Permissions;
@@ -124,21 +122,21 @@
         }
     }
 
-    // load engine.js and return content as a char[]
+    // load engine.js
     @SuppressWarnings("resource")
-    private static char[] loadEngineJSSource() {
+    private static Source loadEngineJSSource() {
         final String script = "resources/engine.js";
         try {
-            final InputStream is = AccessController.doPrivileged(
-                    new PrivilegedExceptionAction<InputStream>() {
+            return AccessController.doPrivileged(
+                    new PrivilegedExceptionAction<Source>() {
                         @Override
-                        public InputStream run() throws Exception {
+                        public Source run() throws IOException {
                             final URL url = NashornScriptEngine.class.getResource(script);
-                            return url.openStream();
+                            return sourceFor(NashornException.ENGINE_SCRIPT_SOURCE_NAME, url);
                         }
-                    });
-            return Source.readFully(new InputStreamReader(is));
-        } catch (final PrivilegedActionException | IOException e) {
+                    }
+            );
+        } catch (final PrivilegedActionException e) {
             if (Context.DEBUG) {
                 e.printStackTrace();
             }
@@ -147,7 +145,7 @@
     }
 
     // Source object for engine.js
-    private static final Source ENGINE_SCRIPT_SRC = new Source(NashornException.ENGINE_SCRIPT_SOURCE_NAME, loadEngineJSSource());
+    private static final Source ENGINE_SCRIPT_SRC = loadEngineJSSource();
 
     NashornScriptEngine(final NashornScriptEngineFactory factory, final ClassLoader appLoader) {
         this(factory, DEFAULT_OPTIONS, appLoader);
@@ -282,19 +280,14 @@
 
     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);
-            }
-            return new Source(getScriptName(ctxt), Source.readFully(reader));
-        } catch (final IOException e) {
+            return sourceFor(getScriptName(ctxt), reader);
+        } catch (IOException e) {
             throw new ScriptException(e);
         }
     }
 
     private static Source makeSource(final String src, final ScriptContext ctxt) {
-        return new Source(getScriptName(ctxt), src);
+        return sourceFor(getScriptName(ctxt), src);
     }
 
     private static String getScriptName(final ScriptContext ctxt) {
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/JSONWriter.java	Mon May 05 12:49:13 2014 -0700
@@ -25,6 +25,8 @@
 
 package jdk.nashorn.internal.ir.debug;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+
 import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
@@ -88,7 +90,7 @@
      * @return JSON string representation of AST of the supplied code
      */
     public static String parse(final ScriptEnvironment env, final String code, final String name, final boolean includeLoc) {
-        final Parser       parser     = new Parser(env, new Source(name, code), new Context.ThrowErrorManager(), env._strict);
+        final Parser       parser     = new Parser(env, sourceFor(name, code), new Context.ThrowErrorManager(), env._strict);
         final JSONWriter   jsonWriter = new JSONWriter(includeLoc);
         try {
             final FunctionNode functionNode = parser.parse(CompilerConstants.RUN_SCRIPT.symbolName());
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeFunction.java	Mon May 05 12:49:13 2014 -0700
@@ -27,6 +27,7 @@
 
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
 
 import java.util.List;
 
@@ -257,7 +258,7 @@
     }
 
     private static void checkFunctionParameters(final String params) {
-        final Source src = new Source("<function>", params);
+        final Source src = sourceFor("<function>", params);
         final Parser parser = new Parser(Global.getEnv(), src, new Context.ThrowErrorManager());
         try {
             parser.parseFormalParameterList();
@@ -267,7 +268,7 @@
     }
 
     private static void checkFunctionBody(final String funcBody) {
-        final Source src = new Source("<function>", funcBody);
+        final Source src = sourceFor("<function>", funcBody);
         final Parser parser = new Parser(Global.getEnv(), src, new Context.ThrowErrorManager());
         try {
             parser.parseFunctionBody();
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Mon May 05 12:49:13 2014 -0700
@@ -32,6 +32,7 @@
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
 
 import java.io.File;
 import java.io.IOException;
@@ -501,7 +502,7 @@
      */
     public Object eval(final ScriptObject initialScope, final String string, final Object callThis, final Object location, final boolean strict) {
         final String  file       = (location == UNDEFINED || location == null) ? "<eval>" : location.toString();
-        final Source  source     = new Source(file, string);
+        final Source  source     = sourceFor(file, string);
         final boolean directEval = location != UNDEFINED; // is this direct 'eval' call or indirectly invoked eval?
         final Global  global = Context.getGlobal();
 
@@ -568,7 +569,7 @@
                         public Source run() {
                             try {
                                 final URL resURL = Context.class.getResource(resource);
-                                return (resURL != null)? new Source(srcStr, resURL) : null;
+                                return (resURL != null)? sourceFor(srcStr, resURL) : null;
                             } catch (final IOException exp) {
                                 return null;
                             }
@@ -600,7 +601,7 @@
             final String srcStr = (String)src;
             if (srcStr.startsWith(LOAD_CLASSPATH)) {
                 URL url = getResourceURL(srcStr.substring(LOAD_CLASSPATH.length()));
-                source = (url != null)? new Source(url.toString(), url) : null;
+                source = (url != null)? sourceFor(url.toString(), url) : null;
             } else {
                 final File file = new File(srcStr);
                 if (srcStr.indexOf(':') != -1) {
@@ -613,31 +614,31 @@
                         } catch (final MalformedURLException e) {
                             url = file.toURI().toURL();
                         }
-                        source = new Source(url.toString(), url);
+                        source = sourceFor(url.toString(), url);
                     }
                 } else if (file.isFile()) {
-                    source = new Source(srcStr, file);
+                    source = sourceFor(srcStr, file);
                 }
             }
         } else if (src instanceof File && ((File)src).isFile()) {
             final File file = (File)src;
-            source = new Source(file.getName(), file);
+            source = sourceFor(file.getName(), file);
         } else if (src instanceof URL) {
             final URL url = (URL)src;
-            source = new Source(url.toString(), url);
+            source = sourceFor(url.toString(), url);
         } else if (src instanceof ScriptObject) {
             final ScriptObject sobj = (ScriptObject)src;
             if (sobj.has("script") && sobj.has("name")) {
                 final String script = JSType.toString(sobj.get("script"));
                 final String name   = JSType.toString(sobj.get("name"));
-                source = new Source(name, script);
+                source = sourceFor(name, script);
             }
         } else if (src instanceof Map) {
             final Map<?,?> map = (Map<?,?>)src;
             if (map.containsKey("script") && map.containsKey("name")) {
                 final String script = JSType.toString(map.get("script"));
                 final String name   = JSType.toString(map.get("name"));
-                source = new Source(name, script);
+                source = sourceFor(name, script);
             }
         }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/JSONFunctions.java	Mon May 05 12:49:13 2014 -0700
@@ -39,6 +39,8 @@
 import jdk.nashorn.internal.runtime.arrays.ArrayIndex;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+
 /**
  * Utilities used by "JSON" object implementation.
  */
@@ -77,9 +79,7 @@
      */
     public static Object parse(final Object text, final Object reviver) {
         final String     str     = JSType.toString(text);
-        final JSONParser parser  = new JSONParser(
-                new Source("<json>", str),
-                new Context.ThrowErrorManager());
+        final JSONParser parser  = new JSONParser(sourceFor("<json>", str), new Context.ThrowErrorManager());
 
         Node node;
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java	Mon May 05 12:49:13 2014 -0700
@@ -27,13 +27,16 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOError;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.Reader;
+import java.lang.ref.WeakReference;
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.net.URLConnection;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
@@ -43,13 +46,19 @@
 import java.security.NoSuchAlgorithmException;
 import java.util.Arrays;
 import java.util.Objects;
+import java.util.WeakHashMap;
+import jdk.nashorn.api.scripting.URLReader;
 import jdk.nashorn.internal.parser.Token;
 
 /**
  * Source objects track the origin of JavaScript entities.
- *
  */
 public final class Source {
+
+    private static final DebugLogger DEBUG = new DebugLogger("source");
+    private static final int BUF_SIZE = 8 * 1024;
+    private static final Cache CACHE = new Cache();
+
     /**
      * Descriptive name of the source as supplied by the user. Used for error
      * reporting to the user. For example, SyntaxError will use this to print message.
@@ -64,11 +73,8 @@
      */
     private final String base;
 
-    /** Cached source content. */
-    private final char[] content;
-
-    /** Length of source content. */
-    private final int length;
+    /** Source content */
+    private final Data data;
 
     /** Cached hash code */
     private int hash;
@@ -76,40 +82,297 @@
     /** Message digest */
     private byte[] digest;
 
-    /** Source URL if available */
-    private final URL url;
+    // Do *not* make this public, ever! Trusts the URL and content.
+    private Source(final String name, final String base, final Data data) {
+        this.name = name;
+        this.base = base;
+        this.data = data;
+    }
+
+    private static synchronized Source sourceFor(final String name, final String base, final URLData data) throws IOException {
+        try {
+            final Source newSource = new Source(name, base, data);
+            final Source existingSource = CACHE.get(newSource);
+            if (existingSource != null) {
+                // Force any access errors
+                data.checkPermissionAndClose();
+                return existingSource;
+            } else {
+                // All sources in cache must be fully loaded
+                data.load();
+                CACHE.put(newSource, newSource);
+                return newSource;
+            }
+        } catch (RuntimeException e) {
+            final Throwable cause = e.getCause();
+            if (cause instanceof IOException) {
+                throw (IOException) cause;
+            }
+            throw e;
+        }
+    }
+
+    private static class Cache extends WeakHashMap<Source, WeakReference<Source>> {
+        public Source get(final Source key) {
+            final WeakReference<Source> ref = super.get(key);
+            return ref == null ? null : ref.get();
+        }
+
+        public void put(final Source key, final Source value) {
+            assert !(value.data instanceof RawData);
+            put(key, new WeakReference<>(value));
+        }
+    }
+
+    // Wrapper to manage lazy loading
+    private static interface Data {
+
+        URL url();
+
+        int length();
+
+        long lastModified();
+
+        char[] array();
+    }
+
+    private static class RawData implements Data {
+        private final char[] array;
+        private int hash;
+
+        private RawData(final char[] array) {
+            this.array = Objects.requireNonNull(array);
+        }
 
-    private static final int BUFSIZE = 8 * 1024;
+        private RawData(final String source) {
+            this.array = Objects.requireNonNull(source).toCharArray();
+        }
+
+        private RawData(final Reader reader) throws IOException {
+            this(readFully(reader));
+        }
+
+        @Override
+        public int hashCode() {
+            int h = hash;
+            if (h == 0) {
+                h = hash = Arrays.hashCode(array);
+            }
+            return h;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (this == obj) {
+                return true;
+            }
+            if (obj instanceof RawData) {
+                return Arrays.equals(array, ((RawData)obj).array);
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return new String(array());
+        }
+
+        @Override
+        public URL url() {
+            return null;
+        }
+
+        @Override
+        public int length() {
+            return array.length;
+        }
+
+        @Override
+        public long lastModified() {
+            return 0;
+        }
+
+        @Override
+        public char[] array() {
+            return array;
+        }
+
+
+    }
+
+    private static class URLData implements Data {
+        private final URL url;
+        protected final Charset cs;
+        private int hash;
+        protected char[] array;
+        protected int length;
+        protected long lastModified;
+
+        private URLData(final URL url, final Charset cs) {
+            this.url = Objects.requireNonNull(url);
+            this.cs = cs;
+        }
 
-    // Do *not* make this public ever! Trusts the URL and content. So has to be called
-    // from other public constructors. Note that this can not be some init method as
-    // we initialize final fields from here.
-    private Source(final String name, final String base, final char[] content, final URL url) {
-        this.name    = name;
-        this.base    = base;
-        this.content = content;
-        this.length  = content.length;
-        this.url     = url;
+        @Override
+        public int hashCode() {
+            int h = hash;
+            if (h == 0) {
+                h = hash = url.hashCode();
+            }
+            return h;
+        }
+
+        @Override
+        public boolean equals(Object other) {
+            if (this == other) {
+                return true;
+            }
+            if (!(other instanceof URLData)) {
+                return false;
+            }
+
+            URLData otherData = (URLData) other;
+
+            if (url.equals(otherData.url)) {
+                // Make sure both have meta data loaded
+                try {
+                    if (isDeferred()) {
+                        // Data in cache is always loaded, and we only compare to cached data.
+                        assert !otherData.isDeferred();
+                        loadMeta();
+                    } else if (otherData.isDeferred()) {
+                        otherData.loadMeta();
+                    }
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+
+                // Compare meta data
+                return this.length == otherData.length && this.lastModified == otherData.lastModified;
+            }
+            return false;
+        }
+
+        @Override
+        public String toString() {
+            return new String(array());
+        }
+
+        @Override
+        public URL url() {
+            return url;
+        }
+
+        @Override
+        public int length() {
+            return length;
+        }
+
+        @Override
+        public long lastModified() {
+            return lastModified;
+        }
+
+        @Override
+        public char[] array() {
+            assert !isDeferred();
+            return array;
+        }
+
+        boolean isDeferred() {
+            return array == null;
+        }
+
+        protected void checkPermissionAndClose() throws IOException {
+            try (InputStream in = url.openStream()) {}
+            debug("permission checked for ", url);
+        }
+
+        protected void load() throws IOException {
+            if (array == null) {
+                final URLConnection c = url.openConnection();
+                try (InputStream in = c.getInputStream()) {
+                    array = cs == null ? readFully(in) : readFully(in, cs);
+                    length = array.length;
+                    lastModified = c.getLastModified();
+                    debug("loaded content for ", url);
+                }
+            }
+        }
+
+        protected void loadMeta() throws IOException {
+            if (length == 0 && lastModified == 0) {
+                final URLConnection c = url.openConnection();
+                length = c.getContentLength();
+                lastModified = c.getLastModified();
+                debug("loaded metadata for ", url);
+            }
+        }
+    }
+
+    private static class FileData extends URLData {
+        private final File file;
+
+        private FileData(final File file, final Charset cs) {
+            super(getURLFromFile(file), cs);
+            this.file = file;
+
+        }
+
+        @Override
+        protected void checkPermissionAndClose() throws IOException {
+            if (!file.canRead()) {
+                throw new FileNotFoundException(file + " (Permission Denied)");
+            }
+            debug("permission checked for ", file);
+        }
+
+        @Override
+        protected void loadMeta() {
+            if (length == 0 && lastModified == 0) {
+                length = (int) file.length();
+                lastModified = file.lastModified();
+                debug("loaded metadata for ", file);
+            }
+        }
+
+        @Override
+        protected void load() throws IOException {
+            if (array == null) {
+                array = cs == null ? readFully(file) : readFully(file, cs);
+                length = array.length;
+                lastModified = file.lastModified();
+                debug("loaded content for ", file);
+            }
+        }
+    }
+
+    private static void debug(final Object... msg) {
+        DEBUG.info(msg);
+    }
+
+    private char[] data() {
+        return data.array();
     }
 
     /**
-     * Constructor
+     * Returns an instance
      *
      * @param name    source name
      * @param content contents as char array
      */
-    public Source(final String name, final char[] content) {
-        this(name, baseName(name, null), content, null);
+    public static Source sourceFor(final String name, final char[] content) {
+        return new Source(name, baseName(name), new RawData(content));
     }
 
     /**
-     * Constructor
+     * Returns an instance
      *
      * @param name    source name
      * @param content contents as string
      */
-    public Source(final String name, final String content) {
-        this(name, content.toCharArray());
+    public static Source sourceFor(final String name, final String content) {
+        return new Source(name, baseName(name), new RawData(content));
     }
 
     /**
@@ -120,8 +383,8 @@
      *
      * @throws IOException if source cannot be loaded
      */
-    public Source(final String name, final URL url) throws IOException {
-        this(name, baseURL(url, null), readFully(url), url);
+    public static Source sourceFor(final String name, final URL url) throws IOException {
+        return sourceFor(name, url, null);
     }
 
     /**
@@ -133,8 +396,8 @@
      *
      * @throws IOException if source cannot be loaded
      */
-    public Source(final String name, final URL url, final Charset cs) throws IOException {
-        this(name, baseURL(url, null), readFully(url, cs), url);
+    public static Source sourceFor(final String name, final URL url, final Charset cs) throws IOException {
+        return sourceFor(name, baseURL(url), new URLData(url, cs));
     }
 
     /**
@@ -145,8 +408,8 @@
      *
      * @throws IOException if source cannot be loaded
      */
-    public Source(final String name, final File file) throws IOException {
-        this(name, dirName(file, null), readFully(file), getURLFromFile(file));
+    public static Source sourceFor(final String name, final File file) throws IOException {
+        return sourceFor(name, file, null);
     }
 
     /**
@@ -158,8 +421,25 @@
      *
      * @throws IOException if source cannot be loaded
      */
-    public Source(final String name, final File file, final Charset cs) throws IOException {
-        this(name, dirName(file, null), readFully(file, cs), getURLFromFile(file));
+    public static Source sourceFor(final String name, final File file, final Charset cs) throws IOException {
+        final File absFile = file.getAbsoluteFile();
+        return sourceFor(name, dirName(absFile, null), new FileData(file, cs));
+    }
+
+    /**
+     * Returns an instance
+     *
+     * @param name source name
+     * @param reader reader from which source can be loaded
+     * @throws IOException if source cannot be loaded
+     */
+    public static Source sourceFor(final String name, final Reader reader) throws IOException {
+        // Extract URL from URLReader to defer loading and reuse cached data if available.
+        if (reader instanceof URLReader) {
+            final URLReader urlReader = (URLReader) reader;
+            return sourceFor(name, urlReader.getURL(), urlReader.getCharset());
+        }
+        return new Source(name, baseName(name), new RawData(reader));
     }
 
     @Override
@@ -167,21 +447,18 @@
         if (this == obj) {
             return true;
         }
-
         if (!(obj instanceof Source)) {
             return false;
         }
-
-        final Source src = (Source)obj;
-        // Only compare content as a last resort measure
-        return length == src.length && Objects.equals(url, src.url) && Objects.equals(name, src.name) && Arrays.equals(content, src.content);
+        final Source other = (Source) obj;
+        return Objects.equals(name, other.name) && data.equals(other.data);
     }
 
     @Override
     public int hashCode() {
         int h = hash;
         if (h == 0) {
-            h = hash = Arrays.hashCode(content) ^ Objects.hashCode(name);
+            h = hash = data.hashCode() ^ Objects.hashCode(name);
         }
         return h;
     }
@@ -191,7 +468,7 @@
      * @return Source content.
      */
     public String getString() {
-        return new String(content, 0, length);
+        return data.toString();
     }
 
     /**
@@ -203,6 +480,14 @@
     }
 
     /**
+     * Get the last modified time of this script.
+     * @return Last modified time.
+     */
+    public long getLastModified() {
+        return data.lastModified();
+    }
+
+    /**
      * Get the "directory" part of the file or "base" of the URL.
      * @return base of file or URL.
      */
@@ -217,7 +502,7 @@
      * @return Source content portion.
      */
     public String getString(final int start, final int len) {
-        return new String(content, start, len);
+        return new String(data(), start, len);
     }
 
     /**
@@ -228,7 +513,7 @@
     public String getString(final long token) {
         final int start = Token.descPosition(token);
         final int len = Token.descLength(token);
-        return new String(content, start, len);
+        return new String(data(), start, len);
     }
 
     /**
@@ -238,7 +523,7 @@
      * @return URL source or null
      */
     public URL getURL() {
-        return url;
+        return data.url();
     }
 
     /**
@@ -247,8 +532,9 @@
      * @return Index of first character of line.
      */
     private int findBOLN(final int position) {
+        final char[] data = data();
         for (int i = position - 1; i > 0; i--) {
-            final char ch = content[i];
+            final char ch = data[i];
 
             if (ch == '\n' || ch == '\r') {
                 return i + 1;
@@ -264,8 +550,10 @@
      * @return Index of last character of line.
      */
     private int findEOLN(final int position) {
-         for (int i = position; i < length; i++) {
-            final char ch = content[i];
+        final char[] data = data();
+        final int length = data.length;
+        for (int i = position; i < length; i++) {
+            final char ch = data[i];
 
             if (ch == '\n' || ch == '\r') {
                 return i - 1;
@@ -285,11 +573,12 @@
      * @return Line number.
      */
     public int getLine(final int position) {
+        final char[] data = data();
         // Line count starts at 1.
         int line = 1;
 
         for (int i = 0; i < position; i++) {
-            final char ch = content[i];
+            final char ch = data[i];
             // Works for both \n and \r\n.
             if (ch == '\n') {
                 line++;
@@ -320,7 +609,7 @@
         // Find end of this line.
         final int last = findEOLN(position);
 
-        return new String(content, first, last - first + 1);
+        return new String(data(), first, last - first + 1);
     }
 
     /**
@@ -328,7 +617,7 @@
      * @return content
      */
     public char[] getContent() {
-        return content.clone();
+        return data().clone();
     }
 
     /**
@@ -336,19 +625,18 @@
      * @return length
      */
     public int getLength() {
-        return length;
+        return data.length();
     }
 
     /**
      * Read all of the source until end of file. Return it as char array
      *
-     * @param reader  reader opened to source stream
+     * @param reader reader opened to source stream
      * @return source as content
-     *
      * @throws IOException if source could not be read
      */
     public static char[] readFully(final Reader reader) throws IOException {
-        final char[]        arr = new char[BUFSIZE];
+        final char[]        arr = new char[BUF_SIZE];
         final StringBuilder sb  = new StringBuilder();
 
         try {
@@ -366,9 +654,8 @@
     /**
      * Read all of the source until end of file. Return it as char array
      *
-     * @param file  source file
+     * @param file source file
      * @return source as content
-     *
      * @throws IOException if source could not be read
      */
     public static char[] readFully(final File file) throws IOException {
@@ -381,10 +668,9 @@
     /**
      * Read all of the source until end of file. Return it as char array
      *
-     * @param file  source file
+     * @param file source file
      * @param cs Charset used to convert bytes to chars
      * @return source as content
-     *
      * @throws IOException if source could not be read
      */
     public static char[] readFully(final File file, final Charset cs) throws IOException {
@@ -393,7 +679,7 @@
         }
 
         final byte[] buf = Files.readAllBytes(file.toPath());
-        return (cs != null)? new String(buf, cs).toCharArray() : byteToCharArray(buf);
+        return (cs != null) ? new String(buf, cs).toCharArray() : byteToCharArray(buf);
     }
 
     /**
@@ -401,7 +687,6 @@
      *
      * @param url URL to read content from
      * @return source as content
-     *
      * @throws IOException if source could not be read
      */
     public static char[] readFully(final URL url) throws IOException {
@@ -414,7 +699,6 @@
      * @param url URL to read content from
      * @param cs Charset used to convert bytes to chars
      * @return source as content
-     *
      * @throws IOException if source could not be read
      */
     public static char[] readFully(final URL url, final Charset cs) throws IOException {
@@ -428,7 +712,7 @@
      */
     public synchronized byte[] getDigest() {
         if (digest == null) {
-
+            final char[] content = data();
             final byte[] bytes = new byte[content.length * 2];
 
             for (int i = 0; i < content.length; i++) {
@@ -444,8 +728,8 @@
                 if (base != null) {
                     md.update(base.getBytes(StandardCharsets.UTF_8));
                 }
-                if (url != null) {
-                    md.update(url.toString().getBytes(StandardCharsets.UTF_8));
+                if (getURL() != null) {
+                    md.update(getURL().toString().getBytes(StandardCharsets.UTF_8));
                 }
                 digest = md.digest(bytes);
             } catch (NoSuchAlgorithmException e) {
@@ -461,50 +745,46 @@
      * @return base URL for url
      */
     public static String baseURL(final URL url) {
-        return baseURL(url, null);
-    }
-
-    private static String baseURL(final URL url, final String defaultValue) {
         if (url.getProtocol().equals("file")) {
             try {
                 final Path path = Paths.get(url.toURI());
                 final Path parent = path.getParent();
-                return (parent != null) ? (parent + File.separator) : defaultValue;
+                return (parent != null) ? (parent + File.separator) : null;
             } catch (final SecurityException | URISyntaxException | IOError e) {
-                return defaultValue;
+                return null;
             }
         }
 
         // FIXME: is there a better way to find 'base' URL of a given URL?
         String path = url.getPath();
         if (path.isEmpty()) {
-            return defaultValue;
+            return null;
         }
         path = path.substring(0, path.lastIndexOf('/') + 1);
         final int port = url.getPort();
         try {
             return new URL(url.getProtocol(), url.getHost(), port, path).toString();
         } catch (final MalformedURLException e) {
-            return defaultValue;
+            return null;
         }
     }
 
-    private static String dirName(final File file, final String defaultValue) {
+    private static String dirName(final File file, final String DEFAULT_BASE_NAME) {
         final String res = file.getParent();
-        return (res != null)? (res + File.separator) : defaultValue;
+        return (res != null) ? (res + File.separator) : DEFAULT_BASE_NAME;
     }
 
     // fake directory like name
-    private static String baseName(final String name, final String defaultValue) {
+    private static String baseName(final String name) {
         int idx = name.lastIndexOf('/');
         if (idx == -1) {
             idx = name.lastIndexOf('\\');
         }
-        return (idx != -1)? name.substring(0, idx + 1) : defaultValue;
+        return (idx != -1) ? name.substring(0, idx + 1) : null;
     }
 
     private static char[] readFully(final InputStream is, final Charset cs) throws IOException {
-        return (cs != null)? new String(readBytes(is), cs).toCharArray() : readFully(is);
+        return (cs != null) ? new String(readBytes(is), cs).toCharArray() : readFully(is);
     }
 
     private static char[] readFully(final InputStream is) throws IOException {
@@ -515,19 +795,19 @@
         Charset cs = StandardCharsets.UTF_8;
         int start = 0;
         // BOM detection.
-        if (bytes.length > 1 && bytes[0] == (byte)0xFE && bytes[1] == (byte)0xFF) {
+        if (bytes.length > 1 && bytes[0] == (byte) 0xFE && bytes[1] == (byte) 0xFF) {
             start = 2;
             cs = StandardCharsets.UTF_16BE;
-        } else if (bytes.length > 1 && bytes[0] == (byte)0xFF && bytes[1] == (byte)0xFE) {
+        } else if (bytes.length > 1 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE) {
             start = 2;
             cs = StandardCharsets.UTF_16LE;
-        } else if (bytes.length > 2 && bytes[0] == (byte)0xEF && bytes[1] == (byte)0xBB && bytes[2] == (byte)0xBF) {
+        } else if (bytes.length > 2 && bytes[0] == (byte) 0xEF && bytes[1] == (byte) 0xBB && bytes[2] == (byte) 0xBF) {
             start = 3;
             cs = StandardCharsets.UTF_8;
-        } else if (bytes.length > 3 && bytes[0] == (byte)0xFF && bytes[1] == (byte)0xFE && bytes[2] == 0 && bytes[3] == 0) {
+        } else if (bytes.length > 3 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE && bytes[2] == 0 && bytes[3] == 0) {
             start = 4;
             cs = Charset.forName("UTF-32LE");
-        } else if (bytes.length > 3 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == (byte)0xFE && bytes[3] == (byte)0xFF) {
+        } else if (bytes.length > 3 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == (byte) 0xFE && bytes[3] == (byte) 0xFF) {
             start = 4;
             cs = Charset.forName("UTF-32BE");
         }
@@ -536,7 +816,7 @@
     }
 
     static byte[] readBytes(final InputStream is) throws IOException {
-        final byte[] arr = new byte[BUFSIZE];
+        final byte[] arr = new byte[BUF_SIZE];
         try {
             try (ByteArrayOutputStream buf = new ByteArrayOutputStream()) {
                 int numBytes;
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Mon May 05 12:49:13 2014 -0700
@@ -64,7 +64,6 @@
 import jdk.internal.org.objectweb.asm.Opcodes;
 import jdk.internal.org.objectweb.asm.Type;
 import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
-import jdk.nashorn.internal.objects.Global;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
@@ -132,23 +131,18 @@
  * implemented securely.
  */
 final class JavaAdapterBytecodeGenerator {
-    static final Type CONTEXT_TYPE       = Type.getType(Context.class);
-    static final Type OBJECT_TYPE        = Type.getType(Object.class);
-    static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class);
-    static final Type GLOBAL_TYPE        = Type.getType(Global.class);
+    static final Type OBJECT_TYPE = Type.getType(Object.class);
 
-    static final String CONTEXT_TYPE_NAME = CONTEXT_TYPE.getInternalName();
     static final String OBJECT_TYPE_NAME  = OBJECT_TYPE.getInternalName();
 
     static final String INIT = "<init>";
 
     static final String GLOBAL_FIELD_NAME = "global";
 
-    static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor();
-    static final String GLOBAL_TYPE_DESCRIPTOR = GLOBAL_TYPE.getDescriptor();
+    // "global" is declared as Object instead of Global - avoid static references to internal Nashorn classes when possible.
+    static final String GLOBAL_TYPE_DESCRIPTOR = OBJECT_TYPE.getDescriptor();
 
-
-    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, GLOBAL_TYPE);
+    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, OBJECT_TYPE);
     static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE);
 
     private static final Type SCRIPT_FUNCTION_TYPE = Type.getType(ScriptFunction.class);
@@ -159,7 +153,7 @@
             OBJECT_TYPE, STRING_TYPE, METHOD_TYPE_TYPE);
     private static final String GET_HANDLE_FUNCTION_DESCRIPTOR = Type.getMethodDescriptor(METHOD_HANDLE_TYPE,
             SCRIPT_FUNCTION_TYPE, METHOD_TYPE_TYPE);
-    private static final String GET_CLASS_INITIALIZER_DESCRIPTOR = Type.getMethodDescriptor(SCRIPT_OBJECT_TYPE);
+    private static final String GET_CLASS_INITIALIZER_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE);
     private static final Type RUNTIME_EXCEPTION_TYPE = Type.getType(RuntimeException.class);
     private static final Type THROWABLE_TYPE = Type.getType(Throwable.class);
     private static final Type UNSUPPORTED_OPERATION_TYPE = Type.getType(UnsupportedOperationException.class);
@@ -171,7 +165,7 @@
     private static final String UNSUPPORTED_OPERATION_TYPE_NAME = UNSUPPORTED_OPERATION_TYPE.getInternalName();
 
     private static final String METHOD_HANDLE_TYPE_DESCRIPTOR = METHOD_HANDLE_TYPE.getDescriptor();
-    private static final String GET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(GLOBAL_TYPE);
+    private static final String GET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE);
     private static final String GET_CLASS_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.getType(Class.class));
 
     // Package used when the adapter can't be defined in the adaptee's package (either because it's sealed, or because
@@ -528,11 +522,11 @@
     }
 
     private static void invokeGetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR, false);
+        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR, false);
     }
 
     private static void invokeSetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, false);
+        mv.invokestatic(SERVICES_CLASS_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, false);
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Mon May 05 12:49:13 2014 -0700
@@ -31,6 +31,8 @@
 import java.security.ProtectionDomain;
 import java.security.SecureClassLoader;
 import jdk.internal.dynalink.beans.StaticClass;
+import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ScriptFunction;
 
 /**
  * This class encapsulates the bytecode of the adapter class and can be used to load it into the JVM as an actual Class.
@@ -85,13 +87,14 @@
             @Override
             public Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
                 try {
+                    Context.checkPackageAccess(name);
                     return super.loadClass(name, resolve);
                 } catch (final SecurityException se) {
                     // we may be implementing an interface or extending a class that was
                     // loaded by a loader that prevents package.access. If so, it'd throw
                     // SecurityException for nashorn's classes!. For adapter's to work, we
-                    // should be able to refer to nashorn classes.
-                    if (name.startsWith("jdk.nashorn.internal.")) {
+                    // should be able to refer to the few classes it needs in its implementation.
+                    if(ScriptFunction.class.getName().equals(name) || JavaAdapterServices.class.getName().equals(name)) {
                         return myLoader.loadClass(name);
                     }
                     throw se;
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Mon May 05 12:49:13 2014 -0700
@@ -247,7 +247,7 @@
     }
 
     private static class AdapterInfo {
-        private static final ClassAndLoader SCRIPT_OBJECT_LOADER = new ClassAndLoader(ScriptObject.class, true);
+        private static final ClassAndLoader SCRIPT_OBJECT_LOADER = new ClassAndLoader(ScriptFunction.class, true);
 
         private final ClassLoader commonLoader;
         // TODO: soft reference the JavaAdapterClassLoader objects. They can be recreated when needed.
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Mon May 05 12:49:13 2014 -0700
@@ -116,8 +116,8 @@
      * static initializers.
      * @return the thread-local JS object used to define methods for the class being initialized.
      */
-    public static ScriptObject getClassOverrides() {
-        final ScriptObject overrides = classOverrides.get();
+    public static Object getClassOverrides() {
+        final Object overrides = classOverrides.get();
         assert overrides != null;
         return overrides;
     }
@@ -134,6 +134,22 @@
         NO_PERMISSIONS_INVOKER.invokeExact(method, arg);
     }
 
+    /**
+     * Set the current global scope
+     * @param global the global scope
+     */
+    public static void setGlobal(final Object global) {
+        Context.setGlobal((ScriptObject)global);
+    }
+
+    /**
+     * Get the current global scope
+     * @return the current global scope
+     */
+    public static Object getGlobal() {
+        return Context.getGlobal();
+    }
+
     static void setClassOverrides(ScriptObject overrides) {
         classOverrides.set(overrides);
     }
--- a/nashorn/src/jdk/nashorn/tools/Shell.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/src/jdk/nashorn/tools/Shell.java	Mon May 05 12:49:13 2014 -0700
@@ -25,6 +25,8 @@
 
 package jdk.nashorn.tools;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -50,7 +52,6 @@
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.options.Options;
@@ -244,7 +245,7 @@
 
             // For each file on the command line.
             for (final String fileName : files) {
-                final FunctionNode functionNode = new Parser(env, new Source(fileName, new File(fileName)), errors).parse();
+                final FunctionNode functionNode = new Parser(env, sourceFor(fileName, new File(fileName)), errors).parse();
 
                 if (errors.getNumberOfErrors() != 0) {
                     return COMPILATION_ERROR;
@@ -302,7 +303,7 @@
                 }
 
                 final File file = new File(fileName);
-                final ScriptFunction script = context.compileScript(new Source(fileName, file.toURI().toURL()), global);
+                final ScriptFunction script = context.compileScript(sourceFor(fileName, file), global);
                 if (script == null || errors.getNumberOfErrors() != 0) {
                     return COMPILATION_ERROR;
                 }
@@ -405,7 +406,7 @@
 
             // initialize with "shell.js" script
             try {
-                final Source source = new Source("<shell.js>", Shell.class.getResource("resources/shell.js"));
+                final Source source = sourceFor("<shell.js>", Shell.class.getResource("resources/shell.js"));
                 context.eval(global, source.getString(), global, "<shell.js>", false);
             } catch (final Exception e) {
                 err.println(e);
--- a/nashorn/test/script/trusted/JDK-8006529.js	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/test/script/trusted/JDK-8006529.js	Mon May 05 12:49:13 2014 -0700
@@ -113,7 +113,7 @@
 var getContextMethod = Context.class.getMethod("getContext")
 var getEnvMethod = Context.class.getMethod("getEnv")
 
-var SourceConstructor = Source.class.getConstructor(java.lang.String.class, java.lang.String.class)
+var sourceForMethod = Source.class.getMethod("sourceFor", java.lang.String.class, java.lang.String.class)
 var ParserConstructor = Parser.class.getConstructor(ScriptEnvironment.class, Source.class, ErrorManager.class)
 var CompilerConstructor = Compiler.class.getConstructor(ScriptEnvironment.class)
 
@@ -121,7 +121,7 @@
 // source code, returns a jdk.nashorn.internal.ir.FunctionNode object 
 // representing it.
 function compile(source) {
-    var source = SourceConstructor.newInstance("<no name>", source);
+    var source = sourceForMethod.invoke(null, "<no name>", source);
 
     var env = getEnvMethod.invoke(getContextMethod.invoke(null))
 
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Mon May 05 12:49:13 2014 -0700
@@ -25,6 +25,9 @@
 
 package jdk.nashorn.internal.codegen;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import static jdk.nashorn.internal.runtime.Source.readFully;
+
 import java.io.File;
 import java.io.PrintWriter;
 import java.io.StringWriter;
@@ -32,7 +35,6 @@
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.options.Options;
 import org.testng.Assert;
@@ -151,7 +153,7 @@
         final boolean globalChanged = (oldGlobal != global);
 
         try {
-            final char[] buffer = Source.readFully(file);
+            final char[] buffer = readFully(file);
             boolean excluded = false;
 
             if (filter != null) {
@@ -170,7 +172,7 @@
             if (globalChanged) {
                 Context.setGlobal(global);
             }
-            final Source source = new Source(file.getAbsolutePath(), buffer);
+            final Source source = sourceFor(file.getAbsolutePath(), buffer);
             final ScriptFunction script = context.compileScript(source, global);
             if (script == null || context.getErrorManager().getNumberOfErrors() > 0) {
                 log("Compile failed: " + file.getAbsolutePath());
--- a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Mon May 05 12:49:13 2014 -0700
@@ -25,6 +25,9 @@
 
 package jdk.nashorn.internal.parser;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import static jdk.nashorn.internal.runtime.Source.readFully;
+
 import java.io.File;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ErrorManager;
@@ -131,7 +134,7 @@
         }
 
         try {
-            final char[] buffer = Source.readFully(file);
+            final char[] buffer = readFully(file);
             boolean excluded = false;
             if (filter != null) {
                 final String content = new String(buffer);
@@ -153,7 +156,7 @@
                 }
             };
             errors.setLimit(0);
-            final Source   source   = new Source(file.getAbsolutePath(), buffer);
+            final Source   source   = sourceFor(file.getAbsolutePath(), buffer);
             new Parser(context.getEnv(), source, errors).parse();
             if (errors.getNumberOfErrors() > 0) {
                 log("Parse failed: " + file.getAbsolutePath());
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Mon May 05 12:49:13 2014 -0700
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.runtime;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
 
@@ -107,7 +108,7 @@
     }
 
     private Object eval(final Context cx, final String name, final String code) {
-        final Source source = new Source(name, code);
+        final Source source = sourceFor(name, code);
         final ScriptObject global = Context.getGlobal();
         final ScriptFunction func = cx.compileScript(source, global);
         return func != null ? ScriptRuntime.apply(func, global) : null;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java	Mon May 05 12:49:13 2014 -0700
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime;
+
+import jdk.nashorn.api.scripting.URLReader;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Arrays;
+
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+/**
+ * Tests different Source representations.
+ */
+public class SourceTest {
+
+    final private static String SOURCE_NAME = "source.js";
+    final private static String SOURCE_STRING = "var x = 1;";
+    final private static char[] SOURCE_CHARS = SOURCE_STRING.toCharArray();
+    final private static String RESOURCE_PATH = "resources/load_test.js";
+    final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/" + RESOURCE_PATH);
+    final private static URL  SOURCE_URL = SourceTest.class.getResource(RESOURCE_PATH);
+
+
+    @Test
+    public void testStringSource() {
+        testSources(sourceFor(SOURCE_NAME, SOURCE_STRING), sourceFor(SOURCE_NAME, SOURCE_STRING));
+        testSources(sourceFor(SOURCE_NAME, SOURCE_STRING), sourceFor(SOURCE_NAME, SOURCE_CHARS));
+    }
+
+    @Test
+    public void testCharArraySource() {
+        testSources(sourceFor(SOURCE_NAME, SOURCE_CHARS), sourceFor(SOURCE_NAME, SOURCE_CHARS));
+        testSources(sourceFor(SOURCE_NAME, SOURCE_CHARS), sourceFor(SOURCE_NAME, SOURCE_STRING));
+    }
+
+    @Test
+    public void testURLSource() {
+        try {
+            testSources(sourceFor(SOURCE_NAME, SOURCE_URL), sourceFor(SOURCE_NAME, SOURCE_URL));
+            testSources(sourceFor(SOURCE_NAME, SOURCE_URL), sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)));
+
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testURLReaderSource() {
+        try {
+            System.err.println(SourceTest.class.getResource(""));
+            testSources(sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)), sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)));
+            testSources(sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)), sourceFor(SOURCE_NAME, SOURCE_URL));
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testReaderSource() {
+        try {
+            testSources(sourceFor(SOURCE_NAME, getReader(RESOURCE_PATH)), sourceFor(SOURCE_NAME, getReader(RESOURCE_PATH)));
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testFileSource() {
+        try {
+            testSources(sourceFor(SOURCE_NAME, SOURCE_FILE), sourceFor(SOURCE_NAME, SOURCE_FILE));
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    private Reader getReader(final String path) {
+        return new InputStreamReader(SourceTest.class.getResourceAsStream(path));
+    }
+
+    private void testSources(final Source source1, final Source source2) {
+        final char[] chars1 = source1.getContent();
+        final char[] chars2 = source2.getContent();
+        final String str1 = source1.getString();
+        final String str2 = source2.getString();
+        assertTrue(Arrays.equals(chars1, chars2));
+        assertEquals(str1, str2);
+        assertEquals(source1.hashCode(), source2.hashCode());
+        assertTrue(source1.equals(source2));
+        // Test for immutability
+        Arrays.fill(source1.getContent(), (char)0);
+        Arrays.fill(source2.getContent(), (char)1);
+        assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray()));
+        assertTrue(Arrays.equals(source1.getContent(), chars1));
+        assertTrue(Arrays.equals(source1.getContent(), source2.getContent()));
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/SharedContextEvaluator.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/SharedContextEvaluator.java	Mon May 05 12:49:13 2014 -0700
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.test.framework;
 
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
 import static jdk.nashorn.tools.Shell.COMPILATION_ERROR;
 import static jdk.nashorn.tools.Shell.RUNTIME_ERROR;
 import static jdk.nashorn.tools.Shell.SUCCESS;
@@ -39,7 +40,6 @@
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
-import jdk.nashorn.internal.runtime.Source;
 import jdk.nashorn.internal.runtime.options.Options;
 
 /**
@@ -125,7 +125,7 @@
                     continue;
                 }
                 final File file = new File(fileName);
-                ScriptFunction script = context.compileScript(new Source(fileName, file.toURI().toURL()), global);
+                ScriptFunction script = context.compileScript(sourceFor(fileName, file.toURI().toURL()), global);
 
                 if (script == null || errors.getNumberOfErrors() != 0) {
                     return COMPILATION_ERROR;
--- a/nashorn/test/src/jdk/nashorn/test/models/SourceHelper.java	Mon May 05 09:41:41 2014 -0700
+++ b/nashorn/test/src/jdk/nashorn/test/models/SourceHelper.java	Mon May 05 12:49:13 2014 -0700
@@ -46,7 +46,7 @@
     }
 
     public static String readFully(final URL url) throws IOException {
-        return new Source(url.toString(), url).getString();
+        return Source.sourceFor(url.toString(), url).getString();
     }
 
     public static String readFully(final Reader reader) throws IOException {