Merge
authorlana
Tue, 06 Aug 2013 16:54:56 -0700
changeset 19232 ddfc1727d3ef
parent 19231 6f0ebdd538a0 (current diff)
parent 19136 bbe43d712fe0 (diff)
child 19233 28e832b479d2
Merge
jdk/src/share/classes/java/net/package.html
nashorn/src/jdk/internal/dynalink/beans/SafeUnreflector.java
nashorn/src/jdk/internal/dynalink/beans/SafeUnreflectorImpl.java
nashorn/src/jdk/internal/dynalink/beans/SandboxClassLoader.java
nashorn/src/jdk/internal/dynalink/beans/sandbox/Unreflector.java
nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterGeneratorBase.java
nashorn/test/script/representations/NASHORN-592a.js
--- a/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 711eb4aa87de68de78250e0549980936bab53d54 jdk8-b98
 2d3875b0d18b3ad1c2bebf385a697e309e4005a4 jdk8-b99
 3d34036aae4ea90b2ca59712d5a69db3221f0875 jdk8-b100
+edb01c460d4cab21ff0ff13512df7b746efaa0e7 jdk8-b101
--- a/.hgtags-top-repo	Thu Aug 01 14:59:05 2013 +0400
+++ b/.hgtags-top-repo	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 0d0c983a817bbe8518a5ff201306334a8de267f2 jdk8-b98
 59dc9da813794c924a0383c2a6241af94defdfed jdk8-b99
 d2dcb110e9dbaf9903c05b211df800e78e4b394e jdk8-b100
+9f74a220677dc265a724515d8e2617548cef62f1 jdk8-b101
--- a/corba/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/corba/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98
 3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
 8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
+a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101
--- a/hotspot/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -363,3 +363,5 @@
 9f71e36a471ae4a668e08827d33035963ed10c08 hs25-b42
 5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100
 46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43
+f6921c876db192bba389cec062855a66372da01c jdk8-b101
+530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44
--- a/hotspot/make/bsd/makefiles/minimal1.make	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/make/bsd/makefiles/minimal1.make	Tue Aug 06 16:54:56 2013 -0700
@@ -24,16 +24,20 @@
 
 TYPE=MINIMAL1
 
-INCLUDE_JVMTI ?= false
-INCLUDE_FPROF ?= false
-INCLUDE_VM_STRUCTS ?= false
-INCLUDE_JNI_CHECK ?= false
-INCLUDE_SERVICES ?= false
-INCLUDE_MANAGEMENT ?= false
-INCLUDE_ALL_GCS ?= false
-INCLUDE_NMT ?= false
-INCLUDE_TRACE ?= false
-INCLUDE_CDS ?= false
+# Force all variables to false, overriding any other
+# setting that may have occurred in the makefiles. These
+# can still be overridden by passing the variable as an
+# argument to 'make'
+INCLUDE_JVMTI := false
+INCLUDE_FPROF := false
+INCLUDE_VM_STRUCTS := false
+INCLUDE_JNI_CHECK := false
+INCLUDE_SERVICES := false
+INCLUDE_MANAGEMENT := false
+INCLUDE_ALL_GCS := false
+INCLUDE_NMT := false
+INCLUDE_TRACE := false
+INCLUDE_CDS := false
 
 CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
 CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
--- a/hotspot/make/hotspot_version	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/make/hotspot_version	Tue Aug 06 16:54:56 2013 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=25
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=43
+HS_BUILD_NUMBER=44
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=8
--- a/hotspot/make/linux/makefiles/minimal1.make	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/make/linux/makefiles/minimal1.make	Tue Aug 06 16:54:56 2013 -0700
@@ -24,16 +24,20 @@
 
 TYPE=MINIMAL1
 
-INCLUDE_JVMTI ?= false
-INCLUDE_FPROF ?= false
-INCLUDE_VM_STRUCTS ?= false
-INCLUDE_JNI_CHECK ?= false
-INCLUDE_SERVICES ?= false
-INCLUDE_MANAGEMENT ?= false
-INCLUDE_ALL_GCS ?= false
-INCLUDE_NMT ?= false
-INCLUDE_TRACE ?= false
-INCLUDE_CDS ?= false
+# Force all variables to false, overriding any other
+# setting that may have occurred in the makefiles. These
+# can still be overridden by passing the variable as an
+# argument to 'make'
+INCLUDE_JVMTI := false
+INCLUDE_FPROF := false
+INCLUDE_VM_STRUCTS := false
+INCLUDE_JNI_CHECK := false
+INCLUDE_SERVICES := false
+INCLUDE_MANAGEMENT := false
+INCLUDE_ALL_GCS := false
+INCLUDE_NMT := false
+INCLUDE_TRACE := false
+INCLUDE_CDS := false
 
 CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
 CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
--- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -42,7 +42,7 @@
 #else
 define_pd_global(bool, ProfileInterpreter,           true);
 #endif // CC_INTERP
-define_pd_global(bool, TieredCompilation,            false);
+define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
 define_pd_global(intx, BackEdgeThreshold,            140000);
 
--- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -44,7 +44,7 @@
 #else
 define_pd_global(bool, ProfileInterpreter,           true);
 #endif // CC_INTERP
-define_pd_global(bool, TieredCompilation,            false);
+define_pd_global(bool, TieredCompilation,            trueInTiered);
 define_pd_global(intx, CompileThreshold,             10000);
 define_pd_global(intx, BackEdgeThreshold,            100000);
 
--- a/hotspot/src/share/vm/ci/ciReplay.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -299,7 +299,7 @@
     Symbol* method_signature = parse_symbol(CHECK_NULL);
     Method* m = k->find_method(method_name, method_signature);
     if (m == NULL) {
-      report_error("can't find method");
+      report_error("Can't find method");
     }
     return m;
   }
@@ -398,8 +398,8 @@
 
   // compile <klass> <name> <signature> <entry_bci> <comp_level>
   void process_compile(TRAPS) {
-    // methodHandle method;
     Method* method = parse_method(CHECK);
+    if (had_error()) return;
     int entry_bci = parse_int("entry_bci");
     const char* comp_level_label = "comp_level";
     int comp_level = parse_int(comp_level_label);
@@ -440,6 +440,7 @@
   //
   void process_ciMethod(TRAPS) {
     Method* method = parse_method(CHECK);
+    if (had_error()) return;
     ciMethodRecord* rec = new_ciMethod(method);
     rec->invocation_counter = parse_int("invocation_counter");
     rec->backedge_counter = parse_int("backedge_counter");
@@ -451,6 +452,7 @@
   // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
   void process_ciMethodData(TRAPS) {
     Method* method = parse_method(CHECK);
+    if (had_error()) return;
     /* jsut copied from Method, to build interpret data*/
     if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
       return;
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -122,6 +122,22 @@
   }
 };
 
+class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
+ private:
+  const MemRegion _span;
+  CMSBitMap*      _bitMap;
+ protected:
+  DO_OOP_WORK_DEFN
+ public:
+  Par_MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
+  virtual void do_oop(oop* p);
+  virtual void do_oop(narrowOop* p);
+
+  Prefetch::style prefetch_style() {
+    return Prefetch::do_read;
+  }
+};
+
 // A variant of the above used in certain kinds of CMS
 // marking verification.
 class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -569,6 +569,7 @@
   _restart_addr(NULL),
   _overflow_list(NULL),
   _stats(cmsGen),
+  _eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true)),
   _eden_chunk_array(NULL),     // may be set in ctor body
   _eden_chunk_capacity(0),     // -- ditto --
   _eden_chunk_index(0),        // -- ditto --
@@ -732,7 +733,7 @@
   assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error");
 
   // Support for parallelizing survivor space rescan
-  if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) {
+  if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) {
     const size_t max_plab_samples =
       ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
 
@@ -2137,6 +2138,39 @@
 }
 
 
+void CMSCollector::print_eden_and_survivor_chunk_arrays() {
+  DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
+  EdenSpace* eden_space = dng->eden();
+  ContiguousSpace* from_space = dng->from();
+  ContiguousSpace* to_space   = dng->to();
+  // Eden
+  if (_eden_chunk_array != NULL) {
+    gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
+                           eden_space->bottom(), eden_space->top(),
+                           eden_space->end(), eden_space->capacity());
+    gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", "
+                           "_eden_chunk_capacity=" SIZE_FORMAT,
+                           _eden_chunk_index, _eden_chunk_capacity);
+    for (size_t i = 0; i < _eden_chunk_index; i++) {
+      gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
+                             i, _eden_chunk_array[i]);
+    }
+  }
+  // Survivor
+  if (_survivor_chunk_array != NULL) {
+    gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
+                           from_space->bottom(), from_space->top(),
+                           from_space->end(), from_space->capacity());
+    gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", "
+                           "_survivor_chunk_capacity=" SIZE_FORMAT,
+                           _survivor_chunk_index, _survivor_chunk_capacity);
+    for (size_t i = 0; i < _survivor_chunk_index; i++) {
+      gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
+                             i, _survivor_chunk_array[i]);
+    }
+  }
+}
+
 void CMSCollector::getFreelistLocks() const {
   // Get locks for all free lists in all generations that this
   // collector is responsible for
@@ -3549,6 +3583,31 @@
 
 // CMS work
 
+// The common parts of CMSParInitialMarkTask and CMSParRemarkTask.
+class CMSParMarkTask : public AbstractGangTask {
+ protected:
+  CMSCollector*     _collector;
+  int               _n_workers;
+  CMSParMarkTask(const char* name, CMSCollector* collector, int n_workers) :
+      AbstractGangTask(name),
+      _collector(collector),
+      _n_workers(n_workers) {}
+  // Work method in support of parallel rescan ... of young gen spaces
+  void do_young_space_rescan(uint worker_id, OopsInGenClosure* cl,
+                             ContiguousSpace* space,
+                             HeapWord** chunk_array, size_t chunk_top);
+  void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl);
+};
+
+// Parallel initial mark task
+class CMSParInitialMarkTask: public CMSParMarkTask {
+ public:
+  CMSParInitialMarkTask(CMSCollector* collector, int n_workers) :
+      CMSParMarkTask("Scan roots and young gen for initial mark in parallel",
+                     collector, n_workers) {}
+  void work(uint worker_id);
+};
+
 // Checkpoint the roots into this generation from outside
 // this generation. [Note this initial checkpoint need only
 // be approximate -- we'll do a catch up phase subsequently.]
@@ -3646,19 +3705,42 @@
   // the klasses. The claimed marks need to be cleared before marking starts.
   ClassLoaderDataGraph::clear_claimed_marks();
 
-  CMKlassClosure klass_closure(&notOlder);
+  if (CMSPrintEdenSurvivorChunks) {
+    print_eden_and_survivor_chunk_arrays();
+  }
+
   {
     COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
-    gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
-    gch->gen_process_strong_roots(_cmsGen->level(),
-                                  true,   // younger gens are roots
-                                  true,   // activate StrongRootsScope
-                                  false,  // not scavenging
-                                  SharedHeap::ScanningOption(roots_scanning_options()),
-                                  &notOlder,
-                                  true,   // walk all of code cache if (so & SO_CodeCache)
-                                  NULL,
-                                  &klass_closure);
+    if (CMSParallelInitialMarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
+      // The parallel version.
+      FlexibleWorkGang* workers = gch->workers();
+      assert(workers != NULL, "Need parallel worker threads.");
+      int n_workers = workers->active_workers();
+      CMSParInitialMarkTask tsk(this, n_workers);
+      gch->set_par_threads(n_workers);
+      initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
+      if (n_workers > 1) {
+        GenCollectedHeap::StrongRootsScope srs(gch);
+        workers->run_task(&tsk);
+      } else {
+        GenCollectedHeap::StrongRootsScope srs(gch);
+        tsk.work(0);
+      }
+      gch->set_par_threads(0);
+    } else {
+      // The serial version.
+      CMKlassClosure klass_closure(&notOlder);
+      gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
+      gch->gen_process_strong_roots(_cmsGen->level(),
+                                    true,   // younger gens are roots
+                                    true,   // activate StrongRootsScope
+                                    false,  // not scavenging
+                                    SharedHeap::ScanningOption(roots_scanning_options()),
+                                    &notOlder,
+                                    true,   // walk all of code cache if (so & SO_CodeCache)
+                                    NULL,
+                                    &klass_closure);
+    }
   }
 
   // Clear mod-union table; it will be dirtied in the prologue of
@@ -4417,7 +4499,9 @@
   verify_overflow_empty();
   _abort_preclean = false;
   if (CMSPrecleaningEnabled) {
-    _eden_chunk_index = 0;
+    if (!CMSEdenChunksRecordAlways) {
+      _eden_chunk_index = 0;
+    }
     size_t used = get_eden_used();
     size_t capacity = get_eden_capacity();
     // Don't start sampling unless we will get sufficiently
@@ -4526,7 +4610,9 @@
   if (!_start_sampling) {
     return;
   }
-  if (_eden_chunk_array) {
+  // When CMSEdenChunksRecordAlways is true, the eden chunk array
+  // is populated by the young generation.
+  if (_eden_chunk_array != NULL && !CMSEdenChunksRecordAlways) {
     if (_eden_chunk_index < _eden_chunk_capacity) {
       _eden_chunk_array[_eden_chunk_index] = *_top_addr;   // take sample
       assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
@@ -5010,6 +5096,10 @@
     // Update the saved marks which may affect the root scans.
     gch->save_marks();
 
+    if (CMSPrintEdenSurvivorChunks) {
+      print_eden_and_survivor_chunk_arrays();
+    }
+
     {
       COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
 
@@ -5116,10 +5206,53 @@
   }
 }
 
+void CMSParInitialMarkTask::work(uint worker_id) {
+  elapsedTimer _timer;
+  ResourceMark rm;
+  HandleMark   hm;
+
+  // ---------- scan from roots --------------
+  _timer.start();
+  GenCollectedHeap* gch = GenCollectedHeap::heap();
+  Par_MarkRefsIntoClosure par_mri_cl(_collector->_span, &(_collector->_markBitMap));
+  CMKlassClosure klass_closure(&par_mri_cl);
+
+  // ---------- young gen roots --------------
+  {
+    work_on_young_gen_roots(worker_id, &par_mri_cl);
+    _timer.stop();
+    if (PrintCMSStatistics != 0) {
+      gclog_or_tty->print_cr(
+        "Finished young gen initial mark scan work in %dth thread: %3.3f sec",
+        worker_id, _timer.seconds());
+    }
+  }
+
+  // ---------- remaining roots --------------
+  _timer.reset();
+  _timer.start();
+  gch->gen_process_strong_roots(_collector->_cmsGen->level(),
+                                false,     // yg was scanned above
+                                false,     // this is parallel code
+                                false,     // not scavenging
+                                SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
+                                &par_mri_cl,
+                                true,   // walk all of code cache if (so & SO_CodeCache)
+                                NULL,
+                                &klass_closure);
+  assert(_collector->should_unload_classes()
+         || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache),
+         "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
+  _timer.stop();
+  if (PrintCMSStatistics != 0) {
+    gclog_or_tty->print_cr(
+      "Finished remaining root initial mark scan work in %dth thread: %3.3f sec",
+      worker_id, _timer.seconds());
+  }
+}
+
 // Parallel remark task
-class CMSParRemarkTask: public AbstractGangTask {
-  CMSCollector* _collector;
-  int           _n_workers;
+class CMSParRemarkTask: public CMSParMarkTask {
   CompactibleFreeListSpace* _cms_space;
 
   // The per-thread work queues, available here for stealing.
@@ -5133,10 +5266,9 @@
                    CompactibleFreeListSpace* cms_space,
                    int n_workers, FlexibleWorkGang* workers,
                    OopTaskQueueSet* task_queues):
-    AbstractGangTask("Rescan roots and grey objects in parallel"),
-    _collector(collector),
+    CMSParMarkTask("Rescan roots and grey objects in parallel",
+                   collector, n_workers),
     _cms_space(cms_space),
-    _n_workers(n_workers),
     _task_queues(task_queues),
     _term(n_workers, task_queues) { }
 
@@ -5150,11 +5282,6 @@
   void work(uint worker_id);
 
  private:
-  // Work method in support of parallel rescan ... of young gen spaces
-  void do_young_space_rescan(int i, Par_MarkRefsIntoAndScanClosure* cl,
-                             ContiguousSpace* space,
-                             HeapWord** chunk_array, size_t chunk_top);
-
   // ... of  dirty cards in old space
   void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i,
                                   Par_MarkRefsIntoAndScanClosure* cl);
@@ -5186,6 +5313,25 @@
   }
 };
 
+void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
+  DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
+  EdenSpace* eden_space = dng->eden();
+  ContiguousSpace* from_space = dng->from();
+  ContiguousSpace* to_space   = dng->to();
+
+  HeapWord** eca = _collector->_eden_chunk_array;
+  size_t     ect = _collector->_eden_chunk_index;
+  HeapWord** sca = _collector->_survivor_chunk_array;
+  size_t     sct = _collector->_survivor_chunk_index;
+
+  assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
+  assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
+
+  do_young_space_rescan(worker_id, cl, to_space, NULL, 0);
+  do_young_space_rescan(worker_id, cl, from_space, sca, sct);
+  do_young_space_rescan(worker_id, cl, eden_space, eca, ect);
+}
+
 // work_queue(i) is passed to the closure
 // Par_MarkRefsIntoAndScanClosure.  The "i" parameter
 // also is passed to do_dirty_card_rescan_tasks() and to
@@ -5210,23 +5356,7 @@
   // work first.
   // ---------- young gen roots --------------
   {
-    DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
-    EdenSpace* eden_space = dng->eden();
-    ContiguousSpace* from_space = dng->from();
-    ContiguousSpace* to_space   = dng->to();
-
-    HeapWord** eca = _collector->_eden_chunk_array;
-    size_t     ect = _collector->_eden_chunk_index;
-    HeapWord** sca = _collector->_survivor_chunk_array;
-    size_t     sct = _collector->_survivor_chunk_index;
-
-    assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
-    assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
-
-    do_young_space_rescan(worker_id, &par_mrias_cl, to_space, NULL, 0);
-    do_young_space_rescan(worker_id, &par_mrias_cl, from_space, sca, sct);
-    do_young_space_rescan(worker_id, &par_mrias_cl, eden_space, eca, ect);
-
+    work_on_young_gen_roots(worker_id, &par_mrias_cl);
     _timer.stop();
     if (PrintCMSStatistics != 0) {
       gclog_or_tty->print_cr(
@@ -5334,8 +5464,8 @@
 
 // Note that parameter "i" is not used.
 void
-CMSParRemarkTask::do_young_space_rescan(int i,
-  Par_MarkRefsIntoAndScanClosure* cl, ContiguousSpace* space,
+CMSParMarkTask::do_young_space_rescan(uint worker_id,
+  OopsInGenClosure* cl, ContiguousSpace* space,
   HeapWord** chunk_array, size_t chunk_top) {
   // Until all tasks completed:
   // . claim an unclaimed task
@@ -5530,6 +5660,32 @@
          "Else our work is not yet done");
 }
 
+// Record object boundaries in _eden_chunk_array by sampling the eden
+// top in the slow-path eden object allocation code path and record
+// the boundaries, if CMSEdenChunksRecordAlways is true. If
+// CMSEdenChunksRecordAlways is false, we use the other asynchronous
+// sampling in sample_eden() that activates during the part of the
+// preclean phase.
+void CMSCollector::sample_eden_chunk() {
+  if (CMSEdenChunksRecordAlways && _eden_chunk_array != NULL) {
+    if (_eden_chunk_lock->try_lock()) {
+      // Record a sample. This is the critical section. The contents
+      // of the _eden_chunk_array have to be non-decreasing in the
+      // address order.
+      _eden_chunk_array[_eden_chunk_index] = *_top_addr;
+      assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
+             "Unexpected state of Eden");
+      if (_eden_chunk_index == 0 ||
+          ((_eden_chunk_array[_eden_chunk_index] > _eden_chunk_array[_eden_chunk_index-1]) &&
+           (pointer_delta(_eden_chunk_array[_eden_chunk_index],
+                          _eden_chunk_array[_eden_chunk_index-1]) >= CMSSamplingGrain))) {
+        _eden_chunk_index++;  // commit sample
+      }
+      _eden_chunk_lock->unlock();
+    }
+  }
+}
+
 // Return a thread-local PLAB recording array, as appropriate.
 void* CMSCollector::get_data_recorder(int thr_num) {
   if (_survivor_plab_array != NULL &&
@@ -5553,12 +5709,13 @@
 
 // Merge the per-thread plab arrays into the global survivor chunk
 // array which will provide the partitioning of the survivor space
-// for CMS rescan.
+// for CMS initial scan and rescan.
 void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv,
                                               int no_of_gc_threads) {
   assert(_survivor_plab_array  != NULL, "Error");
   assert(_survivor_chunk_array != NULL, "Error");
-  assert(_collectorState == FinalMarking, "Error");
+  assert(_collectorState == FinalMarking ||
+         (CMSParallelInitialMarkEnabled && _collectorState == InitialMarking), "Error");
   for (int j = 0; j < no_of_gc_threads; j++) {
     _cursor[j] = 0;
   }
@@ -5621,7 +5778,7 @@
 }
 
 // Set up the space's par_seq_tasks structure for work claiming
-// for parallel rescan of young gen.
+// for parallel initial scan and rescan of young gen.
 // See ParRescanTask where this is currently used.
 void
 CMSCollector::
@@ -6748,6 +6905,28 @@
 void MarkRefsIntoClosure::do_oop(oop* p)       { MarkRefsIntoClosure::do_oop_work(p); }
 void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); }
 
+Par_MarkRefsIntoClosure::Par_MarkRefsIntoClosure(
+  MemRegion span, CMSBitMap* bitMap):
+    _span(span),
+    _bitMap(bitMap)
+{
+    assert(_ref_processor == NULL, "deliberately left NULL");
+    assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
+}
+
+void Par_MarkRefsIntoClosure::do_oop(oop obj) {
+  // if p points into _span, then mark corresponding bit in _markBitMap
+  assert(obj->is_oop(), "expected an oop");
+  HeapWord* addr = (HeapWord*)obj;
+  if (_span.contains(addr)) {
+    // this should be made more efficient
+    _bitMap->par_mark(addr);
+  }
+}
+
+void Par_MarkRefsIntoClosure::do_oop(oop* p)       { Par_MarkRefsIntoClosure::do_oop_work(p); }
+void Par_MarkRefsIntoClosure::do_oop(narrowOop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); }
+
 // A variant of the above, used for CMS marking verification.
 MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure(
   MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm):
@@ -9305,7 +9484,6 @@
     return;
   }
 }
-
 // Transfer some number of overflown objects to usual marking
 // stack. Return true if some objects were transferred.
 bool MarkRefsIntoAndScanClosure::take_from_overflow_list() {
@@ -9377,4 +9555,3 @@
       ShouldNotReachHere();
   }
 }
-
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -515,6 +515,8 @@
   friend class ConcurrentMarkSweepThread;
   friend class ConcurrentMarkSweepGeneration;
   friend class CompactibleFreeListSpace;
+  friend class CMSParMarkTask;
+  friend class CMSParInitialMarkTask;
   friend class CMSParRemarkTask;
   friend class CMSConcMarkingTask;
   friend class CMSRefProcTaskProxy;
@@ -749,6 +751,7 @@
   Generation* _young_gen;  // the younger gen
   HeapWord** _top_addr;    // ... Top of Eden
   HeapWord** _end_addr;    // ... End of Eden
+  Mutex*     _eden_chunk_lock;
   HeapWord** _eden_chunk_array; // ... Eden partitioning array
   size_t     _eden_chunk_index; // ... top (exclusive) of array
   size_t     _eden_chunk_capacity;  // ... max entries in array
@@ -950,6 +953,7 @@
 
   // Support for parallel remark of survivor space
   void* get_data_recorder(int thr_num);
+  void sample_eden_chunk();
 
   CMSBitMap* markBitMap()  { return &_markBitMap; }
   void directAllocated(HeapWord* start, size_t size);
@@ -1027,6 +1031,8 @@
 
   // Initialization errors
   bool completed_initialization() { return _completed_initialization; }
+
+  void print_eden_and_survivor_chunk_arrays();
 };
 
 class CMSExpansionCause : public AllStatic  {
@@ -1317,6 +1323,10 @@
     //Delegate to collector
     return collector()->get_data_recorder(thr_num);
   }
+  void sample_eden_chunk() {
+    //Delegate to collector
+    return collector()->sample_eden_chunk();
+  }
 
   // Printing
   const char* name() const;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -96,11 +96,6 @@
           "the buffer will be enqueued for processing. A value of 0 "       \
           "specifies that mutator threads should not do such filtering.")   \
                                                                             \
-  develop(intx, G1ExtraRegionSurvRate, 33,                                  \
-          "If the young survival rate is S, and there's room left in "      \
-          "to-space, we will allow regions whose survival rate is up to "   \
-          "S + (1 - S)*X, where X is this parameter (as a fraction.)")      \
-                                                                            \
   develop(bool, G1SATBPrintStubs, false,                                    \
           "If true, print generated stubs for the SATB barrier")            \
                                                                             \
@@ -110,9 +105,6 @@
   develop(bool, G1RSBarrierRegionFilter, true,                              \
           "If true, generate region filtering code in RS barrier")          \
                                                                             \
-  develop(bool, G1RSBarrierNullFilter, true,                                \
-          "If true, generate null-pointer filtering code in RS barrier")    \
-                                                                            \
   develop(bool, G1DeferredRSUpdate, true,                                   \
           "If true, use deferred RS updates")                               \
                                                                             \
@@ -120,9 +112,6 @@
           "If true, verify that no dirty cards remain after RS log "        \
           "processing.")                                                    \
                                                                             \
-  develop(bool, G1RSCountHisto, false,                                      \
-          "If true, print a histogram of RS occupancies after each pause")  \
-                                                                            \
   diagnostic(bool, G1PrintRegionLivenessInfo, false,                        \
             "Prints the liveness information for all regions in the heap "  \
             "at the end of a marking cycle.")                               \
@@ -169,9 +158,6 @@
   product(uintx, G1ConcRSHotCardLimit, 4,                                   \
           "The threshold that defines (>=) a hot card.")                    \
                                                                             \
-  develop(bool, G1PrintOopAppls, false,                                     \
-          "When true, print applications of closures to external locs.")    \
-                                                                            \
   develop(intx, G1RSetRegionEntriesBase, 256,                               \
           "Max number of regions in a fine-grain table per MB.")            \
                                                                             \
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -314,6 +314,11 @@
     region_size = MAX_REGION_SIZE;
   }
 
+  if (region_size != G1HeapRegionSize) {
+    // Update the flag to make sure that PrintFlagsFinal logs the correct value
+    FLAG_SET_ERGO(uintx, G1HeapRegionSize, region_size);
+  }
+
   // And recalculate the log.
   region_size_log = log2_long((jlong) region_size);
 
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -1033,6 +1033,9 @@
   // have to use it here, as well.
   HeapWord* result = eden()->par_allocate(word_size);
   if (result != NULL) {
+    if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
+      _next_gen->sample_eden_chunk();
+    }
     return result;
   }
   do {
@@ -1063,13 +1066,19 @@
   // circular dependency at compile time.
   if (result == NULL) {
     result = allocate_from_space(word_size);
+  } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
+    _next_gen->sample_eden_chunk();
   }
   return result;
 }
 
 HeapWord* DefNewGeneration::par_allocate(size_t word_size,
                                          bool is_tlab) {
-  return eden()->par_allocate(word_size);
+  HeapWord* res = eden()->par_allocate(word_size);
+  if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
+    _next_gen->sample_eden_chunk();
+  }
+  return res;
 }
 
 void DefNewGeneration::gc_prologue(bool full) {
--- a/hotspot/src/share/vm/memory/generation.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/memory/generation.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -455,6 +455,7 @@
   // expected to be GC worker thread-local, with the worker index
   // indicated by "thr_num".
   virtual void* get_data_recorder(int thr_num) { return NULL; }
+  virtual void sample_eden_chunk() {}
 
   // Some generations may require some cleanup actions before allowing
   // a verification.
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -2254,10 +2254,11 @@
 
 void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
   assert_lock_strong(_lock);
+  size_t raw_word_size = get_raw_word_size(word_size);
   size_t min_size = TreeChunk<Metablock, FreeList>::min_size();
-  assert(word_size >= min_size,
+  assert(raw_word_size >= min_size,
     err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size));
-  block_freelists()->return_block(p, word_size);
+  block_freelists()->return_block(p, raw_word_size);
 }
 
 // Adds a chunk to the list of chunks in use.
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -65,7 +65,8 @@
   }
   _sh = this;  // ch is static, should be set only once.
   if ((UseParNewGC ||
-      (UseConcMarkSweepGC && CMSParallelRemarkEnabled) ||
+      (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled ||
+                              CMSParallelRemarkEnabled)) ||
        UseG1GC) &&
       ParallelGCThreads > 0) {
     _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -1891,6 +1891,10 @@
     warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
             "and will likely be removed in future release");
   }
+  if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
+    warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
+        "Use MaxRAMFraction instead.");
+  }
 }
 
 // Check stack pages settings
--- a/hotspot/src/share/vm/runtime/globals.hpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Tue Aug 06 16:54:56 2013 -0700
@@ -1689,6 +1689,9 @@
   product(bool, CMSAbortSemantics, false,                                   \
           "Whether abort-on-overflow semantics is implemented")             \
                                                                             \
+  product(bool, CMSParallelInitialMarkEnabled, true,                        \
+          "Use the parallel initial mark.")                                 \
+                                                                            \
   product(bool, CMSParallelRemarkEnabled, true,                             \
           "Whether parallel remark enabled (only if ParNewGC)")             \
                                                                             \
@@ -1700,6 +1703,14 @@
           "Whether to always record survivor space PLAB bdries"             \
           " (effective only if CMSParallelSurvivorRemarkEnabled)")          \
                                                                             \
+  product(bool, CMSEdenChunksRecordAlways, true,                            \
+          "Whether to always record eden chunks used for "                  \
+          "the parallel initial mark or remark of eden" )                   \
+                                                                            \
+  product(bool, CMSPrintEdenSurvivorChunks, false,                          \
+          "Print the eden and the survivor chunks used for the parallel "   \
+          "initial mark or remark of the eden/survivor spaces")             \
+                                                                            \
   product(bool, CMSConcurrentMTEnabled, true,                               \
           "Whether multi-threaded concurrent work enabled (if ParNewGC)")   \
                                                                             \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+/*
+ * @test TestG1HeapRegionSize
+ * @key gc
+ * @bug 8021879
+ * @summary Verify that the flag G1HeapRegionSize is updated properly
+ * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
+ * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
+ * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
+ * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
+ */
+
+import sun.management.ManagementFactoryHelper;
+import com.sun.management.HotSpotDiagnosticMXBean;
+import com.sun.management.VMOption;
+
+public class TestG1HeapRegionSize {
+
+  public static void main(String[] args) {
+    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+
+    VMOption option = diagnostic.getVMOption("UseG1GC");
+    if (option.getValue().equals("false")) {
+      System.out.println("Skipping this test. It is only a G1 test.");
+      return;
+    }
+
+    String expectedValue = getExpectedValue(args);
+    option = diagnostic.getVMOption("G1HeapRegionSize");
+    if (!expectedValue.equals(option.getValue())) {
+      throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
+    }
+  }
+
+  private static String getExpectedValue(String[] args) {
+    if (args.length != 1) {
+      throw new RuntimeException("Wrong number of arguments. Expected 1 but got " + args.length);
+    }
+    return args[0];
+  }
+
+}
--- a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,7 +27,7 @@
  * @bug 8014240
  * @summary Test output of G1PrintRegionRememberedSetInfo
  * @library /testlibrary
- * @build TestPrintRegionRememberedSetInfo
+ * @run main TestPrintRegionRememberedSetInfo
  * @author thomas.schatzl@oracle.com
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+/*
+* @test TestDefaultMaxRAMFraction
+* @key gc
+* @bug 8021967
+* @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message
+* @library /testlibrary
+*/
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+public class TestDefaultMaxRAMFraction {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version");
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead.");
+    output.shouldNotContain("error");
+    output.shouldHaveExitValue(0);
+  }
+
+}
--- a/hotspot/test/runtime/6929067/Test6929067.sh	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/test/runtime/6929067/Test6929067.sh	Tue Aug 06 16:54:56 2013 -0700
@@ -3,6 +3,7 @@
 ##
 ## @test Test6929067.sh
 ## @bug 6929067
+## @bug 8021296
 ## @summary Stack guard pages should be removed when thread is detached
 ## @compile T.java
 ## @run shell Test6929067.sh
@@ -21,6 +22,11 @@
 OS=`uname -s`
 case "$OS" in
   Linux)
+    gcc_cmd=`which gcc`
+    if [ "x$gcc_cmd" == "x" ]; then
+        echo "WARNING: gcc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
     NULL=/dev/null
     PS=":"
     FS="/"
@@ -119,10 +125,10 @@
 # Check to ensure you have a /usr/lib/libpthread.so if you don't please look
 # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
 
-gcc -DLINUX ${COMP_FLAG} -o invoke \
-  -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
-  -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
-  -ljvm -lpthread invoke.c
+$gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \
+    -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
+    -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
+    -ljvm -lpthread invoke.c
 
 ./invoke
 exit $?
--- a/hotspot/test/runtime/7107135/Test7107135.sh	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/test/runtime/7107135/Test7107135.sh	Tue Aug 06 16:54:56 2013 -0700
@@ -27,6 +27,7 @@
 ##
 ## @test Test7107135.sh
 ## @bug 7107135
+## @bug 8021296
 ## @summary Stack guard pages lost after loading library with executable stack.
 ## @run shell Test7107135.sh
 ##
@@ -45,6 +46,11 @@
 case "$OS" in
   Linux)
     echo "Testing on Linux"
+    gcc_cmd=`which gcc`
+    if [ "x$gcc_cmd" == "x" ]; then
+        echo "WARNING: gcc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
     ;;
   *)
     NULL=NUL
@@ -62,7 +68,10 @@
 cp ${TESTSRC}${FS}*.java ${THIS_DIR}
 ${TESTJAVA}${FS}bin${FS}javac *.java
 
-gcc -fPIC -shared -c -o test.o -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux ${TESTSRC}${FS}test.c
+$gcc_cmd -fPIC -shared -c -o test.o \
+    -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \
+    ${TESTSRC}${FS}test.c
+
 ld -shared -z   execstack -o libtest-rwx.so test.o
 ld -shared -z noexecstack -o libtest-rw.so  test.o
 
--- a/hotspot/test/runtime/jsig/Test8017498.sh	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/test/runtime/jsig/Test8017498.sh	Tue Aug 06 16:54:56 2013 -0700
@@ -27,6 +27,7 @@
 ## @test Test8017498.sh
 ## @bug 8017498
 ## @bug 8020791
+## @bug 8021296
 ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
 ## @run shell/timeout=30 Test8017498.sh
 ##
@@ -45,6 +46,11 @@
 case "$OS" in
   Linux)
     echo "Testing on Linux"
+    gcc_cmd=`which gcc`
+    if [ "x$gcc_cmd" == "x" ]; then
+        echo "WARNING: gcc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
     if [ "$VM_BITS" = "64" ]
     then
         MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
@@ -64,15 +70,11 @@
 cp ${TESTSRC}${FS}*.java ${THIS_DIR}
 ${TESTJAVA}${FS}bin${FS}javac *.java
 
-gcc -DLINUX -fPIC -shared \
+$gcc_cmd -DLINUX -fPIC -shared \
     -o ${TESTSRC}${FS}libTestJNI.so \
     -I${TESTJAVA}${FS}include \
     -I${TESTJAVA}${FS}include${FS}linux \
     ${TESTSRC}${FS}TestJNI.c
-if [ $? != 0 ]
-then
-    echo "WARNING: the gcc command failed." 2>&1
-fi
 
 # run the java test in the background
 cmd="LD_PRELOAD=$MY_LD_PRELOAD \
--- a/hotspot/test/runtime/jsig/TestJNI.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/hotspot/test/runtime/jsig/TestJNI.c	Tue Aug 06 16:54:56 2013 -0700
@@ -21,7 +21,6 @@
  * questions.
  */
 
-#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h
 #include <stdio.h>
 #include <jni.h>
 #include <signal.h>
@@ -32,11 +31,8 @@
 #endif
 
 void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
-    int thrNum;
 
     printf( " HANDLER (1) " );
-    // Move forward RIP to skip failing instruction
-    context->uc_mcontext.gregs[REG_RIP] += 6;
 }
 
 JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) {
--- a/jaxp/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/jaxp/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 15e5bb51bc0cd89304dc2f7f29b4c8002e632353 jdk8-b98
 adf49c3ef83c160d53ece623049b2cdccaf78fc7 jdk8-b99
 5d1974c1d7b9a86431bc253dc5a6a52d4586622e jdk8-b100
+0a7432f898e579ea35e8c51e3edab37f949168e4 jdk8-b101
--- a/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jaxp/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -112,7 +112,7 @@
     /** Initial EntityResolver */
     private final EntityResolver fInitEntityResolver;
 
-    private XMLSecurityPropertyManager fSecurityPropertyMgr;
+    private final XMLSecurityPropertyManager fSecurityPropertyMgr;
 
     /**
      * Create a SAX parser with the associated features
@@ -130,8 +130,10 @@
     SAXParserImpl(SAXParserFactoryImpl spf, Hashtable features, boolean secureProcessing)
         throws SAXException
     {
+        fSecurityPropertyMgr = new XMLSecurityPropertyManager();
+
         // Instantiate a SAXParser directly and not through SAX so that we use the right ClassLoader
-        xmlReader = new JAXPSAXParser(this);
+        xmlReader = new JAXPSAXParser(this, fSecurityPropertyMgr);
 
         // JAXP "namespaceAware" == SAX Namespaces feature
         // Note: there is a compatibility problem here with default values:
@@ -150,7 +152,6 @@
             xmlReader.setFeature0(XINCLUDE_FEATURE, true);
         }
 
-        fSecurityPropertyMgr = new XMLSecurityPropertyManager();
         xmlReader.setProperty0(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
 
         // If the secure processing feature is on set a security manager.
@@ -397,14 +398,30 @@
         private final HashMap fInitFeatures = new HashMap();
         private final HashMap fInitProperties = new HashMap();
         private final SAXParserImpl fSAXParser;
+        private XMLSecurityPropertyManager fSecurityPropertyMgr;
+
 
         public JAXPSAXParser() {
-            this(null);
+            this(null, null);
         }
 
-        JAXPSAXParser(SAXParserImpl saxParser) {
+        JAXPSAXParser(SAXParserImpl saxParser, XMLSecurityPropertyManager spm) {
             super();
             fSAXParser = saxParser;
+            fSecurityPropertyMgr = spm;
+
+            /**
+             * This class may be used directly. So initialize the security manager if
+             * it is null.
+             */
+            if (fSecurityPropertyMgr == null) {
+                fSecurityPropertyMgr = new XMLSecurityPropertyManager();
+                try {
+                    super.setProperty(XML_SECURITY_PROPERTY_MANAGER, fSecurityPropertyMgr);
+                } catch (Exception ex) {
+                    //shall not happen
+                }
+            }
         }
 
         /**
@@ -542,9 +559,9 @@
                 setSchemaValidatorProperty(name, value);
             }
             /** Check to see if the property is managed by the property manager **/
-            int index = fSAXParser.fSecurityPropertyMgr.getIndex(name);
+            int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
             if (index > -1) {
-                fSAXParser.fSecurityPropertyMgr.setValue(index,
+                fSecurityPropertyMgr.setValue(index,
                         XMLSecurityPropertyManager.State.APIPROPERTY, (String)value);
             } else {
                 if (!fInitProperties.containsKey(name)) {
@@ -564,9 +581,9 @@
                 // JAXP 1.2 support
                 return fSAXParser.schemaLanguage;
             }
-            int index = fSAXParser.fSecurityPropertyMgr.getIndex(name);
+            int index = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getIndex(name) : -1;
             if (index > -1) {
-                return fSAXParser.fSecurityPropertyMgr.getValueByIndex(index);
+                return fSecurityPropertyMgr.getValueByIndex(index);
             }
 
             return super.getProperty(name);
--- a/jaxws/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/jaxws/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 b1fb4612a2caea52b5661b87509e560fa044b194 jdk8-b98
 8ef83d4b23c933935e28f59b282cea920b1b1f5f jdk8-b99
 4fd722afae5c02f00bbd44c3a34425ee474afb1c jdk8-b100
+60b623a361642a0f5aef5f06dad9e5f279b9d9a9 jdk8-b101
--- a/jdk/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 c4908732fef5235f1b98cafe0ce507771ef7892c jdk8-b98
 6a099a36589bd933957272ba63e5263bede29971 jdk8-b99
 5be9c5bfcfe9b2a40412b4fb364377d49de014eb jdk8-b100
+6901612328239fbd471d20823113c1cf3fdaebee jdk8-b101
--- a/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/classes/com/apple/eawt/_AppMenuBarHandler.java	Tue Aug 06 16:54:56 2013 -0700
@@ -31,6 +31,7 @@
 import javax.swing.*;
 import javax.swing.plaf.MenuBarUI;
 
+import com.apple.laf.ScreenMenuBar;
 import sun.lwawt.macosx.CMenuBar;
 
 import com.apple.laf.AquaMenuBarUI;
@@ -72,12 +73,15 @@
         // scan the current frames, and see if any are foreground
         final Frame[] frames = Frame.getFrames();
         for (final Frame frame : frames) {
-            if (frame.isVisible() && !isFrameMinimized(frame)) return;
+            if (frame.isVisible() && !isFrameMinimized(frame)) {
+                return;
+            }
         }
 
         // if we have no foreground frames, then we have to "kick" the menubar
         final JFrame pingFrame = new JFrame();
         pingFrame.getRootPane().putClientProperty("Window.alpha", new Float(0.0f));
+        pingFrame.setUndecorated(true);
         pingFrame.setVisible(true);
         pingFrame.toFront();
         pingFrame.setVisible(false);
@@ -101,7 +105,6 @@
             // Aqua was not installed
             throw new IllegalStateException("Application.setDefaultMenuBar() only works with the Aqua Look and Feel");
         }
-/* TODO: disabled until ScreenMenuBar is working
 
         final AquaMenuBarUI aquaUI = (AquaMenuBarUI)ui;
         final ScreenMenuBar screenMenuBar = aquaUI.getScreenMenuBar();
@@ -118,8 +121,7 @@
         }
 
         // grab the pointer to the CMenuBar, and retain it in native
-        nativeSetDefaultMenuBar(((CMenuBar)peer).getNativeMenuBarPeer());
-*/
+        nativeSetDefaultMenuBar(((CMenuBar)peer).getModel());
     }
 
     void setAboutMenuItemVisible(final boolean present) {
--- a/jdk/src/macosx/classes/sun/font/CStrike.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/classes/sun/font/CStrike.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 
 import sun.awt.SunHints;
 
-public class CStrike extends FontStrike {
+public final class CStrike extends FontStrike {
 
     // Creates the native strike
     private static native long createNativeStrikePtr(long nativeFontPtr,
@@ -68,10 +68,10 @@
                                                          Rectangle2D.Float result,
                                                          double x, double y);
 
-    private CFont nativeFont;
+    private final CFont nativeFont;
     private AffineTransform invDevTx;
-    private GlyphInfoCache glyphInfoCache;
-    private GlyphAdvanceCache glyphAdvanceCache;
+    private final GlyphInfoCache glyphInfoCache;
+    private final GlyphAdvanceCache glyphAdvanceCache;
     private long nativeStrikePtr;
 
     CStrike(final CFont font, final FontStrikeDesc inDesc) {
@@ -84,11 +84,11 @@
         // Normally the device transform should be the identity transform
         // for screen operations.  The device transform only becomes
         // interesting when we are outputting between different dpi surfaces,
-        // like when we are printing to postscript.
+        // like when we are printing to postscript or use retina.
         if (inDesc.devTx != null && !inDesc.devTx.isIdentity()) {
             try {
                 invDevTx = inDesc.devTx.createInverse();
-            } catch (NoninvertibleTransformException e) {
+            } catch (NoninvertibleTransformException ignored) {
                 // ignored, since device transforms should not be that
                 // complicated, and if they are - there is nothing we can do,
                 // so we won't worry about it.
@@ -134,15 +134,13 @@
         nativeStrikePtr = 0;
     }
 
-    // the fractional metrics default on our platform is OFF
-    private boolean useFractionalMetrics() {
-        return desc.fmHint == SunHints.INTVAL_FRACTIONALMETRICS_ON;
-    }
 
+    @Override
     public int getNumGlyphs() {
         return nativeFont.getNumGlyphs();
     }
 
+    @Override
     StrikeMetrics getFontMetrics() {
         if (strikeMetrics == null) {
             StrikeMetrics metrics = getFontMetrics(getNativeStrikePtr());
@@ -155,74 +153,24 @@
         return strikeMetrics;
     }
 
-    float getGlyphAdvance(int glyphCode) {
-        return getScaledAdvanceForAdvance(getCachedNativeGlyphAdvance(glyphCode));
-    }
-
-    float getCodePointAdvance(int cp) {
-        float advance = getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(cp));
-
-        double glyphScaleX = desc.glyphTx.getScaleX();
-        double devScaleX = desc.devTx.getScaleX();
-
-        if (devScaleX == 0) {
-            glyphScaleX = Math.sqrt(desc.glyphTx.getDeterminant());
-            devScaleX = Math.sqrt(desc.devTx.getDeterminant());
-        }
-
-        if (devScaleX == 0) {
-            devScaleX = Double.NaN; // this an undefined graphics state
-        }
-        advance = (float) (advance * glyphScaleX / devScaleX);
-        return useFractionalMetrics() ? advance : Math.round(advance);
-    }
-
-    // calculate an advance, and round if not using fractional metrics
-    private float getScaledAdvanceForAdvance(float advance) {
-        if (invDevTx != null) {
-            advance *= invDevTx.getScaleX();
-        }
-        advance *= desc.glyphTx.getScaleX();
-        return useFractionalMetrics() ? advance : Math.round(advance);
+    @Override
+    float getGlyphAdvance(final int glyphCode) {
+        return getCachedNativeGlyphAdvance(glyphCode);
     }
 
-    Point2D.Float getCharMetrics(char ch) {
-        return getScaledPointForAdvance(getCachedNativeGlyphAdvance(nativeFont.getMapper().charToGlyph(ch)));
-    }
-
-    Point2D.Float getGlyphMetrics(int glyphCode) {
-        return getScaledPointForAdvance(getCachedNativeGlyphAdvance(glyphCode));
+    @Override
+    float getCodePointAdvance(final int cp) {
+        return getGlyphAdvance(nativeFont.getMapper().charToGlyph(cp));
     }
 
-    // calculate an advance point, and round if not using fractional metrics
-    private Point2D.Float getScaledPointForAdvance(float advance) {
-        Point2D.Float pt = new Point2D.Float(advance, 0);
-
-        if (!desc.glyphTx.isIdentity()) {
-            return scalePoint(pt);
-        }
-
-        if (!useFractionalMetrics()) {
-            pt.x = Math.round(pt.x);
-        }
-        return pt;
+    @Override
+    Point2D.Float getCharMetrics(final char ch) {
+        return getGlyphMetrics(nativeFont.getMapper().charToGlyph(ch));
     }
 
-    private Point2D.Float scalePoint(Point2D.Float pt) {
-        if (invDevTx != null) {
-            // transform the point out of the device space first
-            invDevTx.transform(pt, pt);
-        }
-        desc.glyphTx.transform(pt, pt);
-        pt.x -= desc.glyphTx.getTranslateX();
-        pt.y -= desc.glyphTx.getTranslateY();
-
-        if (!useFractionalMetrics()) {
-            pt.x = Math.round(pt.x);
-            pt.y = Math.round(pt.y);
-        }
-
-        return pt;
+    @Override
+    Point2D.Float getGlyphMetrics(final int glyphCode) {
+        return new Point2D.Float(getGlyphAdvance(glyphCode), 0.0f);
     }
 
     Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
@@ -414,9 +362,7 @@
         private SparseBitShiftingTwoLayerArray secondLayerCache;
         private HashMap<Integer, Long> generalCache;
 
-        public GlyphInfoCache(final Font2D nativeFont,
-                              final FontStrikeDesc desc)
-        {
+        GlyphInfoCache(final Font2D nativeFont, final FontStrikeDesc desc) {
             super(nativeFont, desc);
             firstLayerCache = new long[FIRST_LAYER_SIZE];
         }
@@ -527,7 +473,7 @@
             final int shift;
             final int secondLayerLength;
 
-            public SparseBitShiftingTwoLayerArray(final int size, final int shift) {
+            SparseBitShiftingTwoLayerArray(final int size, final int shift) {
                 this.shift = shift;
                 this.cache = new long[1 << shift][];
                 this.secondLayerLength = size >> shift;
@@ -559,6 +505,12 @@
         private SparseBitShiftingTwoLayerArray secondLayerCache;
         private HashMap<Integer, Float> generalCache;
 
+        // Empty non private constructor was added because access to this
+        // class shouldn't be emulated by a synthetic accessor method.
+        GlyphAdvanceCache() {
+            super();
+        }
+
         public synchronized float get(final int index) {
             if (index < 0) {
                 if (-index < SECOND_LAYER_SIZE) {
@@ -609,9 +561,7 @@
             final int shift;
             final int secondLayerLength;
 
-            public SparseBitShiftingTwoLayerArray(final int size,
-                                                  final int shift)
-            {
+            SparseBitShiftingTwoLayerArray(final int size, final int shift) {
                 this.shift = shift;
                 this.cache = new float[1 << shift][];
                 this.secondLayerLength = size >> shift;
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CDataTransferer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -182,7 +182,11 @@
         Long format = predefinedClipboardNameMap.get(str);
 
         if (format == null) {
-            format = new Long(registerFormatWithPasteboard(str));
+            if (java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()) {
+                // Do not try to access native system for the unknown format
+                return -1L;
+            }
+            format = registerFormatWithPasteboard(str);
             predefinedClipboardNameMap.put(str, format);
             predefinedClipboardFormatMap.put(format, str);
         }
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CMenuComponent.java	Tue Aug 06 16:54:56 2013 -0700
@@ -43,7 +43,7 @@
         return target;
     }
 
-    long getModel() {
+    public long getModel() {
         return modelPtr;
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java	Tue Aug 06 16:54:56 2013 -0700
@@ -47,7 +47,7 @@
 import com.sun.awt.AWTUtilities;
 
 public class CPlatformWindow extends CFRetainedResource implements PlatformWindow {
-    private native long nativeCreateNSWindow(long nsViewPtr, long styleBits, double x, double y, double w, double h);
+    private native long nativeCreateNSWindow(long nsViewPtr,long ownerPtr, long styleBits, double x, double y, double w, double h);
     private static native void nativeSetNSWindowStyleBits(long nsWindowPtr, int mask, int data);
     private static native void nativeSetNSWindowMenuBar(long nsWindowPtr, long menuBarPtr);
     private static native Insets nativeGetNSWindowInsets(long nsWindowPtr);
@@ -230,7 +230,8 @@
         contentView = createContentView();
         contentView.initialize(peer, responder);
 
-        final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), styleBits, 0, 0, 0, 0);
+        final long ownerPtr = owner != null ? owner.getNSWindowPtr() : 0L;
+        final long nativeWindowPtr = nativeCreateNSWindow(contentView.getAWTView(), ownerPtr, styleBits, 0, 0, 0, 0);
         setPtr(nativeWindowPtr);
 
         if (target instanceof javax.swing.RootPaneContainer) {
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.h	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.h	Tue Aug 06 16:54:56 2013 -0700
@@ -44,6 +44,7 @@
     jint styleBits;
     BOOL isEnabled;
     NSWindow *nsWindow;
+    AWTWindow *ownerWindow;
 }
 
 // An instance of either AWTWindow_Normal or AWTWindow_Panel
@@ -51,12 +52,15 @@
 
 @property (nonatomic, retain) JNFWeakJObjectWrapper *javaPlatformWindow;
 @property (nonatomic, retain) CMenuBar *javaMenuBar;
+@property (nonatomic, retain) AWTWindow *ownerWindow;
 @property (nonatomic) NSSize javaMinSize;
 @property (nonatomic) NSSize javaMaxSize;
 @property (nonatomic) jint styleBits;
 @property (nonatomic) BOOL isEnabled;
 
+
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)javaPlatformWindow
+                  ownerWindow:owner
                     styleBits:(jint)styleBits
                     frameRect:(NSRect)frameRect
                   contentView:(NSView *)contentView;
--- a/jdk/src/macosx/native/sun/awt/AWTWindow.m	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/AWTWindow.m	Tue Aug 06 16:54:56 2013 -0700
@@ -30,6 +30,7 @@
 #import "sun_lwawt_macosx_CPlatformWindow.h"
 #import "com_apple_eawt_event_GestureHandler.h"
 #import "com_apple_eawt_FullScreenHandler.h"
+#import "ApplicationDelegate.h"
 
 #import "AWTWindow.h"
 #import "AWTView.h"
@@ -55,7 +56,7 @@
 // doesn't provide information about "opposite" window, so we
 // have to do a bit of tracking. This variable points to a window
 // which had been the key window just before a new key window
-// was set. It would be nil if the new key window isn't an AWT 
+// was set. It would be nil if the new key window isn't an AWT
 // window or the app currently has no key window.
 static AWTWindow* lastKeyWindow = nil;
 
@@ -120,6 +121,7 @@
 @synthesize javaMaxSize;
 @synthesize styleBits;
 @synthesize isEnabled;
+@synthesize ownerWindow;
 
 - (void) updateMinMaxSize:(BOOL)resizable {
     if (resizable) {
@@ -201,6 +203,7 @@
 }
 
 - (id) initWithPlatformWindow:(JNFWeakJObjectWrapper *)platformWindow
+                  ownerWindow:owner
                     styleBits:(jint)bits
                     frameRect:(NSRect)rect
                   contentView:(NSView *)view
@@ -245,6 +248,7 @@
     self.isEnabled = YES;
     self.javaPlatformWindow = platformWindow;
     self.styleBits = bits;
+    self.ownerWindow = owner;
     [self setPropertiesForStyleBits:styleBits mask:MASK(_METHOD_PROP_BITMASK)];
 
     return self;
@@ -350,7 +354,7 @@
     [self.javaPlatformWindow setJObject:nil withEnv:env];
 
     self.nsWindow = nil;
-
+    self.ownerWindow = nil;
     [super dealloc];
 }
 
@@ -539,11 +543,27 @@
 AWT_ASSERT_APPKIT_THREAD;
     [AWTToolkit eventCountPlusPlus];
     AWTWindow *opposite = [AWTWindow lastKeyWindow];
-    if (!IS(self.styleBits, IS_DIALOG)) {
-        [CMenuBar activate:self.javaMenuBar modallyDisabled:NO];
-    } else if ((opposite != NULL) && IS(self.styleBits, IS_MODAL)) {
-        [CMenuBar activate:opposite->javaMenuBar modallyDisabled:YES];        
+
+    // Finds appropriate menubar in our hierarchy,
+    AWTWindow *awtWindow = self;
+    while (awtWindow.ownerWindow != nil) {
+        awtWindow = awtWindow.ownerWindow;
     }
+
+    CMenuBar *menuBar = nil;
+    BOOL isDisabled = NO;
+    if ([awtWindow.nsWindow isVisible]){
+        menuBar = awtWindow.javaMenuBar;
+        isDisabled = !awtWindow.isEnabled;
+    }
+
+    if (menuBar == nil) {
+        menuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
+        isDisabled = NO;
+    }
+
+    [CMenuBar activate:menuBar modallyDisabled:isDisabled];
+
     [AWTWindow setLastKeyWindow:nil];
 
     [self _deliverWindowFocusEvent:YES oppositeWindow: opposite];
@@ -555,6 +575,14 @@
     [AWTToolkit eventCountPlusPlus];
     [self.javaMenuBar deactivate];
 
+    // In theory, this might cause flickering if the window gaining focus
+    // has its own menu. However, I couldn't reproduce it on practice, so
+    // perhaps this is a non issue.
+    CMenuBar* defaultMenu = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
+    if (defaultMenu != nil) {
+        [CMenuBar activate:defaultMenu modallyDisabled:NO];
+    }
+
     // the new key window
     NSWindow *keyWindow = [NSApp keyWindow];
     AWTWindow *opposite = nil;
@@ -741,7 +769,7 @@
  * Signature: (JJIIII)J
  */
 JNIEXPORT jlong JNICALL Java_sun_lwawt_macosx_CPlatformWindow_nativeCreateNSWindow
-(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
+(JNIEnv *env, jobject obj, jlong contentViewPtr, jlong ownerPtr, jlong styleBits, jdouble x, jdouble y, jdouble w, jdouble h)
 {
     __block AWTWindow *window = nil;
 
@@ -750,13 +778,14 @@
     JNFWeakJObjectWrapper *platformWindow = [JNFWeakJObjectWrapper wrapperWithJObject:obj withEnv:env];
     NSView *contentView = OBJC(contentViewPtr);
     NSRect frameRect = NSMakeRect(x, y, w, h);
-
+    AWTWindow *owner = [OBJC(ownerPtr) delegate];
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 
         window = [[AWTWindow alloc] initWithPlatformWindow:platformWindow
-                                                  styleBits:styleBits
-                                                  frameRect:frameRect
-                                                contentView:contentView];
+                                               ownerWindow:owner
+                                                 styleBits:styleBits
+                                                 frameRect:frameRect
+                                               contentView:contentView];
         // the window is released is CPlatformWindow.nativeDispose()
 
         if (window) CFRetain(window.nsWindow);
@@ -818,11 +847,19 @@
 
         AWTWindow *window = (AWTWindow*)[nsWindow delegate];
 
-        if ([nsWindow isKeyWindow]) [window.javaMenuBar deactivate];
+        if ([nsWindow isKeyWindow]) {
+            [window.javaMenuBar deactivate];
+        }
+
         window.javaMenuBar = menuBar;
 
+        CMenuBar* actualMenuBar = menuBar;
+        if (actualMenuBar == nil) {
+            actualMenuBar = [[ApplicationDelegate sharedDelegate] defaultMenuBar];
+        }
+
         if ([nsWindow isKeyWindow]) {
-            [CMenuBar activate:window.javaMenuBar modallyDisabled:NO];
+            [CMenuBar activate:actualMenuBar modallyDisabled:NO];
         }
     }];
 
--- a/jdk/src/macosx/native/sun/awt/CMenuBar.m	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/CMenuBar.m	Tue Aug 06 16:54:56 2013 -0700
@@ -63,7 +63,7 @@
         if (excludingAppleMenu && ![currMenu isJavaMenu]) {
             continue;
         }
-
+        [currItem setSubmenu:nil];
         [theMainMenu removeItemAtIndex:index];
     }
 
@@ -154,7 +154,10 @@
     // Clean up extra items
     NSUInteger removedIndex, removedCount = [removedMenuArray count];
     for (removedIndex=removedCount; removedIndex > 0; removedIndex--) {
-        [theMainMenu removeItemAtIndex:[[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue]];
+        NSUInteger index = [[removedMenuArray objectAtIndex:(removedIndex-1)] integerValue];
+        NSMenuItem *currItem = [theMainMenu itemAtIndex:index];
+        [currItem setSubmenu:nil];
+        [theMainMenu removeItemAtIndex:index];
     }
 
     i = cmenuIndex;
--- a/jdk/src/macosx/native/sun/awt/CMenuItem.m	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/awt/CMenuItem.m	Tue Aug 06 16:54:56 2013 -0700
@@ -70,9 +70,15 @@
     JNIEnv *env = [ThreadUtilities getJNIEnv];
 JNF_COCOA_ENTER(env);
 
-    // If we are called as a result of user pressing a shorcut, do nothing,
+    // If we are called as a result of user pressing a shortcut, do nothing,
     // because AVTView has already sent corresponding key event to the Java
-    // layer from performKeyEquivalent
+    // layer from performKeyEquivalent.
+    // There is an exception from the rule above, though: if a window with
+    // a menu gets minimized by user and there are no other windows to take
+    // focus, the window's menu won't be removed from the global menu bar.
+    // However, the Java layer won't handle invocation by a shortcut coming
+    // from this "frameless" menu, because there are no active windows. This
+    // means we have to handle it here.
     NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
     if ([currEvent type] == NSKeyDown) {
         NSString *menuKey = [sender keyEquivalent];
@@ -91,7 +97,8 @@
             eventKey = [NSString stringWithCharacters: &newChar length: 1];
         }
 
-        if ([menuKey isEqualToString:eventKey]) {
+        NSWindow *keyWindow = [NSApp keyWindow];
+        if ([menuKey isEqualToString:eventKey] && keyWindow != nil) {
             return;
         }
     }
--- a/jdk/src/macosx/native/sun/font/AWTStrike.h	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/font/AWTStrike.h	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,11 +31,12 @@
 @interface AWTStrike : NSObject {
 @public
     AWTFont *                fAWTFont;
-    CGFloat                    fSize;
+    CGFloat                  fSize;
     JRSFontRenderingStyle    fStyle;
-    jint                    fAAStyle;
+    jint                     fAAStyle;
 
     CGAffineTransform        fTx;
+    CGAffineTransform        fDevTx;
     CGAffineTransform        fAltTx; // alternate strike tx used for Sun2D
     CGAffineTransform        fFontTx;
 }
--- a/jdk/src/macosx/native/sun/font/AWTStrike.m	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/font/AWTStrike.m	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,7 @@
         invDevTx.b *= -1;
         invDevTx.c *= -1;
         fFontTx = CGAffineTransformConcat(CGAffineTransformConcat(tx, invDevTx), sInverseTX);
+        fDevTx = CGAffineTransformInvert(invDevTx);
 
         // the "font size" is the square root of the determinant of the matrix
         fSize = sqrt(abs(fFontTx.a * fFontTx.d - fFontTx.b * fFontTx.c));
@@ -148,7 +149,8 @@
 {
     CGSize advance;
 JNF_COCOA_ENTER(env);
-    AWTFont *awtFont = ((AWTStrike *)jlong_to_ptr(awtStrikePtr))->fAWTFont;
+    AWTStrike *awtStrike = (AWTStrike *)jlong_to_ptr(awtStrikePtr);
+    AWTFont *awtFont = awtStrike->fAWTFont;
 
     // negative glyph codes are really unicodes, which were placed there by the mapper
     // to indicate we should use CoreText to substitute the character
@@ -156,6 +158,10 @@
     const CTFontRef fallback = CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode(awtFont, glyphCode, &glyph);
     CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1);
     CFRelease(fallback);
+    advance = CGSizeApplyAffineTransform(advance, awtStrike->fFontTx);
+    if (!JRSFontStyleUsesFractionalMetrics(awtStrike->fStyle)) {
+        advance.width = round(advance.width);
+    }
 
 JNF_COCOA_EXIT(env);
     return advance.width;
--- a/jdk/src/macosx/native/sun/font/CGGlyphImages.m	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/macosx/native/sun/font/CGGlyphImages.m	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -455,6 +455,7 @@
 #define CGGI_GLYPH_BBOX_PADDING 2.0f
 static inline GlyphInfo *
 CGGI_CreateNewGlyphInfoFrom(CGSize advance, CGRect bbox,
+                            const AWTStrike *strike,
                             const CGGI_RenderingMode *mode)
 {
     size_t pixelSize = mode->glyphDescriptor->pixelSize;
@@ -477,6 +478,12 @@
         width = 1;
         height = 1;
     }
+    advance = CGSizeApplyAffineTransform(advance, strike->fFontTx);
+    if (!JRSFontStyleUsesFractionalMetrics(strike->fStyle)) {
+        advance.width = round(advance.width);
+        advance.height = round(advance.height);
+    }
+    advance = CGSizeApplyAffineTransform(advance, strike->fDevTx);
 
 #ifdef USE_IMAGE_ALIGNED_MEMORY
     // create separate memory
@@ -564,10 +571,10 @@
     JRSFontGetBoundingBoxesForGlyphsAndStyle(fallback, &tx, style, &glyph, 1, &bbox);
 
     CGSize advance;
-    JRSFontGetAdvancesForGlyphsAndStyle(fallback, &tx, strike->fStyle, &glyph, 1, &advance);
+    CTFontGetAdvancesForGlyphs(fallback, kCTFontDefaultOrientation, &glyph, &advance, 1);
 
     // create the Sun2D GlyphInfo we are going to strike into
-    GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, mode);
+    GlyphInfo *info = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode);
 
     // fix the context size, just in case the substituted character is unexpectedly large
     CGGI_SizeCanvas(canvas, info->width, info->height, mode->cgFontMode);
@@ -715,7 +722,7 @@
     JRSFontRenderingStyle bboxCGMode = JRSFontAlignStyleForFractionalMeasurement(strike->fStyle);
 
     JRSFontGetBoundingBoxesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, bboxCGMode, glyphs, len, bboxes);
-    JRSFontGetAdvancesForGlyphsAndStyle((CTFontRef)font->fFont, &tx, strike->fStyle, glyphs, len, advances);
+    CTFontGetAdvancesForGlyphs((CTFontRef)font->fFont, kCTFontDefaultOrientation, glyphs, advances, len);
 
     size_t maxWidth = 1;
     size_t maxHeight = 1;
@@ -732,7 +739,7 @@
         CGSize advance = advances[i];
         CGRect bbox = bboxes[i];
 
-        GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom(advance, bbox, mode);
+        GlyphInfo *glyphInfo = CGGI_CreateNewGlyphInfoFrom(advance, bbox, strike, mode);
 
         if (maxWidth < glyphInfo->width)   maxWidth = glyphInfo->width;
         if (maxHeight < glyphInfo->height) maxHeight = glyphInfo->height;
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/gtk/resources/gtk.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -1,54 +1,54 @@
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-
-
-
-# GTK specific properties
-
-# GTK color chooser properties:
-GTKColorChooserPanel.textAndMnemonic=&GTK Color Chooser
-# mnemonic as a VK_ constant
-
-GTKColorChooserPanel.hue.textAndMnemonic=&Hue:
-
-GTKColorChooserPanel.red.textAndMnemonic=R&ed:
-
-GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation:
-
-GTKColorChooserPanel.green.textAndMnemonic=&Green:
-
-GTKColorChooserPanel.value.textAndMnemonic=&Value:
-
-GTKColorChooserPanel.blue.textAndMnemonic=&Blue:
-
-GTKColorChooserPanel.color.textAndMnemonic=Color &Name:
-
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.acceptAllFileFilter.textAndMnemonic=All Files
-FileChooser.newFolderButton.textAndMnemonic=&New Folder
-FileChooser.newFolderDialog.textAndMnemonic=Folder name:
-FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
-FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory
-FileChooser.deleteFileButton.textAndMnemonic=De&lete File
-FileChooser.renameFileButton.textAndMnemonic=&Rename File
-FileChooser.cancelButton.textAndMnemonic=&Cancel
-FileChooser.saveButton.textAndMnemonic=&OK
-FileChooser.openButton.textAndMnemonic=&OK
-FileChooser.saveDialogTitle.textAndMnemonic=Save
-FileChooser.openDialogTitle.textAndMnemonic=Open
-FileChooser.pathLabel.textAndMnemonic=&Selection:
-FileChooser.filterLabel.textAndMnemonic=Filter:
-FileChooser.foldersLabel.textAndMnemonic=Fol&ders
-FileChooser.filesLabel.textAndMnemonic=&Files
-
-FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog.
-FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file.
-FileChooser.openButtonToolTip.textAndMnemonic=Open selected file.
-
-FileChooser.renameFileDialog.textAndMnemonic=Rename file "{0}" to
-FileChooser.renameFileError.titleAndMnemonic=Error
-FileChooser.renameFileError.textAndMnemonic=Error renaming file "{0}" to "{1}"
-
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+
+
+
+# GTK specific properties
+
+# GTK color chooser properties:
+GTKColorChooserPanel.textAndMnemonic=&GTK Color Chooser
+# mnemonic as a VK_ constant
+
+GTKColorChooserPanel.hue.textAndMnemonic=&Hue:
+
+GTKColorChooserPanel.red.textAndMnemonic=R&ed:
+
+GTKColorChooserPanel.saturation.textAndMnemonic=&Saturation:
+
+GTKColorChooserPanel.green.textAndMnemonic=&Green:
+
+GTKColorChooserPanel.value.textAndMnemonic=&Value:
+
+GTKColorChooserPanel.blue.textAndMnemonic=&Blue:
+
+GTKColorChooserPanel.color.textAndMnemonic=Color &Name:
+
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.acceptAllFileFilter.textAndMnemonic=All Files
+FileChooser.newFolderButton.textAndMnemonic=&New Folder
+FileChooser.newFolderDialog.textAndMnemonic=Folder name:
+FileChooser.newFolderNoDirectoryErrorTitle.textAndMnemonic=Error
+FileChooser.newFolderNoDirectoryError.textAndMnemonic=Error creating directory "{0}": No such file or directory
+FileChooser.deleteFileButton.textAndMnemonic=De&lete File
+FileChooser.renameFileButton.textAndMnemonic=&Rename File
+FileChooser.cancelButton.textAndMnemonic=&Cancel
+FileChooser.saveButton.textAndMnemonic=&OK
+FileChooser.openButton.textAndMnemonic=&OK
+FileChooser.saveDialogTitle.textAndMnemonic=Save
+FileChooser.openDialogTitle.textAndMnemonic=Open
+FileChooser.pathLabel.textAndMnemonic=&Selection:
+FileChooser.filterLabel.textAndMnemonic=Filter:
+FileChooser.foldersLabel.textAndMnemonic=Fol&ders
+FileChooser.filesLabel.textAndMnemonic=&Files
+
+FileChooser.cancelButtonToolTip.textAndMnemonic=Abort file chooser dialog.
+FileChooser.saveButtonToolTip.textAndMnemonic=Save selected file.
+FileChooser.openButtonToolTip.textAndMnemonic=Open selected file.
+
+FileChooser.renameFileDialog.textAndMnemonic=Rename file "{0}" to
+FileChooser.renameFileError.titleAndMnemonic=Error
+FileChooser.renameFileError.textAndMnemonic=Error renaming file "{0}" to "{1}"
+
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Tue Aug 06 16:54:56 2013 -0700
@@ -499,7 +499,8 @@
 
         public void setItem(Object item) {
             super.setItem(item);
-            if (editor.hasFocus()) {
+            Object focus = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
+            if ((focus == editor) || (focus == editor.getParent())) {
                 editor.selectAll();
             }
         }
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/synth/resources/synth.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -1,45 +1,45 @@
-# This properties file is used to create a PropertyResourceBundle
-# It contains Locale specific strings used be the Synth Look and Feel.
-# Currently, the following components need this for support:
-#
-#    FileChooser
-#
-# When this file is read in, the strings are put into the
-# defaults table.  This is an implementation detail of the current
-# workings of Swing.  DO NOT DEPEND ON THIS.
-# This may change in future versions of Swing as we improve localization
-# support.
-#
-# Refer to the note in basic.properties for a description as to what
-# the mnemonics correspond to and how to calculate them.
-#
-# @author Steve Wilson
-
-
-############ FILE CHOOSER STRINGS #############
-
-FileChooser.lookInLabel.textAndMnemonic=Look &In:
-FileChooser.saveInLabel.textAndMnemonic=Save In:
-FileChooser.fileNameLabel.textAndMnemonic=File &Name:
-FileChooser.folderNameLabel.textAndMnemonic=Folder &Name:
-FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type:
-FileChooser.upFolderToolTip.textAndMnemonic=Up One Level
-FileChooser.upFolderAccessibleName=Up
-FileChooser.homeFolderToolTip.textAndMnemonic=Home
-FileChooser.homeFolderAccessibleName=Home
-FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder
-FileChooser.newFolderAccessibleName=New Folder
-FileChooser.newFolderActionLabel.textAndMnemonic=New Folder
-FileChooser.listViewButtonToolTip.textAndMnemonic=List
-FileChooser.listViewButtonAccessibleName=List
-FileChooser.listViewActionLabel.textAndMnemonic=List
-FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
-FileChooser.detailsViewButtonAccessibleName=Details
-FileChooser.detailsViewActionLabel.textAndMnemonic=Details
-FileChooser.refreshActionLabel.textAndMnemonic=Refresh
-FileChooser.viewMenuLabel.textAndMnemonic=View
-FileChooser.fileNameHeader.textAndMnemonic=Name
-FileChooser.fileSizeHeader.textAndMnemonic=Size
-FileChooser.fileTypeHeader.textAndMnemonic=Type
-FileChooser.fileDateHeader.textAndMnemonic=Modified
-FileChooser.fileAttrHeader.textAndMnemonic=Attributes
+# This properties file is used to create a PropertyResourceBundle
+# It contains Locale specific strings used be the Synth Look and Feel.
+# Currently, the following components need this for support:
+#
+#    FileChooser
+#
+# When this file is read in, the strings are put into the
+# defaults table.  This is an implementation detail of the current
+# workings of Swing.  DO NOT DEPEND ON THIS.
+# This may change in future versions of Swing as we improve localization
+# support.
+#
+# Refer to the note in basic.properties for a description as to what
+# the mnemonics correspond to and how to calculate them.
+#
+# @author Steve Wilson
+
+
+############ FILE CHOOSER STRINGS #############
+
+FileChooser.lookInLabel.textAndMnemonic=Look &In:
+FileChooser.saveInLabel.textAndMnemonic=Save In:
+FileChooser.fileNameLabel.textAndMnemonic=File &Name:
+FileChooser.folderNameLabel.textAndMnemonic=Folder &Name:
+FileChooser.filesOfTypeLabel.textAndMnemonic=Files of &Type:
+FileChooser.upFolderToolTip.textAndMnemonic=Up One Level
+FileChooser.upFolderAccessibleName=Up
+FileChooser.homeFolderToolTip.textAndMnemonic=Home
+FileChooser.homeFolderAccessibleName=Home
+FileChooser.newFolderToolTip.textAndMnemonic=Create New Folder
+FileChooser.newFolderAccessibleName=New Folder
+FileChooser.newFolderActionLabel.textAndMnemonic=New Folder
+FileChooser.listViewButtonToolTip.textAndMnemonic=List
+FileChooser.listViewButtonAccessibleName=List
+FileChooser.listViewActionLabel.textAndMnemonic=List
+FileChooser.detailsViewButtonToolTip.textAndMnemonic=Details
+FileChooser.detailsViewButtonAccessibleName=Details
+FileChooser.detailsViewActionLabel.textAndMnemonic=Details
+FileChooser.refreshActionLabel.textAndMnemonic=Refresh
+FileChooser.viewMenuLabel.textAndMnemonic=View
+FileChooser.fileNameHeader.textAndMnemonic=Name
+FileChooser.fileSizeHeader.textAndMnemonic=Size
+FileChooser.fileTypeHeader.textAndMnemonic=Type
+FileChooser.fileDateHeader.textAndMnemonic=Modified
+FileChooser.fileAttrHeader.textAndMnemonic=Attributes
--- a/jdk/src/share/classes/com/sun/tools/script/shell/init.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/com/sun/tools/script/shell/init.js	Tue Aug 06 16:54:56 2013 -0700
@@ -332,7 +332,7 @@
  * @param str input from which script is loaded and evaluated
  */
 if (typeof(load) == 'undefined') {
-    var load = function(str) {
+    this.load = function(str) {
         var stream = inStream(str);
         var bstream = new BufferedInputStream(stream);
         var reader = new BufferedReader(new InputStreamReader(bstream));
@@ -712,7 +712,7 @@
      * @param exitCode integer code returned to OS shell.
      * optional, defaults to 0
      */
-    var exit = function (code) {
+    this.exit = function (code) {
         if (code) {
             java.lang.System.exit(code + 0);
         } else {
@@ -725,7 +725,7 @@
     /**
      * synonym for exit
      */
-    var quit = function (code) {
+    this.quit = function (code) {
         exit(code);
     }
 }
@@ -881,7 +881,7 @@
      * @param format string to format the rest of the print items
      * @param args variadic argument list
      */
-    var printf = function (format, args/*, more args*/) {  
+    this.printf = function (format, args/*, more args*/) {  
         var array = java.lang.reflect.Array.newInstance(java.lang.Object, 
                     arguments.length - 1);
         for (var i = 0; i < array.length; i++) {
@@ -921,25 +921,7 @@
 }
 
 if (typeof(println) == 'undefined') {
-    var print = function(str, newline) {
-        if (typeof(str) == 'undefined') {
-            str = 'undefined';
-        } else if (str == null) {
-            str = 'null';
-        }
-
-        if (!(out instanceof java.io.PrintWriter)) {
-            out = new java.io.PrintWriter(out);
-        }
+    // just synonym to print
+    this.println = print;
+}
 
-        out.print(String(str));
-        if (newline) {
-            out.print('\n');
-        }
-        out.flush();
-    }
-
-    var println = function(str) {
-        print(str, true);
-    };
-}
--- a/jdk/src/share/classes/java/awt/AWTException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/awt/AWTException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 
 
 /**
- * Signals that an Absract Window Toolkit exception has occurred.
+ * Signals that an Abstract Window Toolkit exception has occurred.
  *
  * @author      Arthur van Hoff
  */
--- a/jdk/src/share/classes/java/io/DataInput.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/io/DataInput.java	Tue Aug 06 16:54:56 2013 -0700
@@ -48,132 +48,87 @@
  * may be thrown if the input stream has been
  * closed.
  *
- * <h4><a name="modified-utf-8">Modified UTF-8</a></h4>
+ * <h3><a name="modified-utf-8">Modified UTF-8</a></h3>
  * <p>
  * Implementations of the DataInput and DataOutput interfaces represent
  * Unicode strings in a format that is a slight modification of UTF-8.
  * (For information regarding the standard UTF-8 format, see section
  * <i>3.9 Unicode Encoding Forms</i> of <i>The Unicode Standard, Version
  * 4.0</i>).
- * Note that in the following tables, the most significant bit appears in the
+ * Note that in the following table, the most significant bit appears in the
  * far left-hand column.
- * <p>
- * All characters in the range {@code '\u005Cu0001'} to
- * {@code '\u005Cu007F'} are represented by a single byte:
  *
  * <blockquote>
- *   <table border="1" cellspacing="0" cellpadding="8" width="50%"
+ *   <table border="1" cellspacing="0" cellpadding="8"
  *          summary="Bit values and bytes">
  *     <tr>
+ *       <th colspan="9"><span style="font-weight:normal">
+ *         All characters in the range {@code '\u005Cu0001'} to
+ *         {@code '\u005Cu007F'} are represented by a single byte:</span></th>
+ *     </tr>
+ *     <tr>
  *       <td></td>
- *       <th id="bit_a">Bit Values</th>
+ *       <th colspan="8" id="bit_a">Bit Values</th>
  *     </tr>
  *     <tr>
  *       <th id="byte1_a">Byte 1</th>
- *       <td>
- *         <table border="1" cellspacing="0" width="100%">
- *           <tr>
- *             <td width="12%"><center>0</center>
- *             <td colspan="7"><center>bits 6-0</center>
- *           </tr>
- *         </table>
- *       </td>
+ *       <td><center>0</center>
+ *       <td colspan="7"><center>bits 6-0</center>
  *     </tr>
- *   </table>
- * </blockquote>
- *
- * <p>
- * The null character {@code '\u005Cu0000'} and characters in the
- * range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are
- * represented by a pair of bytes:
- *
- * <blockquote>
- *   <table border="1" cellspacing="0" cellpadding="8" width="50%"
- *          summary="Bit values and bytes">
+ *     <tr>
+ *       <th colspan="9"><span style="font-weight:normal">
+ *         The null character {@code '\u005Cu0000'} and characters
+ *         in the range {@code '\u005Cu0080'} to {@code '\u005Cu07FF'} are
+ *         represented by a pair of bytes:</span></th>
+ *     </tr>
  *     <tr>
  *       <td></td>
- *       <th id="bit_b">Bit Values</th>
+ *       <th colspan="8" id="bit_b">Bit Values</th>
  *     </tr>
  *     <tr>
  *       <th id="byte1_b">Byte 1</th>
- *       <td>
- *         <table border="1" cellspacing="0" width="100%">
- *           <tr>
- *             <td width="12%"><center>1</center>
- *             <td width="13%"><center>1</center>
- *             <td width="12%"><center>0</center>
- *             <td colspan="5"><center>bits 10-6</center>
- *           </tr>
- *         </table>
- *       </td>
+ *       <td><center>1</center>
+ *       <td><center>1</center>
+ *       <td><center>0</center>
+ *       <td colspan="5"><center>bits 10-6</center>
  *     </tr>
  *     <tr>
  *       <th id="byte2_a">Byte 2</th>
- *       <td>
- *         <table border="1" cellspacing="0" width="100%">
- *           <tr>
- *             <td width="12%"><center>1</center>
- *             <td width="13%"><center>0</center>
- *             <td colspan="6"><center>bits 5-0</center>
- *           </tr>
- *         </table>
- *       </td>
+ *       <td><center>1</center>
+ *       <td><center>0</center>
+ *       <td colspan="6"><center>bits 5-0</center>
  *     </tr>
- *   </table>
- *  </blockquote>
- *
- * <br>
- * {@code char} values in the range {@code '\u005Cu0800'} to
- * {@code '\u005CuFFFF'} are represented by three bytes:
- *
- * <blockquote>
- *   <table border="1" cellspacing="0" cellpadding="8" width="50%"
- *          summary="Bit values and bytes">
+ *     <tr>
+ *       <th colspan="9"><span style="font-weight:normal">
+ *         {@code char} values in the range {@code '\u005Cu0800'}
+ *         to {@code '\u005CuFFFF'} are represented by three bytes:</span></th>
+ *     </tr>
  *     <tr>
  *       <td></td>
- *       <th id="bit_c">Bit Values</th>
+ *       <th colspan="8"id="bit_c">Bit Values</th>
  *     </tr>
  *     <tr>
  *       <th id="byte1_c">Byte 1</th>
- *       <td>
- *         <table border="1" cellspacing="0" width="100%">
- *           <tr>
- *             <td width="12%"><center>1</center>
- *             <td width="13%"><center>1</center>
- *             <td width="12%"><center>1</center>
- *             <td width="13%"><center>0</center>
- *             <td colspan="4"><center>bits 15-12</center>
- *           </tr>
- *         </table>
- *       </td>
+ *       <td><center>1</center>
+ *       <td><center>1</center>
+ *       <td><center>1</center>
+ *       <td><center>0</center>
+ *       <td colspan="4"><center>bits 15-12</center>
  *     </tr>
  *     <tr>
  *       <th id="byte2_b">Byte 2</th>
- *       <td>
- *         <table border="1" cellspacing="0" width="100%">
- *           <tr>
- *             <td width="12%"><center>1</center>
- *             <td width="13%"><center>0</center>
- *             <td colspan="6"><center>bits 11-6</center>
- *           </tr>
- *         </table>
- *       </td>
+ *       <td><center>1</center>
+ *       <td><center>0</center>
+ *       <td colspan="6"><center>bits 11-6</center>
  *     </tr>
  *     <tr>
  *       <th id="byte3">Byte 3</th>
- *       <td>
- *         <table border="1" cellspacing="0" width="100%">
- *           <tr>
- *             <td width="12%"><center>1</center>
- *             <td width="13%"><center>0</center>
- *             <td colspan="6"><center>bits 5-0</center>
- *           </tr>
- *         </table>
- *       </td>
+ *       <td><center>1</center>
+ *       <td><center>0</center>
+ *       <td colspan="6"><center>bits 5-0</center>
  *     </tr>
  *   </table>
- *  </blockquote>
- *
+ * </blockquote>
  * <p>
  * The differences between this format and the
  * standard UTF-8 format are the following:
--- a/jdk/src/share/classes/java/io/File.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/io/File.java	Tue Aug 06 16:54:56 2013 -0700
@@ -129,7 +129,7 @@
  * created, the abstract pathname represented by a <code>File</code> object
  * will never change.
  *
- * <h4>Interoperability with {@code java.nio.file} package</h4>
+ * <h3>Interoperability with {@code java.nio.file} package</h3>
  *
  * <p> The <a href="../../java/nio/file/package-summary.html">{@code java.nio.file}</a>
  * package defines interfaces and classes for the Java virtual machine to access
--- a/jdk/src/share/classes/java/io/ObjectInputStream.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/io/ObjectInputStream.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -313,6 +313,7 @@
      * @throws  SecurityException if a security manager exists and its
      *          <code>checkPermission</code> method denies enabling
      *          subclassing.
+     * @throws  IOException if an I/O error occurs while creating this stream
      * @see SecurityManager#checkPermission
      * @see java.io.SerializablePermission
      */
--- a/jdk/src/share/classes/java/io/ObjectOutputStream.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/io/ObjectOutputStream.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -265,6 +265,7 @@
      * @throws  SecurityException if a security manager exists and its
      *          <code>checkPermission</code> method denies enabling
      *          subclassing.
+     * @throws  IOException if an I/O error occurs while creating this stream
      * @see SecurityManager#checkPermission
      * @see java.io.SerializablePermission
      */
--- a/jdk/src/share/classes/java/io/ObjectStreamField.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/io/ObjectStreamField.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -240,6 +240,8 @@
      * Returns boolean value indicating whether or not the serializable field
      * represented by this ObjectStreamField instance is unshared.
      *
+     * @return {@code true} if this field is unshared
+     *
      * @since 1.4
      */
     public boolean isUnshared() {
--- a/jdk/src/share/classes/java/io/RandomAccessFile.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/io/RandomAccessFile.java	Tue Aug 06 16:54:56 2013 -0700
@@ -128,7 +128,7 @@
      * meanings are:
      *
      * <table summary="Access mode permitted values and meanings">
-     * <tr><th><p align="left">Value</p></th><th><p align="left">Meaning</p></th></tr>
+     * <tr><th align="left">Value</th><th align="left">Meaning</th></tr>
      * <tr><td valign="top"><tt>"r"</tt></td>
      *     <td> Open for reading only.  Invoking any of the <tt>write</tt>
      *     methods of the resulting object will cause an {@link
--- a/jdk/src/share/classes/java/lang/Class.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/Class.java	Tue Aug 06 16:54:56 2013 -0700
@@ -157,10 +157,10 @@
      *
      * The string is formatted as a list of type modifiers, if any,
      * followed by the kind of type (empty string for primitive types
-     * and {@code class}, {@code enum}, {@code interface}, or {@code
-     * &#64;interface}, as appropriate), followed by the type's name,
-     * followed by an angle-bracketed comma-separated list of the
-     * type's type parameters, if any.
+     * and {@code class}, {@code enum}, {@code interface}, or
+     * <code>&#64;</code>{@code interface}, as appropriate), followed
+     * by the type's name, followed by an angle-bracketed
+     * comma-separated list of the type's type parameters, if any.
      *
      * A space is used to separate modifiers from one another and to
      * separate any modifiers from the kind of type. The modifiers
--- a/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/invoke/LambdaConversionException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -29,6 +29,8 @@
  * LambdaConversionException
  */
 public class LambdaConversionException extends Exception {
+    private static final long serialVersionUID = 292L + 8L;
+
     /**
      * Constructs a {@code LambdaConversionException}.
      */
--- a/jdk/src/share/classes/java/lang/ref/FinalReference.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/ref/FinalReference.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,12 @@
 
 package java.lang.ref;
 
-
-/* Final references, used to implement finalization */
-
+/**
+ * Final references, used to implement finalization
+ */
 class FinalReference<T> extends Reference<T> {
 
     public FinalReference(T referent, ReferenceQueue<? super T> q) {
         super(referent, q);
     }
-
 }
--- a/jdk/src/share/classes/java/lang/ref/Finalizer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/ref/Finalizer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,16 +29,16 @@
 import java.security.AccessController;
 
 
-final class Finalizer extends FinalReference { /* Package-private; must be in
-                                                  same package as the Reference
-                                                  class */
+final class Finalizer extends FinalReference<Object> { /* Package-private; must be in
+                                                          same package as the Reference
+                                                          class */
 
     /* A native method that invokes an arbitrary object's finalize method is
        required since the finalize method is protected
      */
     static native void invokeFinalizeMethod(Object o) throws Throwable;
 
-    private static ReferenceQueue queue = new ReferenceQueue();
+    private static ReferenceQueue<Object> queue = new ReferenceQueue<>();
     private static Finalizer unfinalized = null;
     private static final Object lock = new Object();
 
--- a/jdk/src/share/classes/java/lang/ref/Reference.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/ref/Reference.java	Tue Aug 06 16:54:56 2013 -0700
@@ -96,6 +96,7 @@
      *    Enqueued:   next reference in queue (or this if last)
      *    Inactive:   this
      */
+    @SuppressWarnings("rawtypes")
     Reference next;
 
     /* When active:   next element in a discovered reference list maintained by GC (or this if last)
@@ -119,7 +120,7 @@
      * them.  This list is protected by the above lock object. The
      * list uses the discovered field to link its elements.
      */
-    private static Reference pending = null;
+    private static Reference<Object> pending = null;
 
     /* High-priority thread to enqueue pending References
      */
@@ -131,7 +132,7 @@
 
         public void run() {
             for (;;) {
-                Reference r;
+                Reference<Object> r;
                 synchronized (lock) {
                     if (pending != null) {
                         r = pending;
@@ -166,7 +167,7 @@
                     continue;
                 }
 
-                ReferenceQueue q = r.queue;
+                ReferenceQueue<Object> q = r.queue;
                 if (q != ReferenceQueue.NULL) q.enqueue(r);
             }
         }
--- a/jdk/src/share/classes/java/lang/ref/ReferenceQueue.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/ref/ReferenceQueue.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,14 +40,14 @@
      */
     public ReferenceQueue() { }
 
-    private static class Null extends ReferenceQueue {
-        boolean enqueue(Reference r) {
+    private static class Null<S> extends ReferenceQueue<S> {
+        boolean enqueue(Reference<? extends S> r) {
             return false;
         }
     }
 
-    static ReferenceQueue NULL = new Null();
-    static ReferenceQueue ENQUEUED = new Null();
+    static ReferenceQueue<Object> NULL = new Null<>();
+    static ReferenceQueue<Object> ENQUEUED = new Null<>();
 
     static private class Lock { };
     private Lock lock = new Lock();
@@ -58,7 +58,7 @@
         synchronized (lock) {
             // Check that since getting the lock this reference hasn't already been
             // enqueued (and even then removed)
-            ReferenceQueue queue = r.queue;
+            ReferenceQueue<?> queue = r.queue;
             if ((queue == NULL) || (queue == ENQUEUED)) {
                 return false;
             }
@@ -75,10 +75,13 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     private Reference<? extends T> reallyPoll() {       /* Must hold lock */
         Reference<? extends T> r = head;
         if (r != null) {
-            head = (r.next == r) ? null : r.next;
+            head = (r.next == r) ?
+                null :
+                r.next; // Unchecked due to the next field having a raw type in Reference
             r.queue = NULL;
             r.next = r;
             queueLength--;
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -162,7 +162,7 @@
 
     /**
      * Returns the name of the parameter.  If the parameter's name is
-     * {@linkplain isNamePresent() present}, then this method returns
+     * {@linkplain #isNamePresent() present}, then this method returns
      * the name provided by the class file. Otherwise, this method
      * synthesizes a name of the form argN, where N is the index of
      * the parameter in the descriptor of the method which declares
--- a/jdk/src/share/classes/java/math/BigInteger.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/math/BigInteger.java	Tue Aug 06 16:54:56 2013 -0700
@@ -33,7 +33,6 @@
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.ObjectStreamField;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Random;
 import sun.misc.DoubleConsts;
@@ -101,6 +100,7 @@
  * @author  Josh Bloch
  * @author  Michael McCloskey
  * @author  Alan Eliasen
+ * @author  Timothy Buktu
  * @since JDK1.1
  */
 
@@ -215,6 +215,14 @@
     private static final int TOOM_COOK_SQUARE_THRESHOLD = 140;
 
     /**
+     * The threshold value for using Burnikel-Ziegler division.  If the number
+     * of ints in the number are larger than this value,
+     * Burnikel-Ziegler division will be used.   This value is found
+     * experimentally to work well.
+     */
+    static final int BURNIKEL_ZIEGLER_THRESHOLD = 50;
+
+    /**
      * The threshold value for using Schoenhage recursive base conversion. If
      * the number of ints in the number are larger than this value,
      * the Schoenhage algorithm will be used.  In practice, it appears that the
@@ -290,7 +298,7 @@
         if (signum < -1 || signum > 1)
             throw(new NumberFormatException("Invalid signum value"));
 
-        if (this.mag.length==0) {
+        if (this.mag.length == 0) {
             this.signum = 0;
         } else {
             if (signum == 0)
@@ -311,7 +319,7 @@
         if (signum < -1 || signum > 1)
             throw(new NumberFormatException("Invalid signum value"));
 
-        if (this.mag.length==0) {
+        if (this.mag.length == 0) {
             this.signum = 0;
         } else {
             if (signum == 0)
@@ -364,8 +372,10 @@
 
         // Skip leading zeros and compute number of digits in magnitude
         while (cursor < len &&
-               Character.digit(val.charAt(cursor), radix) == 0)
+               Character.digit(val.charAt(cursor), radix) == 0) {
             cursor++;
+        }
+
         if (cursor == len) {
             signum = 0;
             mag = ZERO.mag;
@@ -455,7 +465,7 @@
         if (result == -1)
             throw new NumberFormatException(new String(source));
 
-        for (int index = start; index<end; index++) {
+        for (int index = start; index < end; index++) {
             int nextVal = Character.digit(source[index], 10);
             if (nextVal == -1)
                 throw new NumberFormatException(new String(source));
@@ -622,9 +632,9 @@
         int highBit = 1 << ((bitLength+31) & 0x1f);  // High bit of high int
         int highMask = (highBit << 1) - 1;  // Bits to keep in high int
 
-        while(true) {
+        while (true) {
             // Construct a candidate
-            for (int i=0; i<magLen; i++)
+            for (int i=0; i < magLen; i++)
                 temp[i] = rnd.nextInt();
             temp[0] = (temp[0] & highMask) | highBit;  // Ensure exact length
             if (bitLength > 2)
@@ -710,7 +720,7 @@
             if (!result.testBit(0))
                 result = result.add(ONE);
 
-            while(true) {
+            while (true) {
                 // Do cheap "pre-test" if applicable
                 if (result.bitLength() > 6) {
                     long r = result.remainder(SMALL_PRIME_PRODUCT).longValue();
@@ -741,7 +751,7 @@
         // Looking for the next large prime
         int searchLen = (result.bitLength() / 20) * 64;
 
-        while(true) {
+        while (true) {
            BitSieve searchSieve = new BitSieve(result, searchLen);
            BigInteger candidate = searchSieve.retrieve(result,
                                                  DEFAULT_PRIME_CERTAINTY, null);
@@ -808,7 +818,7 @@
         int d = 5;
         while (jacobiSymbol(d, this) != -1) {
             // 5, -7, 9, -11, ...
-            d = (d<0) ? Math.abs(d)+2 : -(d+2);
+            d = (d < 0) ? Math.abs(d)+2 : -(d+2);
         }
 
         // Step 2
@@ -881,7 +891,7 @@
         BigInteger u = ONE; BigInteger u2;
         BigInteger v = ONE; BigInteger v2;
 
-        for (int i=k.bitLength()-2; i>=0; i--) {
+        for (int i=k.bitLength()-2; i >= 0; i--) {
             u2 = u.multiply(v).mod(n);
 
             v2 = v.square().add(d.multiply(u.square())).mod(n);
@@ -937,7 +947,7 @@
         if (rnd == null) {
             rnd = getSecureRandom();
         }
-        for (int i=0; i<iterations; i++) {
+        for (int i=0; i < iterations; i++) {
             // Generate a uniform random on (1, this)
             BigInteger b;
             do {
@@ -946,8 +956,8 @@
 
             int j = 0;
             BigInteger z = b.modPow(m, this);
-            while(!((j==0 && z.equals(ONE)) || z.equals(thisMinusOne))) {
-                if (j>0 && z.equals(ONE) || ++j==a)
+            while (!((j == 0 && z.equals(ONE)) || z.equals(thisMinusOne))) {
+                if (j > 0 && z.equals(ONE) || ++j == a)
                     return false;
                 z = z.modPow(TWO, this);
             }
@@ -961,7 +971,7 @@
      * arguments are correct, and it doesn't copy the magnitude array.
      */
     BigInteger(int[] magnitude, int signum) {
-        this.signum = (magnitude.length==0 ? 0 : signum);
+        this.signum = (magnitude.length == 0 ? 0 : signum);
         this.mag = magnitude;
     }
 
@@ -970,7 +980,7 @@
      * arguments are correct.
      */
     private BigInteger(byte[] magnitude, int signum) {
-        this.signum = (magnitude.length==0 ? 0 : signum);
+        this.signum = (magnitude.length == 0 ? 0 : signum);
         this.mag = stripLeadingZeroBytes(magnitude);
     }
 
@@ -1009,7 +1019,7 @@
         }
 
         int highWord = (int)(val >>> 32);
-        if (highWord==0) {
+        if (highWord == 0) {
             mag = new int[1];
             mag[0] = (int)val;
         } else {
@@ -1025,7 +1035,7 @@
      * BigInteger will reference the input array if feasible).
      */
     private static BigInteger valueOf(int val[]) {
-        return (val[0]>0 ? new BigInteger(val, 1) : new BigInteger(val));
+        return (val[0] > 0 ? new BigInteger(val, 1) : new BigInteger(val));
     }
 
     // Constants
@@ -1066,8 +1076,7 @@
         powerCache = new BigInteger[Character.MAX_RADIX+1][];
         logCache = new double[Character.MAX_RADIX+1];
 
-        for (int i=Character.MIN_RADIX; i<=Character.MAX_RADIX; i++)
-        {
+        for (int i=Character.MIN_RADIX; i <= Character.MAX_RADIX; i++) {
             powerCache[i] = new BigInteger[] { BigInteger.valueOf(i) };
             logCache[i] = Math.log(i);
         }
@@ -1161,7 +1170,7 @@
         int xIndex = x.length;
         int[] result;
         int highWord = (int)(val >>> 32);
-        if (highWord==0) {
+        if (highWord == 0) {
             result = new int[xIndex];
             sum = (x[--xIndex] & LONG_MASK) + val;
             result[xIndex] = (int)sum;
@@ -1214,12 +1223,12 @@
         int yIndex = y.length;
         int result[] = new int[xIndex];
         long sum = 0;
-        if(yIndex==1) {
+        if (yIndex == 1) {
             sum = (x[--xIndex] & LONG_MASK) + (y[0] & LONG_MASK) ;
             result[xIndex] = (int)sum;
         } else {
             // Add common parts of both numbers
-            while(yIndex > 0) {
+            while (yIndex > 0) {
                 sum = (x[--xIndex] & LONG_MASK) +
                       (y[--yIndex] & LONG_MASK) + (sum >>> 32);
                 result[xIndex] = (int)sum;
@@ -1246,24 +1255,24 @@
 
     private static int[] subtract(long val, int[] little) {
         int highWord = (int)(val >>> 32);
-        if (highWord==0) {
+        if (highWord == 0) {
             int result[] = new int[1];
             result[0] = (int)(val - (little[0] & LONG_MASK));
             return result;
         } else {
             int result[] = new int[2];
-            if(little.length==1) {
+            if (little.length == 1) {
                 long difference = ((int)val & LONG_MASK) - (little[0] & LONG_MASK);
                 result[1] = (int)difference;
                 // Subtract remainder of longer number while borrow propagates
                 boolean borrow = (difference >> 32 != 0);
-                if(borrow) {
+                if (borrow) {
                     result[0] = highWord - 1;
                 } else {        // Copy remainder of longer number
                     result[0] = highWord;
                 }
                 return result;
-            } else { // little.length==2
+            } else { // little.length == 2
                 long difference = ((int)val & LONG_MASK) - (little[1] & LONG_MASK);
                 result[1] = (int)difference;
                 difference = (highWord & LONG_MASK) - (little[0] & LONG_MASK) + (difference >> 32);
@@ -1286,7 +1295,7 @@
         int result[] = new int[bigIndex];
         long difference = 0;
 
-        if (highWord==0) {
+        if (highWord == 0) {
             difference = (big[--bigIndex] & LONG_MASK) - val;
             result[bigIndex] = (int)difference;
         } else {
@@ -1296,7 +1305,6 @@
             result[bigIndex] = (int)difference;
         }
 
-
         // Subtract remainder of longer number while borrow propagates
         boolean borrow = (difference >> 32 != 0);
         while (bigIndex > 0 && borrow)
@@ -1345,7 +1353,7 @@
         long difference = 0;
 
         // Subtract common parts of both numbers
-        while(littleIndex > 0) {
+        while (littleIndex > 0) {
             difference = (big[--bigIndex] & LONG_MASK) -
                          (little[--littleIndex] & LONG_MASK) +
                          (difference >> 32);
@@ -1377,29 +1385,29 @@
         int xlen = mag.length;
         int ylen = val.mag.length;
 
-        if ((xlen < KARATSUBA_THRESHOLD) || (ylen < KARATSUBA_THRESHOLD))
-        {
+        if ((xlen < KARATSUBA_THRESHOLD) || (ylen < KARATSUBA_THRESHOLD)) {
             int resultSign = signum == val.signum ? 1 : -1;
             if (val.mag.length == 1) {
                 return multiplyByInt(mag,val.mag[0], resultSign);
             }
-            if(mag.length == 1) {
+            if (mag.length == 1) {
                 return multiplyByInt(val.mag,mag[0], resultSign);
             }
             int[] result = multiplyToLen(mag, xlen,
                                          val.mag, ylen, null);
             result = trustedStripLeadingZeroInts(result);
             return new BigInteger(result, resultSign);
+        } else {
+            if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD)) {
+                return multiplyKaratsuba(this, val);
+            } else {
+                return multiplyToomCook3(this, val);
+            }
         }
-        else
-            if ((xlen < TOOM_COOK_THRESHOLD) && (ylen < TOOM_COOK_THRESHOLD))
-                return multiplyKaratsuba(this, val);
-            else
-                return multiplyToomCook3(this, val);
     }
 
     private static BigInteger multiplyByInt(int[] x, int y, int sign) {
-        if(Integer.bitCount(y)==1) {
+        if (Integer.bitCount(y) == 1) {
             return new BigInteger(shiftLeft(x,Integer.numberOfTrailingZeros(y)), sign);
         }
         int xlen = x.length;
@@ -1474,7 +1482,7 @@
             z = new int[xlen+ylen];
 
         long carry = 0;
-        for (int j=ystart, k=ystart+1+xstart; j>=0; j--, k--) {
+        for (int j=ystart, k=ystart+1+xstart; j >= 0; j--, k--) {
             long product = (y[j] & LONG_MASK) *
                            (x[xstart] & LONG_MASK) + carry;
             z[k] = (int)product;
@@ -1484,7 +1492,7 @@
 
         for (int i = xstart-1; i >= 0; i--) {
             carry = 0;
-            for (int j=ystart, k=ystart+1+i; j>=0; j--, k--) {
+            for (int j=ystart, k=ystart+1+i; j >= 0; j--, k--) {
                 long product = (y[j] & LONG_MASK) *
                                (x[i] & LONG_MASK) +
                                (z[k] & LONG_MASK) + carry;
@@ -1511,8 +1519,7 @@
      *
      * See:  http://en.wikipedia.org/wiki/Karatsuba_algorithm
      */
-    private static BigInteger multiplyKaratsuba(BigInteger x, BigInteger y)
-    {
+    private static BigInteger multiplyKaratsuba(BigInteger x, BigInteger y) {
         int xlen = x.mag.length;
         int ylen = y.mag.length;
 
@@ -1535,10 +1542,11 @@
         // result = p1 * 2^(32*2*half) + (p3 - p1 - p2) * 2^(32*half) + p2
         BigInteger result = p1.shiftLeft(32*half).add(p3.subtract(p1).subtract(p2)).shiftLeft(32*half).add(p2);
 
-        if (x.signum != y.signum)
+        if (x.signum != y.signum) {
             return result.negate();
-        else
+        } else {
             return result;
+        }
     }
 
     /**
@@ -1569,8 +1577,7 @@
      * LNCS #4547. Springer, Madrid, Spain, June 21-22, 2007.
      *
      */
-    private static BigInteger multiplyToomCook3(BigInteger a, BigInteger b)
-    {
+    private static BigInteger multiplyToomCook3(BigInteger a, BigInteger b) {
         int alen = a.mag.length;
         int blen = b.mag.length;
 
@@ -1605,12 +1612,12 @@
              db1.add(b2).shiftLeft(1).subtract(b0));
         vinf = a2.multiply(b2);
 
-        /* The algorithm requires two divisions by 2 and one by 3.
-           All divisions are known to be exact, that is, they do not produce
-           remainders, and all results are positive.  The divisions by 2 are
-           implemented as right shifts which are relatively efficient, leaving
-           only an exact division by 3, which is done by a specialized
-           linear-time algorithm. */
+        // The algorithm requires two divisions by 2 and one by 3.
+        // All divisions are known to be exact, that is, they do not produce
+        // remainders, and all results are positive.  The divisions by 2 are
+        // implemented as right shifts which are relatively efficient, leaving
+        // only an exact division by 3, which is done by a specialized
+        // linear-time algorithm.
         t2 = v2.subtract(vm1).exactDivideBy3();
         tm1 = v1.subtract(vm1).shiftRight(1);
         t1 = v1.subtract(v0);
@@ -1624,10 +1631,11 @@
 
         BigInteger result = vinf.shiftLeft(ss).add(t2).shiftLeft(ss).add(t1).shiftLeft(ss).add(tm1).shiftLeft(ss).add(v0);
 
-        if (a.signum != b.signum)
+        if (a.signum != b.signum) {
             return result.negate();
-        else
+        } else {
             return result;
+        }
     }
 
 
@@ -1645,38 +1653,38 @@
      * numbers.
      */
     private BigInteger getToomSlice(int lowerSize, int upperSize, int slice,
-                                    int fullsize)
-    {
+                                    int fullsize) {
         int start, end, sliceSize, len, offset;
 
         len = mag.length;
         offset = fullsize - len;
 
-        if (slice == 0)
-        {
+        if (slice == 0) {
             start = 0 - offset;
             end = upperSize - 1 - offset;
-        }
-        else
-        {
+        } else {
             start = upperSize + (slice-1)*lowerSize - offset;
             end = start + lowerSize - 1;
         }
 
-        if (start < 0)
+        if (start < 0) {
             start = 0;
-        if (end < 0)
+        }
+        if (end < 0) {
            return ZERO;
+        }
 
         sliceSize = (end-start) + 1;
 
-        if (sliceSize <= 0)
+        if (sliceSize <= 0) {
             return ZERO;
+        }
 
         // While performing Toom-Cook, all slices are positive and
         // the sign is adjusted when the final number is composed.
-        if (start==0 && sliceSize >= len)
+        if (start == 0 && sliceSize >= len) {
             return this.abs();
+        }
 
         int intSlice[] = new int[sliceSize];
         System.arraycopy(mag, start, intSlice, 0, sliceSize);
@@ -1692,20 +1700,19 @@
      * undefined.  Note that this is expected to be called with positive
      * arguments only.
      */
-    private BigInteger exactDivideBy3()
-    {
+    private BigInteger exactDivideBy3() {
         int len = mag.length;
         int[] result = new int[len];
         long x, w, q, borrow;
         borrow = 0L;
-        for (int i=len-1; i>=0; i--)
-        {
+        for (int i=len-1; i >= 0; i--) {
             x = (mag[i] & LONG_MASK);
             w = x - borrow;
-            if (borrow > x)       // Did we make the number go negative?
+            if (borrow > x) {      // Did we make the number go negative?
                 borrow = 1L;
-            else
+            } else {
                 borrow = 0L;
+            }
 
             // 0xAAAAAAAB is the modular inverse of 3 (mod 2^32).  Thus,
             // the effect of this is to divide by 3 (mod 2^32).
@@ -1715,8 +1722,7 @@
 
             // Now check the borrow. The second check can of course be
             // eliminated if the first fails.
-            if (q >= 0x55555556L)
-            {
+            if (q >= 0x55555556L) {
                 borrow++;
                 if (q >= 0xAAAAAAABL)
                     borrow++;
@@ -1733,8 +1739,9 @@
     private BigInteger getLower(int n) {
         int len = mag.length;
 
-        if (len <= n)
+        if (len <= n) {
             return this;
+        }
 
         int lowerInts[] = new int[n];
         System.arraycopy(mag, len-n, lowerInts, 0, n);
@@ -1750,8 +1757,9 @@
     private BigInteger getUpper(int n) {
         int len = mag.length;
 
-        if (len <= n)
+        if (len <= n) {
             return ZERO;
+        }
 
         int upperLen = len - n;
         int upperInts[] = new int[upperLen];
@@ -1768,20 +1776,21 @@
      * @return {@code this<sup>2</sup>}
      */
     private BigInteger square() {
-        if (signum == 0)
+        if (signum == 0) {
             return ZERO;
+        }
         int len = mag.length;
 
-        if (len < KARATSUBA_SQUARE_THRESHOLD)
-        {
+        if (len < KARATSUBA_SQUARE_THRESHOLD) {
             int[] z = squareToLen(mag, len, null);
             return new BigInteger(trustedStripLeadingZeroInts(z), 1);
+        } else {
+            if (len < TOOM_COOK_SQUARE_THRESHOLD) {
+                return squareKaratsuba();
+            } else {
+                return squareToomCook3();
+            }
         }
-        else
-            if (len < TOOM_COOK_SQUARE_THRESHOLD)
-                return squareKaratsuba();
-            else
-               return squareToomCook3();
     }
 
     /**
@@ -1829,7 +1838,7 @@
 
         // Store the squares, right shifted one bit (i.e., divided by 2)
         int lastProductLowWord = 0;
-        for (int j=0, i=0; j<len; j++) {
+        for (int j=0, i=0; j < len; j++) {
             long piece = (x[j] & LONG_MASK);
             long product = piece * piece;
             z[i++] = (lastProductLowWord << 31) | (int)(product >>> 33);
@@ -1838,7 +1847,7 @@
         }
 
         // Add in off-diagonal sums
-        for (int i=len, offset=1; i>0; i--, offset+=2) {
+        for (int i=len, offset=1; i > 0; i--, offset+=2) {
             int t = x[i-1];
             t = mulAdd(z, x, offset, i-1, t);
             addOne(z, offset-1, i, t);
@@ -1858,8 +1867,7 @@
      * has better asymptotic performance than the algorithm used in
      * squareToLen.
      */
-    private BigInteger squareKaratsuba()
-    {
+    private BigInteger squareKaratsuba() {
         int half = (mag.length+1) / 2;
 
         BigInteger xl = getLower(half);
@@ -1879,8 +1887,7 @@
      * that has better asymptotic performance than the algorithm used in
      * squareToLen or squareKaratsuba.
      */
-    private BigInteger squareToomCook3()
-    {
+    private BigInteger squareToomCook3() {
         int len = mag.length;
 
         // k is the size (in ints) of the lower-order slices.
@@ -1905,13 +1912,12 @@
         vinf = a2.square();
         v2 = da1.add(a2).shiftLeft(1).subtract(a0).square();
 
-        /* The algorithm requires two divisions by 2 and one by 3.
-           All divisions are known to be exact, that is, they do not produce
-           remainders, and all results are positive.  The divisions by 2 are
-           implemented as right shifts which are relatively efficient, leaving
-           only a division by 3.
-           The division by 3 is done by an optimized algorithm for this case.
-        */
+        // The algorithm requires two divisions by 2 and one by 3.
+        // All divisions are known to be exact, that is, they do not produce
+        // remainders, and all results are positive.  The divisions by 2 are
+        // implemented as right shifts which are relatively efficient, leaving
+        // only a division by 3.
+        // The division by 3 is done by an optimized algorithm for this case.
         t2 = v2.subtract(vm1).exactDivideBy3();
         tm1 = v1.subtract(vm1).shiftRight(1);
         t1 = v1.subtract(v0);
@@ -1936,11 +1942,28 @@
      * @throws ArithmeticException if {@code val} is zero.
      */
     public BigInteger divide(BigInteger val) {
+        if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
+                val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) {
+            return divideKnuth(val);
+        } else {
+            return divideBurnikelZiegler(val);
+        }
+    }
+
+    /**
+     * Returns a BigInteger whose value is {@code (this / val)} using an O(n^2) algorithm from Knuth.
+     *
+     * @param  val value by which this BigInteger is to be divided.
+     * @return {@code this / val}
+     * @throws ArithmeticException if {@code val} is zero.
+     * @see MutableBigInteger#divideKnuth(MutableBigInteger, MutableBigInteger, boolean)
+     */
+    private BigInteger divideKnuth(BigInteger val) {
         MutableBigInteger q = new MutableBigInteger(),
                           a = new MutableBigInteger(this.mag),
                           b = new MutableBigInteger(val.mag);
 
-        a.divide(b, q, false);
+        a.divideKnuth(b, q, false);
         return q.toBigInteger(this.signum * val.signum);
     }
 
@@ -1956,11 +1979,21 @@
      * @throws ArithmeticException if {@code val} is zero.
      */
     public BigInteger[] divideAndRemainder(BigInteger val) {
+        if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
+                val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) {
+            return divideAndRemainderKnuth(val);
+        } else {
+            return divideAndRemainderBurnikelZiegler(val);
+        }
+    }
+
+    /** Long division */
+    private BigInteger[] divideAndRemainderKnuth(BigInteger val) {
         BigInteger[] result = new BigInteger[2];
         MutableBigInteger q = new MutableBigInteger(),
                           a = new MutableBigInteger(this.mag),
                           b = new MutableBigInteger(val.mag);
-        MutableBigInteger r = a.divide(b, q);
+        MutableBigInteger r = a.divideKnuth(b, q);
         result[0] = q.toBigInteger(this.signum == val.signum ? 1 : -1);
         result[1] = r.toBigInteger(this.signum);
         return result;
@@ -1975,11 +2008,53 @@
      * @throws ArithmeticException if {@code val} is zero.
      */
     public BigInteger remainder(BigInteger val) {
+        if (mag.length < BURNIKEL_ZIEGLER_THRESHOLD ||
+                val.mag.length < BURNIKEL_ZIEGLER_THRESHOLD) {
+            return remainderKnuth(val);
+        } else {
+            return remainderBurnikelZiegler(val);
+        }
+    }
+
+    /** Long division */
+    private BigInteger remainderKnuth(BigInteger val) {
         MutableBigInteger q = new MutableBigInteger(),
                           a = new MutableBigInteger(this.mag),
                           b = new MutableBigInteger(val.mag);
 
-        return a.divide(b, q).toBigInteger(this.signum);
+        return a.divideKnuth(b, q).toBigInteger(this.signum);
+    }
+
+    /**
+     * Calculates {@code this / val} using the Burnikel-Ziegler algorithm.
+     * @param  val the divisor
+     * @return {@code this / val}
+     */
+    private BigInteger divideBurnikelZiegler(BigInteger val) {
+        return divideAndRemainderBurnikelZiegler(val)[0];
+    }
+
+    /**
+     * Calculates {@code this % val} using the Burnikel-Ziegler algorithm.
+     * @param val the divisor
+     * @return {@code this % val}
+     */
+    private BigInteger remainderBurnikelZiegler(BigInteger val) {
+        return divideAndRemainderBurnikelZiegler(val)[1];
+    }
+
+    /**
+     * Computes {@code this / val} and {@code this % val} using the
+     * Burnikel-Ziegler algorithm.
+     * @param val the divisor
+     * @return an array containing the quotient and remainder
+     */
+    private BigInteger[] divideAndRemainderBurnikelZiegler(BigInteger val) {
+        MutableBigInteger q = new MutableBigInteger();
+        MutableBigInteger r = new MutableBigInteger(this).divideAndRemainderBurnikelZiegler(new MutableBigInteger(val), q);
+        BigInteger qBigInt = q.isZero() ? ZERO : q.toBigInteger(signum*val.signum);
+        BigInteger rBigInt = r.isZero() ? ZERO : r.toBigInteger(signum);
+        return new BigInteger[] {qBigInt, rBigInt};
     }
 
     /**
@@ -1992,10 +2067,12 @@
      *         cause the operation to yield a non-integer value.)
      */
     public BigInteger pow(int exponent) {
-        if (exponent < 0)
+        if (exponent < 0) {
             throw new ArithmeticException("Negative exponent");
-        if (signum==0)
-            return (exponent==0 ? ONE : this);
+        }
+        if (signum == 0) {
+            return (exponent == 0 ? ONE : this);
+        }
 
         BigInteger partToSquare = this.abs();
 
@@ -2008,24 +2085,25 @@
         int remainingBits;
 
         // Factor the powers of two out quickly by shifting right, if needed.
-        if (powersOfTwo > 0)
-        {
+        if (powersOfTwo > 0) {
             partToSquare = partToSquare.shiftRight(powersOfTwo);
             remainingBits = partToSquare.bitLength();
-            if (remainingBits == 1)  // Nothing left but +/- 1?
-                if (signum<0 && (exponent&1)==1)
+            if (remainingBits == 1) {  // Nothing left but +/- 1?
+                if (signum < 0 && (exponent&1) == 1) {
                     return NEGATIVE_ONE.shiftLeft(powersOfTwo*exponent);
-                else
+                } else {
                     return ONE.shiftLeft(powersOfTwo*exponent);
-        }
-        else
-        {
+                }
+            }
+        } else {
             remainingBits = partToSquare.bitLength();
-            if (remainingBits == 1)  // Nothing left but +/- 1?
-                if (signum<0 && (exponent&1)==1)
+            if (remainingBits == 1) { // Nothing left but +/- 1?
+                if (signum < 0  && (exponent&1) == 1) {
                     return NEGATIVE_ONE;
-                else
+                } else {
                     return ONE;
+                }
+            }
         }
 
         // This is a quick way to approximate the size of the result,
@@ -2035,10 +2113,9 @@
 
         // Use slightly different algorithms for small and large operands.
         // See if the result will safely fit into a long. (Largest 2^63-1)
-        if (partToSquare.mag.length==1 && scaleFactor <= 62)
-        {
+        if (partToSquare.mag.length == 1 && scaleFactor <= 62) {
             // Small number algorithm.  Everything fits into a long.
-            int newSign = (signum<0 && (exponent&1)==1 ? -1 : 1);
+            int newSign = (signum <0  && (exponent&1) == 1 ? -1 : 1);
             long result = 1;
             long baseToPow2 = partToSquare.mag[0] & LONG_MASK;
 
@@ -2046,27 +2123,28 @@
 
             // Perform exponentiation using repeated squaring trick
             while (workingExponent != 0) {
-                if ((workingExponent & 1)==1)
+                if ((workingExponent & 1) == 1) {
                     result = result * baseToPow2;
-
-                if ((workingExponent >>>= 1) != 0)
+                }
+
+                if ((workingExponent >>>= 1) != 0) {
                     baseToPow2 = baseToPow2 * baseToPow2;
+                }
             }
 
             // Multiply back the powers of two (quickly, by shifting left)
-            if (powersOfTwo > 0)
-            {
+            if (powersOfTwo > 0) {
                 int bitsToShift = powersOfTwo*exponent;
-                if (bitsToShift + scaleFactor <= 62) // Fits in long?
+                if (bitsToShift + scaleFactor <= 62) { // Fits in long?
                     return valueOf((result << bitsToShift) * newSign);
-                else
+                } else {
                     return valueOf(result*newSign).shiftLeft(bitsToShift);
+                }
             }
-            else
+            else {
                 return valueOf(result*newSign);
-        }
-        else
-        {
+            }
+        } else {
             // Large number algorithm.  This is basically identical to
             // the algorithm above, but calls multiply() and square()
             // which may use more efficient algorithms for large numbers.
@@ -2075,28 +2153,32 @@
             int workingExponent = exponent;
             // Perform exponentiation using repeated squaring trick
             while (workingExponent != 0) {
-                if ((workingExponent & 1)==1)
+                if ((workingExponent & 1) == 1) {
                     answer = answer.multiply(partToSquare);
-
-                if ((workingExponent >>>= 1) != 0)
+                }
+
+                if ((workingExponent >>>= 1) != 0) {
                     partToSquare = partToSquare.square();
+                }
             }
             // Multiply back the (exponentiated) powers of two (quickly,
             // by shifting left)
-            if (powersOfTwo > 0)
+            if (powersOfTwo > 0) {
                 answer = answer.shiftLeft(powersOfTwo*exponent);
-
-            if (signum<0 && (exponent&1)==1)
+            }
+
+            if (signum < 0 && (exponent&1) == 1) {
                 return answer.negate();
-            else
+            } else {
                 return answer;
+            }
         }
     }
 
     /**
      * Returns a BigInteger whose value is the greatest common divisor of
      * {@code abs(this)} and {@code abs(val)}.  Returns 0 if
-     * {@code this==0 && val==0}.
+     * {@code this == 0 && val == 0}.
      *
      * @param  val value with which the GCD is to be computed.
      * @return {@code GCD(abs(this), abs(val))}
@@ -2153,7 +2235,7 @@
     // shifts a up to len right n bits assumes no leading zeros, 0<n<32
     static void primitiveRightShift(int[] a, int len, int n) {
         int n2 = 32 - n;
-        for (int i=len-1, c=a[i]; i>0; i--) {
+        for (int i=len-1, c=a[i]; i > 0; i--) {
             int b = c;
             c = a[i-1];
             a[i] = (c << n2) | (b >>> n);
@@ -2167,7 +2249,7 @@
             return;
 
         int n2 = 32 - n;
-        for (int i=0, c=a[i], m=i+len-1; i<m; i++) {
+        for (int i=0, c=a[i], m=i+len-1; i < m; i++) {
             int b = c;
             c = a[i+1];
             a[i] = (b << n) | (c >>> n2);
@@ -2378,7 +2460,7 @@
             return this;
 
         // Special case for base of zero
-        if (signum==0)
+        if (signum == 0)
             return ZERO;
 
         int[] base = mag.clone();
@@ -2401,7 +2483,7 @@
 
         // Allocate table for precomputed odd powers of base in Montgomery form
         int[][] table = new int[tblmask][];
-        for (int i=0; i<tblmask; i++)
+        for (int i=0; i < tblmask; i++)
             table[i] = new int[modLen];
 
         // Compute the modular inverse
@@ -2421,7 +2503,7 @@
         if (table[0].length < modLen) {
            int offset = modLen - table[0].length;
            int[] t2 = new int[modLen];
-           for (int i=0; i<table[0].length; i++)
+           for (int i=0; i < table[0].length; i++)
                t2[i+offset] = table[0][i];
            table[0] = t2;
         }
@@ -2434,7 +2516,7 @@
         int[] t = Arrays.copyOf(b, modLen);
 
         // Fill in the table with odd powers of the base
-        for (int i=1; i<tblmask; i++) {
+        for (int i=1; i < tblmask; i++) {
             int[] prod = multiplyToLen(t, modLen, table[i-1], modLen, null);
             table[i] = montReduce(prod, mod, modLen, inv);
         }
@@ -2474,7 +2556,7 @@
             isone = false;
 
         // The main loop
-        while(true) {
+        while (true) {
             ebits--;
             // Advance the window
             buf <<= 1;
@@ -2551,9 +2633,9 @@
             int carry = mulAdd(n, mod, offset, mlen, inv * nEnd);
             c += addOne(n, offset, mlen, carry);
             offset++;
-        } while(--len > 0);
-
-        while(c>0)
+        } while (--len > 0);
+
+        while (c > 0)
             c += subN(n, mod, mlen);
 
         while (intArrayCmpToLen(n, mod, mlen) >= 0)
@@ -2568,7 +2650,7 @@
      * equal to, or greater than arg2 up to length len.
      */
     private static int intArrayCmpToLen(int[] arg1, int[] arg2, int len) {
-        for (int i=0; i<len; i++) {
+        for (int i=0; i < len; i++) {
             long b1 = arg1[i] & LONG_MASK;
             long b2 = arg2[i] & LONG_MASK;
             if (b1 < b2)
@@ -2585,7 +2667,7 @@
     private static int subN(int[] a, int[] b, int len) {
         long sum = 0;
 
-        while(--len >= 0) {
+        while (--len >= 0) {
             sum = (a[len] & LONG_MASK) -
                  (b[len] & LONG_MASK) + (sum >> 32);
             a[len] = (int)sum;
@@ -2679,7 +2761,7 @@
         int excessBits = (numInts << 5) - p;
         mag[0] &= (1L << (32-excessBits)) - 1;
 
-        return (mag[0]==0 ? new BigInteger(1, mag) : new BigInteger(mag, 1));
+        return (mag[0] == 0 ? new BigInteger(1, mag) : new BigInteger(mag, 1));
     }
 
     /**
@@ -2730,9 +2812,9 @@
     public BigInteger shiftLeft(int n) {
         if (signum == 0)
             return ZERO;
-        if (n==0)
+        if (n == 0)
             return this;
-        if (n<0) {
+        if (n < 0) {
             if (n == Integer.MIN_VALUE) {
                 throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
             } else {
@@ -2784,9 +2866,9 @@
      * @see #shiftLeft
      */
     public BigInteger shiftRight(int n) {
-        if (n==0)
+        if (n == 0)
             return this;
-        if (n<0) {
+        if (n < 0) {
             if (n == Integer.MIN_VALUE) {
                 throw new ArithmeticException("Shift distance of Integer.MIN_VALUE not supported.");
             } else {
@@ -2825,7 +2907,7 @@
         if (signum < 0) {
             // Find out whether any one-bits were shifted off the end.
             boolean onesLost = false;
-            for (int i=magLen-1, j=magLen-nInts; i>=j && !onesLost; i--)
+            for (int i=magLen-1, j=magLen-nInts; i >= j && !onesLost; i--)
                 onesLost = (mag[i] != 0);
             if (!onesLost && nBits != 0)
                 onesLost = (mag[magLen - nInts - 1] << (32 - nBits) != 0);
@@ -2860,7 +2942,7 @@
      */
     public BigInteger and(BigInteger val) {
         int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[i] = (getInt(result.length-i-1)
                          & val.getInt(result.length-i-1));
 
@@ -2877,7 +2959,7 @@
      */
     public BigInteger or(BigInteger val) {
         int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[i] = (getInt(result.length-i-1)
                          | val.getInt(result.length-i-1));
 
@@ -2894,7 +2976,7 @@
      */
     public BigInteger xor(BigInteger val) {
         int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[i] = (getInt(result.length-i-1)
                          ^ val.getInt(result.length-i-1));
 
@@ -2910,7 +2992,7 @@
      */
     public BigInteger not() {
         int[] result = new int[intLength()];
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[i] = ~getInt(result.length-i-1);
 
         return valueOf(result);
@@ -2928,7 +3010,7 @@
      */
     public BigInteger andNot(BigInteger val) {
         int[] result = new int[Math.max(intLength(), val.intLength())];
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[i] = (getInt(result.length-i-1)
                          & ~val.getInt(result.length-i-1));
 
@@ -2947,7 +3029,7 @@
      * @throws ArithmeticException {@code n} is negative.
      */
     public boolean testBit(int n) {
-        if (n<0)
+        if (n < 0)
             throw new ArithmeticException("Negative bit address");
 
         return (getInt(n >>> 5) & (1 << (n & 31))) != 0;
@@ -2962,13 +3044,13 @@
      * @throws ArithmeticException {@code n} is negative.
      */
     public BigInteger setBit(int n) {
-        if (n<0)
+        if (n < 0)
             throw new ArithmeticException("Negative bit address");
 
         int intNum = n >>> 5;
         int[] result = new int[Math.max(intLength(), intNum+2)];
 
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[result.length-i-1] = getInt(i);
 
         result[result.length-intNum-1] |= (1 << (n & 31));
@@ -2986,13 +3068,13 @@
      * @throws ArithmeticException {@code n} is negative.
      */
     public BigInteger clearBit(int n) {
-        if (n<0)
+        if (n < 0)
             throw new ArithmeticException("Negative bit address");
 
         int intNum = n >>> 5;
         int[] result = new int[Math.max(intLength(), ((n + 1) >>> 5) + 1)];
 
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[result.length-i-1] = getInt(i);
 
         result[result.length-intNum-1] &= ~(1 << (n & 31));
@@ -3010,13 +3092,13 @@
      * @throws ArithmeticException {@code n} is negative.
      */
     public BigInteger flipBit(int n) {
-        if (n<0)
+        if (n < 0)
             throw new ArithmeticException("Negative bit address");
 
         int intNum = n >>> 5;
         int[] result = new int[Math.max(intLength(), intNum+2)];
 
-        for (int i=0; i<result.length; i++)
+        for (int i=0; i < result.length; i++)
             result[result.length-i-1] = getInt(i);
 
         result[result.length-intNum-1] ^= (1 << (n & 31));
@@ -3028,7 +3110,7 @@
      * Returns the index of the rightmost (lowest-order) one bit in this
      * BigInteger (the number of zero bits to the right of the rightmost
      * one bit).  Returns -1 if this BigInteger contains no one bits.
-     * (Computes {@code (this==0? -1 : log2(this & -this))}.)
+     * (Computes {@code (this == 0? -1 : log2(this & -this))}.)
      *
      * @return index of the rightmost one bit in this BigInteger.
      */
@@ -3041,7 +3123,7 @@
             } else {
                 // Search for lowest order nonzero int
                 int i,b;
-                for (i=0; (b = getInt(i))==0; i++)
+                for (i=0; (b = getInt(i)) == 0; i++)
                     ;
                 lsb += (i << 5) + Integer.numberOfTrailingZeros(b);
             }
@@ -3102,12 +3184,12 @@
         if (bc == -1) {  // bitCount not initialized yet
             bc = 0;      // offset by one to initialize
             // Count the bits in the magnitude
-            for (int i=0; i<mag.length; i++)
+            for (int i=0; i < mag.length; i++)
                 bc += Integer.bitCount(mag[i]);
             if (signum < 0) {
                 // Count the trailing zeros in the magnitude
                 int magTrailingZeroCount = 0, j;
-                for (j=mag.length-1; mag[j]==0; j--)
+                for (j=mag.length-1; mag[j] == 0; j--)
                     magTrailingZeroCount += 32;
                 magTrailingZeroCount += Integer.numberOfTrailingZeros(mag[j]);
                 bc += magTrailingZeroCount - 1;
@@ -3208,14 +3290,14 @@
         assert val != Long.MIN_VALUE;
         int[] m1 = mag;
         int len = m1.length;
-        if(len > 2) {
+        if (len > 2) {
             return 1;
         }
         if (val < 0) {
             val = -val;
         }
         int highWord = (int)(val >>> 32);
-        if (highWord==0) {
+        if (highWord == 0) {
             if (len < 1)
                 return -1;
             if (len > 1)
@@ -3283,7 +3365,7 @@
      *         {@code val}.  If they are equal, either may be returned.
      */
     public BigInteger min(BigInteger val) {
-        return (compareTo(val)<0 ? this : val);
+        return (compareTo(val) < 0 ? this : val);
     }
 
     /**
@@ -3294,7 +3376,7 @@
      *         {@code val}.  If they are equal, either may be returned.
      */
     public BigInteger max(BigInteger val) {
-        return (compareTo(val)>0 ? this : val);
+        return (compareTo(val) > 0 ? this : val);
     }
 
 
@@ -3308,7 +3390,7 @@
     public int hashCode() {
         int hashCode = 0;
 
-        for (int i=0; i<mag.length; i++)
+        for (int i=0; i < mag.length; i++)
             hashCode = (int)(31*hashCode + (mag[i] & LONG_MASK));
 
         return hashCode * signum;
@@ -3356,8 +3438,9 @@
 
     /** This method is used to perform toString when arguments are small. */
     private String smallToString(int radix) {
-        if (signum == 0)
+        if (signum == 0) {
             return "0";
+        }
 
         // Compute upper bound on number of digit groups and allocate space
         int maxNumDigitGroups = (4*mag.length + 6)/7;
@@ -3382,16 +3465,18 @@
 
         // Put sign (if any) and first digit group into result buffer
         StringBuilder buf = new StringBuilder(numGroups*digitsPerLong[radix]+1);
-        if (signum<0)
+        if (signum < 0) {
             buf.append('-');
+        }
         buf.append(digitGroup[numGroups-1]);
 
         // Append remaining digit groups padded with leading zeros
-        for (int i=numGroups-2; i>=0; i--) {
+        for (int i=numGroups-2; i >= 0; i--) {
             // Prepend (any) leading zeros for this digit group
             int numLeadingZeros = digitsPerLong[radix]-digitGroup[i].length();
-            if (numLeadingZeros != 0)
+            if (numLeadingZeros != 0) {
                 buf.append(zeros[numLeadingZeros]);
+            }
             buf.append(digitGroup[i]);
         }
         return buf.toString();
@@ -3399,7 +3484,7 @@
 
     /**
      * Converts the specified BigInteger to a string and appends to
-     * <code>sb</code>.  This implements the recursive Schoenhage algorithm
+     * {@code sb}.  This implements the recursive Schoenhage algorithm
      * for base conversions.
      * <p/>
      * See Knuth, Donald,  _The Art of Computer Programming_, Vol. 2,
@@ -3419,9 +3504,11 @@
 
             // Pad with internal zeros if necessary.
             // Don't pad if we're at the beginning of the string.
-            if ((s.length() < digits) && (sb.length() > 0))
-                for (int i=s.length(); i<digits; i++) // May be a faster way to
+            if ((s.length() < digits) && (sb.length() > 0)) {
+                for (int i=s.length(); i < digits; i++) { // May be a faster way to
                     sb.append('0');                    // do this?
+                }
+            }
 
             sb.append(s);
             return;
@@ -3450,7 +3537,7 @@
      * If this value doesn't already exist in the cache, it is added.
      * <p/>
      * This could be changed to a more complicated caching method using
-     * <code>Future</code>.
+     * {@code Future}.
      */
     private static BigInteger getRadixConversionCache(int radix, int exponent) {
         BigInteger[] cacheLine = powerCache[radix]; // volatile read
@@ -3478,7 +3565,7 @@
     static {
         zeros[63] =
             "000000000000000000000000000000000000000000000000000000000000000";
-        for (int i=0; i<63; i++)
+        for (int i=0; i < 63; i++)
             zeros[i] = zeros[63].substring(0, i);
     }
 
@@ -3516,7 +3603,7 @@
         int byteLen = bitLength()/8 + 1;
         byte[] byteArray = new byte[byteLen];
 
-        for (int i=byteLen-1, bytesCopied=4, nextInt=0, intIndex=0; i>=0; i--) {
+        for (int i=byteLen-1, bytesCopied=4, nextInt=0, intIndex=0; i >= 0; i--) {
             if (bytesCopied == 4) {
                 nextInt = getInt(intIndex++);
                 bytesCopied = 1;
@@ -3568,7 +3655,7 @@
     public long longValue() {
         long result = 0;
 
-        for (int i=1; i>=0; i--)
+        for (int i=1; i >= 0; i--)
             result = (result << 32) + (getInt(i) & LONG_MASK);
         return result;
     }
@@ -3784,7 +3871,7 @@
         int keep;
 
         // Find first nonzero byte
-        for (keep = 0; keep < byteLength && a[keep]==0; keep++)
+        for (keep = 0; keep < byteLength && a[keep] == 0; keep++)
             ;
 
         // Allocate new array and copy relevant part of input array
@@ -3810,16 +3897,16 @@
         int byteLength = a.length;
 
         // Find first non-sign (0xff) byte of input
-        for (keep=0; keep<byteLength && a[keep]==-1; keep++)
+        for (keep=0; keep < byteLength && a[keep] == -1; keep++)
             ;
 
 
         /* Allocate output array.  If all non-sign bytes are 0x00, we must
          * allocate space for one extra output byte. */
-        for (k=keep; k<byteLength && a[k]==0; k++)
+        for (k=keep; k < byteLength && a[k] == 0; k++)
             ;
 
-        int extraByte = (k==byteLength) ? 1 : 0;
+        int extraByte = (k == byteLength) ? 1 : 0;
         int intLength = ((byteLength - keep + extraByte) + 3)/4;
         int result[] = new int[intLength];
 
@@ -3840,7 +3927,7 @@
         }
 
         // Add one to one's complement to generate two's complement
-        for (int i=result.length-1; i>=0; i--) {
+        for (int i=result.length-1; i >= 0; i--) {
             result[i] = (int)((result[i] & LONG_MASK) + 1);
             if (result[i] != 0)
                 break;
@@ -3857,23 +3944,23 @@
         int keep, j;
 
         // Find first non-sign (0xffffffff) int of input
-        for (keep=0; keep<a.length && a[keep]==-1; keep++)
+        for (keep=0; keep < a.length && a[keep] == -1; keep++)
             ;
 
         /* Allocate output array.  If all non-sign ints are 0x00, we must
          * allocate space for one extra output int. */
-        for (j=keep; j<a.length && a[j]==0; j++)
+        for (j=keep; j < a.length && a[j] == 0; j++)
             ;
-        int extraInt = (j==a.length ? 1 : 0);
+        int extraInt = (j == a.length ? 1 : 0);
         int result[] = new int[a.length - keep + extraInt];
 
         /* Copy one's complement of input into output, leaving extra
          * int (if it exists) == 0x00 */
-        for (int i = keep; i<a.length; i++)
+        for (int i = keep; i < a.length; i++)
             result[i - keep + extraInt] = ~a[i];
 
         // Add one to one's complement to generate two's complement
-        for (int i=result.length-1; ++result[i]==0; i--)
+        for (int i=result.length-1; ++result[i] == 0; i--)
             ;
 
         return result;
@@ -4131,7 +4218,7 @@
         byte[] result = new byte[byteLen];
 
         for (int i = byteLen - 1, bytesCopied = 4, intIndex = len - 1, nextInt = 0;
-             i>=0; i--) {
+             i >= 0; i--) {
             if (bytesCopied == 4) {
                 nextInt = mag[intIndex--];
                 bytesCopied = 1;
--- a/jdk/src/share/classes/java/math/MutableBigInteger.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/math/MutableBigInteger.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,14 +38,14 @@
  *
  * @see     BigInteger
  * @author  Michael McCloskey
+ * @author  Timothy Buktu
  * @since   1.3
  */
 
+import static java.math.BigDecimal.INFLATED;
+import static java.math.BigInteger.LONG_MASK;
 import java.util.Arrays;
 
-import static java.math.BigInteger.LONG_MASK;
-import static java.math.BigDecimal.INFLATED;
-
 class MutableBigInteger {
     /**
      * Holds the magnitude of this MutableBigInteger in big endian order.
@@ -75,6 +75,24 @@
      */
     static final MutableBigInteger ONE = new MutableBigInteger(1);
 
+    /**
+     * The minimum {@code intLen} for cancelling powers of two before
+     * dividing.
+     * If the number of ints is less than this threshold,
+     * {@code divideKnuth} does not eliminate common powers of two from
+     * the dividend and divisor.
+     */
+    static final int KNUTH_POW2_THRESH_LEN = 6;
+
+    /**
+     * The minimum number of trailing zero ints for cancelling powers of two
+     * before dividing.
+     * If the dividend and divisor don't share at least this many zero ints
+     * at the end, {@code divideKnuth} does not eliminate common powers
+     * of two from the dividend and divisor.
+     */
+    static final int KNUTH_POW2_THRESH_ZEROS = 3;
+
     // Constructors
 
     /**
@@ -124,6 +142,20 @@
     }
 
     /**
+     * Makes this number an {@code n}-int number all of whose bits are ones.
+     * Used by Burnikel-Ziegler division.
+     * @param n number of ints in the {@code value} array
+     * @return a number equal to {@code ((1<<(32*n)))-1}
+     */
+    private void ones(int n) {
+        if (n > value.length)
+            value = new int[n];
+        Arrays.fill(value, -1);
+        offset = 0;
+        intLen = n;
+    }
+
+    /**
      * Internal helper method to return the magnitude array. The caller is not
      * supposed to modify the returned array.
      */
@@ -155,6 +187,14 @@
     }
 
     /**
+     * Converts this number to a nonnegative {@code BigInteger}.
+     */
+    BigInteger toBigInteger() {
+        normalize();
+        return toBigInteger(isZero() ? 0 : 1);
+    }
+
+    /**
      * Convert this MutableBigInteger to BigDecimal object with the specified sign
      * and scale.
      */
@@ -238,6 +278,32 @@
     }
 
     /**
+     * Returns a value equal to what {@code b.leftShift(32*ints); return compare(b);}
+     * would return, but doesn't change the value of {@code b}.
+     */
+    private int compareShifted(MutableBigInteger b, int ints) {
+        int blen = b.intLen;
+        int alen = intLen - ints;
+        if (alen < blen)
+            return -1;
+        if (alen > blen)
+           return 1;
+
+        // Add Integer.MIN_VALUE to make the comparison act as unsigned integer
+        // comparison.
+        int[] bval = b.value;
+        for (int i = offset, j = b.offset; i < alen + offset; i++, j++) {
+            int b1 = value[i] + 0x80000000;
+            int b2 = bval[j]  + 0x80000000;
+            if (b1 < b2)
+                return -1;
+            if (b1 > b2)
+                return 1;
+        }
+        return 0;
+    }
+
+    /**
      * Compare this against half of a MutableBigInteger object (Needed for
      * remainder tests).
      * Assumes no leading unnecessary zeros, which holds for results
@@ -247,7 +313,7 @@
         int blen = b.intLen;
         int len = intLen;
         if (len <= 0)
-            return blen <=0 ? 0 : -1;
+            return blen <= 0 ? 0 : -1;
         if (len > blen)
             return 1;
         if (len < blen - 1)
@@ -274,7 +340,7 @@
                 return v < hb ? -1 : 1;
             carry = (bv & 1) << 31; // carray will be either 0x80000000 or 0
         }
-        return carry == 0? 0 : -1;
+        return carry == 0 ? 0 : -1;
     }
 
     /**
@@ -285,10 +351,10 @@
         if (intLen == 0)
             return -1;
         int j, b;
-        for (j=intLen-1; (j>0) && (value[j+offset]==0); j--)
+        for (j=intLen-1; (j > 0) && (value[j+offset] == 0); j--)
             ;
         b = value[j+offset];
-        if (b==0)
+        if (b == 0)
             return -1;
         return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b);
     }
@@ -329,11 +395,11 @@
         int indexBound = index+intLen;
         do {
             index++;
-        } while(index < indexBound && value[index]==0);
+        } while(index < indexBound && value[index] == 0);
 
         int numZeros = index - offset;
         intLen -= numZeros;
-        offset = (intLen==0 ?  0 : offset+numZeros);
+        offset = (intLen == 0 ?  0 : offset+numZeros);
     }
 
     /**
@@ -354,7 +420,7 @@
      */
     int[] toIntArray() {
         int[] result = new int[intLen];
-        for(int i=0; i<intLen; i++)
+        for(int i=0; i < intLen; i++)
             result[i] = value[offset+i];
         return result;
     }
@@ -440,7 +506,7 @@
     boolean isNormal() {
         if (intLen + offset > value.length)
             return false;
-        if (intLen ==0)
+        if (intLen == 0)
             return true;
         return (value[offset] != 0);
     }
@@ -454,6 +520,17 @@
     }
 
     /**
+     * Like {@link #rightShift(int)} but {@code n} can be greater than the length of the number.
+     */
+    void safeRightShift(int n) {
+        if (n/32 >= intLen) {
+            reset();
+        } else {
+            rightShift(n);
+        }
+    }
+
+    /**
      * Right shift this MutableBigInteger n bits. The MutableBigInteger is left
      * in normal form.
      */
@@ -475,6 +552,15 @@
     }
 
     /**
+     * Like {@link #leftShift(int)} but {@code n} can be zero.
+     */
+    void safeLeftShift(int n) {
+        if (n > 0) {
+            leftShift(n);
+        }
+    }
+
+    /**
      * Left shift this MutableBigInteger n bits.
      */
     void leftShift(int n) {
@@ -502,18 +588,18 @@
         if (value.length < newLen) {
             // The array must grow
             int[] result = new int[newLen];
-            for (int i=0; i<intLen; i++)
+            for (int i=0; i < intLen; i++)
                 result[i] = value[offset+i];
             setValue(result, newLen);
         } else if (value.length - offset >= newLen) {
             // Use space on right
-            for(int i=0; i<newLen - intLen; i++)
+            for(int i=0; i < newLen - intLen; i++)
                 value[offset+intLen+i] = 0;
         } else {
             // Must use space on left
-            for (int i=0; i<intLen; i++)
+            for (int i=0; i < intLen; i++)
                 value[i] = value[offset+i];
-            for (int i=intLen; i<newLen; i++)
+            for (int i=intLen; i < newLen; i++)
                 value[i] = 0;
             offset = 0;
         }
@@ -590,7 +676,7 @@
     private final void primitiveRightShift(int n) {
         int[] val = value;
         int n2 = 32 - n;
-        for (int i=offset+intLen-1, c=val[i]; i>offset; i--) {
+        for (int i=offset+intLen-1, c=val[i]; i > offset; i--) {
             int b = c;
             c = val[i-1];
             val[i] = (c << n2) | (b >>> n);
@@ -606,7 +692,7 @@
     private final void primitiveLeftShift(int n) {
         int[] val = value;
         int n2 = 32 - n;
-        for (int i=offset, c=val[i], m=i+intLen-1; i<m; i++) {
+        for (int i=offset, c=val[i], m=i+intLen-1; i < m; i++) {
             int b = c;
             c = val[i+1];
             val[i] = (b << n) | (c >>> n2);
@@ -615,6 +701,35 @@
     }
 
     /**
+     * Returns a {@code BigInteger} equal to the {@code n}
+     * low ints of this number.
+     */
+    private BigInteger getLower(int n) {
+        if (isZero()) {
+            return BigInteger.ZERO;
+        } else if (intLen < n) {
+            return toBigInteger(1);
+        } else {
+            // strip zeros
+            int len = n;
+            while (len > 0 && value[offset+intLen-len] == 0)
+                len--;
+            int sign = len > 0 ? 1 : 0;
+            return new BigInteger(Arrays.copyOfRange(value, offset+intLen-len, offset+intLen), sign);
+        }
+    }
+
+    /**
+     * Discards all ints whose index is greater than {@code n}.
+     */
+    private void keepLower(int n) {
+        if (intLen >= n) {
+            offset += intLen - n;
+            intLen = n;
+        }
+    }
+
+    /**
      * Adds the contents of two MutableBigInteger objects.The result
      * is placed within this MutableBigInteger.
      * The contents of the addend are not changed.
@@ -630,7 +745,7 @@
         long carry = 0;
 
         // Add common parts of both numbers
-        while(x>0 && y>0) {
+        while(x > 0 && y > 0) {
             x--; y--;
             sum = (value[x+offset] & LONG_MASK) +
                 (addend.value[y+addend.offset] & LONG_MASK) + carry;
@@ -639,7 +754,7 @@
         }
 
         // Add remainder of the longer number
-        while(x>0) {
+        while(x > 0) {
             x--;
             if (carry == 0 && result == value && rstart == (x + offset))
                 return;
@@ -647,7 +762,7 @@
             result[rstart--] = (int)sum;
             carry = sum >>> 32;
         }
-        while(y>0) {
+        while(y > 0) {
             y--;
             sum = (addend.value[y+addend.offset] & LONG_MASK) + carry;
             result[rstart--] = (int)sum;
@@ -673,6 +788,123 @@
         offset = result.length - resultLen;
     }
 
+    /**
+     * Adds the value of {@code addend} shifted {@code n} ints to the left.
+     * Has the same effect as {@code addend.leftShift(32*ints); add(addend);}
+     * but doesn't change the value of {@code addend}.
+     */
+    void addShifted(MutableBigInteger addend, int n) {
+        if (addend.isZero()) {
+            return;
+        }
+
+        int x = intLen;
+        int y = addend.intLen + n;
+        int resultLen = (intLen > y ? intLen : y);
+        int[] result = (value.length < resultLen ? new int[resultLen] : value);
+
+        int rstart = result.length-1;
+        long sum;
+        long carry = 0;
+
+        // Add common parts of both numbers
+        while (x > 0 && y > 0) {
+            x--; y--;
+            int bval = y+addend.offset < addend.value.length ? addend.value[y+addend.offset] : 0;
+            sum = (value[x+offset] & LONG_MASK) +
+                (bval & LONG_MASK) + carry;
+            result[rstart--] = (int)sum;
+            carry = sum >>> 32;
+        }
+
+        // Add remainder of the longer number
+        while (x > 0) {
+            x--;
+            if (carry == 0 && result == value && rstart == (x + offset)) {
+                return;
+            }
+            sum = (value[x+offset] & LONG_MASK) + carry;
+            result[rstart--] = (int)sum;
+            carry = sum >>> 32;
+        }
+        while (y > 0) {
+            y--;
+            int bval = y+addend.offset < addend.value.length ? addend.value[y+addend.offset] : 0;
+            sum = (bval & LONG_MASK) + carry;
+            result[rstart--] = (int)sum;
+            carry = sum >>> 32;
+        }
+
+        if (carry > 0) { // Result must grow in length
+            resultLen++;
+            if (result.length < resultLen) {
+                int temp[] = new int[resultLen];
+                // Result one word longer from carry-out; copy low-order
+                // bits into new result.
+                System.arraycopy(result, 0, temp, 1, result.length);
+                temp[0] = 1;
+                result = temp;
+            } else {
+                result[rstart--] = 1;
+            }
+        }
+
+        value = result;
+        intLen = resultLen;
+        offset = result.length - resultLen;
+    }
+
+    /**
+     * Like {@link #addShifted(MutableBigInteger, int)} but {@code this.intLen} must
+     * not be greater than {@code n}. In other words, concatenates {@code this}
+     * and {@code addend}.
+     */
+    void addDisjoint(MutableBigInteger addend, int n) {
+        if (addend.isZero())
+            return;
+
+        int x = intLen;
+        int y = addend.intLen + n;
+        int resultLen = (intLen > y ? intLen : y);
+        int[] result;
+        if (value.length < resultLen)
+            result = new int[resultLen];
+        else {
+            result = value;
+            Arrays.fill(value, offset+intLen, value.length, 0);
+        }
+
+        int rstart = result.length-1;
+
+        // copy from this if needed
+        System.arraycopy(value, offset, result, rstart+1-x, x);
+        y -= x;
+        rstart -= x;
+
+        int len = Math.min(y, addend.value.length-addend.offset);
+        System.arraycopy(addend.value, addend.offset, result, rstart+1-y, len);
+
+        // zero the gap
+        for (int i=rstart+1-y+len; i < rstart+1; i++)
+            result[i] = 0;
+
+        value = result;
+        intLen = resultLen;
+        offset = result.length - resultLen;
+    }
+
+    /**
+     * Adds the low {@code n} ints of {@code addend}.
+     */
+    void addLower(MutableBigInteger addend, int n) {
+        MutableBigInteger a = new MutableBigInteger(addend);
+        if (a.offset + a.intLen >= n) {
+            a.offset = a.offset + a.intLen - n;
+            a.intLen = n;
+        }
+        a.normalize();
+        add(a);
+    }
 
     /**
      * Subtracts the smaller of this and b from the larger and places the
@@ -704,7 +936,7 @@
         int rstart = result.length - 1;
 
         // Subtract common parts of both numbers
-        while (y>0) {
+        while (y > 0) {
             x--; y--;
 
             diff = (a.value[x+a.offset] & LONG_MASK) -
@@ -712,7 +944,7 @@
             result[rstart--] = (int)diff;
         }
         // Subtract remainder of longer number
-        while (x>0) {
+        while (x > 0) {
             x--;
             diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32));
             result[rstart--] = (int)diff;
@@ -733,7 +965,7 @@
     private int difference(MutableBigInteger b) {
         MutableBigInteger a = this;
         int sign = a.compare(b);
-        if (sign ==0)
+        if (sign == 0)
             return 0;
         if (sign < 0) {
             MutableBigInteger tmp = a;
@@ -746,14 +978,14 @@
         int y = b.intLen;
 
         // Subtract common parts of both numbers
-        while (y>0) {
+        while (y > 0) {
             x--; y--;
             diff = (a.value[a.offset+ x] & LONG_MASK) -
                 (b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32));
             a.value[a.offset+x] = (int)diff;
         }
         // Subtract remainder of longer number
-        while (x>0) {
+        while (x > 0) {
             x--;
             diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32));
             a.value[a.offset+x] = (int)diff;
@@ -822,7 +1054,7 @@
 
         // Perform the multiplication word by word
         long ylong = y & LONG_MASK;
-        int[] zval = (z.value.length<intLen+1 ? new int[intLen + 1]
+        int[] zval = (z.value.length < intLen+1 ? new int[intLen + 1]
                                               : z.value);
         long carry = 0;
         for (int i = intLen-1; i >= 0; i--) {
@@ -910,6 +1142,31 @@
      * Calculates the quotient of this div b and places the quotient in the
      * provided MutableBigInteger objects and the remainder object is returned.
      *
+     */
+    MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) {
+        return divide(b,quotient,true);
+    }
+
+    MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) {
+        if (intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD ||
+                b.intLen < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) {
+            return divideKnuth(b, quotient, needRemainder);
+        } else {
+            return divideAndRemainderBurnikelZiegler(b, quotient);
+        }
+    }
+
+    /**
+     * @see #divideKnuth(MutableBigInteger, MutableBigInteger, boolean)
+     */
+    MutableBigInteger divideKnuth(MutableBigInteger b, MutableBigInteger quotient) {
+        return divideKnuth(b,quotient,true);
+    }
+
+    /**
+     * Calculates the quotient of this div b and places the quotient in the
+     * provided MutableBigInteger objects and the remainder object is returned.
+     *
      * Uses Algorithm D in Knuth section 4.3.1.
      * Many optimizations to that algorithm have been adapted from the Colin
      * Plumb C library.
@@ -917,38 +1174,34 @@
      * changed.
      *
      */
-    MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient) {
-        return divide(b,quotient,true);
-    }
-
-    MutableBigInteger divide(MutableBigInteger b, MutableBigInteger quotient, boolean needReminder) {
+    MutableBigInteger divideKnuth(MutableBigInteger b, MutableBigInteger quotient, boolean needRemainder) {
         if (b.intLen == 0)
             throw new ArithmeticException("BigInteger divide by zero");
 
         // Dividend is zero
         if (intLen == 0) {
-            quotient.intLen = quotient.offset;
-            return needReminder ? new MutableBigInteger() : null;
+            quotient.intLen = quotient.offset = 0;
+            return needRemainder ? new MutableBigInteger() : null;
         }
 
         int cmp = compare(b);
         // Dividend less than divisor
         if (cmp < 0) {
             quotient.intLen = quotient.offset = 0;
-            return needReminder ? new MutableBigInteger(this) : null;
+            return needRemainder ? new MutableBigInteger(this) : null;
         }
         // Dividend equal to divisor
         if (cmp == 0) {
             quotient.value[0] = quotient.intLen = 1;
             quotient.offset = 0;
-            return needReminder ? new MutableBigInteger() : null;
+            return needRemainder ? new MutableBigInteger() : null;
         }
 
         quotient.clear();
         // Special case one word divisor
         if (b.intLen == 1) {
             int r = divideOneWord(b.value[b.offset], quotient);
-            if(needReminder) {
+            if(needRemainder) {
                 if (r == 0)
                     return new MutableBigInteger();
                 return new MutableBigInteger(r);
@@ -956,7 +1209,220 @@
                 return null;
             }
         }
-        return divideMagnitude(b, quotient, needReminder);
+
+        // Cancel common powers of two if we're above the KNUTH_POW2_* thresholds
+        if (intLen >= KNUTH_POW2_THRESH_LEN) {
+            int trailingZeroBits = Math.min(getLowestSetBit(), b.getLowestSetBit());
+            if (trailingZeroBits >= KNUTH_POW2_THRESH_ZEROS*32) {
+                MutableBigInteger a = new MutableBigInteger(this);
+                b = new MutableBigInteger(b);
+                a.rightShift(trailingZeroBits);
+                b.rightShift(trailingZeroBits);
+                MutableBigInteger r = a.divideKnuth(b, quotient);
+                r.leftShift(trailingZeroBits);
+                return r;
+            }
+        }
+
+        return divideMagnitude(b, quotient, needRemainder);
+    }
+
+    /**
+     * Computes {@code this/b} and {@code this%b} using the
+     * <a href="http://cr.yp.to/bib/1998/burnikel.ps"> Burnikel-Ziegler algorithm</a>.
+     * This method implements algorithm 3 from pg. 9 of the Burnikel-Ziegler paper.
+     * The parameter beta was chosen to b 2<sup>32</sup> so almost all shifts are
+     * multiples of 32 bits.<br/>
+     * {@code this} and {@code b} must be nonnegative.
+     * @param b the divisor
+     * @param quotient output parameter for {@code this/b}
+     * @return the remainder
+     */
+    MutableBigInteger divideAndRemainderBurnikelZiegler(MutableBigInteger b, MutableBigInteger quotient) {
+        int r = intLen;
+        int s = b.intLen;
+
+        if (r < s) {
+            return this;
+        } else {
+            // Unlike Knuth division, we don't check for common powers of two here because
+            // BZ already runs faster if both numbers contain powers of two and cancelling them has no
+            // additional benefit.
+
+            // step 1: let m = min{2^k | (2^k)*BURNIKEL_ZIEGLER_THRESHOLD > s}
+            int m = 1 << (32-Integer.numberOfLeadingZeros(s/BigInteger.BURNIKEL_ZIEGLER_THRESHOLD));
+
+            int j = (s+m-1) / m;      // step 2a: j = ceil(s/m)
+            int n = j * m;            // step 2b: block length in 32-bit units
+            int n32 = 32 * n;         // block length in bits
+            int sigma = Math.max(0, n32 - b.bitLength());   // step 3: sigma = max{T | (2^T)*B < beta^n}
+            MutableBigInteger bShifted = new MutableBigInteger(b);
+            bShifted.safeLeftShift(sigma);   // step 4a: shift b so its length is a multiple of n
+            safeLeftShift(sigma);     // step 4b: shift this by the same amount
+
+            // step 5: t is the number of blocks needed to accommodate this plus one additional bit
+            int t = (bitLength()+n32) / n32;
+            if (t < 2) {
+                t = 2;
+            }
+
+            // step 6: conceptually split this into blocks a[t-1], ..., a[0]
+            MutableBigInteger a1 = getBlock(t-1, t, n);   // the most significant block of this
+
+            // step 7: z[t-2] = [a[t-1], a[t-2]]
+            MutableBigInteger z = getBlock(t-2, t, n);    // the second to most significant block
+            z.addDisjoint(a1, n);   // z[t-2]
+
+            // do schoolbook division on blocks, dividing 2-block numbers by 1-block numbers
+            MutableBigInteger qi = new MutableBigInteger();
+            MutableBigInteger ri;
+            quotient.offset = quotient.intLen = 0;
+            for (int i=t-2; i > 0; i--) {
+                // step 8a: compute (qi,ri) such that z=b*qi+ri
+                ri = z.divide2n1n(bShifted, qi);
+
+                // step 8b: z = [ri, a[i-1]]
+                z = getBlock(i-1, t, n);   // a[i-1]
+                z.addDisjoint(ri, n);
+                quotient.addShifted(qi, i*n);   // update q (part of step 9)
+            }
+            // final iteration of step 8: do the loop one more time for i=0 but leave z unchanged
+            ri = z.divide2n1n(bShifted, qi);
+            quotient.add(qi);
+
+            ri.rightShift(sigma);   // step 9: this and b were shifted, so shift back
+            return ri;
+        }
+    }
+
+    /**
+     * This method implements algorithm 1 from pg. 4 of the Burnikel-Ziegler paper.
+     * It divides a 2n-digit number by a n-digit number.<br/>
+     * The parameter beta is 2<sup>32</sup> so all shifts are multiples of 32 bits.
+     * <br/>
+     * {@code this} must be a nonnegative number such that {@code this.bitLength() <= 2*b.bitLength()}
+     * @param b a positive number such that {@code b.bitLength()} is even
+     * @param quotient output parameter for {@code this/b}
+     * @return {@code this%b}
+     */
+    private MutableBigInteger divide2n1n(MutableBigInteger b, MutableBigInteger quotient) {
+        int n = b.intLen;
+
+        // step 1: base case
+        if (n%2 != 0 || n < BigInteger.BURNIKEL_ZIEGLER_THRESHOLD) {
+            return divideKnuth(b, quotient);
+        }
+
+        // step 2: view this as [a1,a2,a3,a4] where each ai is n/2 ints or less
+        MutableBigInteger aUpper = new MutableBigInteger(this);
+        aUpper.safeRightShift(32*(n/2));   // aUpper = [a1,a2,a3]
+        keepLower(n/2);   // this = a4
+
+        // step 3: q1=aUpper/b, r1=aUpper%b
+        MutableBigInteger q1 = new MutableBigInteger();
+        MutableBigInteger r1 = aUpper.divide3n2n(b, q1);
+
+        // step 4: quotient=[r1,this]/b, r2=[r1,this]%b
+        addDisjoint(r1, n/2);   // this = [r1,this]
+        MutableBigInteger r2 = divide3n2n(b, quotient);
+
+        // step 5: let quotient=[q1,quotient] and return r2
+        quotient.addDisjoint(q1, n/2);
+        return r2;
+    }
+
+    /**
+     * This method implements algorithm 2 from pg. 5 of the Burnikel-Ziegler paper.
+     * It divides a 3n-digit number by a 2n-digit number.<br/>
+     * The parameter beta is 2<sup>32</sup> so all shifts are multiples of 32 bits.<br/>
+     * <br/>
+     * {@code this} must be a nonnegative number such that {@code 2*this.bitLength() <= 3*b.bitLength()}
+     * @param quotient output parameter for {@code this/b}
+     * @return {@code this%b}
+     */
+    private MutableBigInteger divide3n2n(MutableBigInteger b, MutableBigInteger quotient) {
+        int n = b.intLen / 2;   // half the length of b in ints
+
+        // step 1: view this as [a1,a2,a3] where each ai is n ints or less; let a12=[a1,a2]
+        MutableBigInteger a12 = new MutableBigInteger(this);
+        a12.safeRightShift(32*n);
+
+        // step 2: view b as [b1,b2] where each bi is n ints or less
+        MutableBigInteger b1 = new MutableBigInteger(b);
+        b1.safeRightShift(n * 32);
+        BigInteger b2 = b.getLower(n);
+
+        MutableBigInteger r;
+        MutableBigInteger d;
+        if (compareShifted(b, n) < 0) {
+            // step 3a: if a1<b1, let quotient=a12/b1 and r=a12%b1
+            r = a12.divide2n1n(b1, quotient);
+
+            // step 4: d=quotient*b2
+            d = new MutableBigInteger(quotient.toBigInteger().multiply(b2));
+        } else {
+            // step 3b: if a1>=b1, let quotient=beta^n-1 and r=a12-b1*2^n+b1
+            quotient.ones(n);
+            a12.add(b1);
+            b1.leftShift(32*n);
+            a12.subtract(b1);
+            r = a12;
+
+            // step 4: d=quotient*b2=(b2 << 32*n) - b2
+            d = new MutableBigInteger(b2);
+            d.leftShift(32 * n);
+            d.subtract(new MutableBigInteger(b2));
+        }
+
+        // step 5: r = r*beta^n + a3 - d (paper says a4)
+        // However, don't subtract d until after the while loop so r doesn't become negative
+        r.leftShift(32 * n);
+        r.addLower(this, n);
+
+        // step 6: add b until r>=d
+        while (r.compare(d) < 0) {
+            r.add(b);
+            quotient.subtract(MutableBigInteger.ONE);
+        }
+        r.subtract(d);
+
+        return r;
+    }
+
+    /**
+     * Returns a {@code MutableBigInteger} containing {@code blockLength} ints from
+     * {@code this} number, starting at {@code index*blockLength}.<br/>
+     * Used by Burnikel-Ziegler division.
+     * @param index the block index
+     * @param numBlocks the total number of blocks in {@code this} number
+     * @param blockLength length of one block in units of 32 bits
+     * @return
+     */
+    private MutableBigInteger getBlock(int index, int numBlocks, int blockLength) {
+        int blockStart = index * blockLength;
+        if (blockStart >= intLen) {
+            return new MutableBigInteger();
+        }
+
+        int blockEnd;
+        if (index == numBlocks-1) {
+            blockEnd = intLen;
+        } else {
+            blockEnd = (index+1) * blockLength;
+        }
+        if (blockEnd > intLen) {
+            return new MutableBigInteger();
+        }
+
+        int[] newVal = Arrays.copyOfRange(value, offset+intLen-blockEnd, offset+intLen-blockStart);
+        return new MutableBigInteger(newVal);
+    }
+
+    /** @see BigInteger#bitLength() */
+    int bitLength() {
+        if (intLen == 0)
+            return 0;
+        return intLen*32 - Integer.numberOfLeadingZeros(value[offset]);
     }
 
     /**
@@ -1006,7 +1472,7 @@
      */
     private MutableBigInteger divideMagnitude(MutableBigInteger div,
                                               MutableBigInteger quotient,
-                                              boolean needReminder ) {
+                                              boolean needRemainder ) {
         // assert div.intLen > 1
         // D1 normalize the divisor
         int shift = Integer.numberOfLeadingZeros(div.value[div.offset]);
@@ -1017,7 +1483,7 @@
         if (shift > 0) {
             divisor = new int[dlen];
             copyAndShift(div.value,div.offset,dlen,divisor,0,shift);
-            if(Integer.numberOfLeadingZeros(value[offset])>=shift) {
+            if (Integer.numberOfLeadingZeros(value[offset]) >= shift) {
                 int[] remarr = new int[intLen + 1];
                 rem = new MutableBigInteger(remarr);
                 rem.intLen = intLen;
@@ -1070,7 +1536,7 @@
         int dl = divisor[1];
 
         // D2 Initialize j
-        for(int j=0; j<limit-1; j++) {
+        for (int j=0; j < limit-1; j++) {
             // D3 Calculate qhat
             // estimate qhat
             int qhat = 0;
@@ -1176,7 +1642,7 @@
             // D4 Multiply and subtract
             int borrow;
             rem.value[limit - 1 + rem.offset] = 0;
-            if(needReminder)
+            if(needRemainder)
                 borrow = mulsub(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);
             else
                 borrow = mulsubBorrow(rem.value, divisor, qhat, dlen, limit - 1 + rem.offset);
@@ -1184,7 +1650,7 @@
             // D5 Test remainder
             if (borrow + 0x80000000 > nh2) {
                 // D6 Add back
-                if(needReminder)
+                if(needRemainder)
                     divadd(divisor, rem.value, limit - 1 + 1 + rem.offset);
                 qhat--;
             }
@@ -1194,14 +1660,14 @@
         }
 
 
-        if(needReminder) {
+        if (needRemainder) {
             // D8 Unnormalize
             if (shift > 0)
                 rem.rightShift(shift);
             rem.normalize();
         }
         quotient.normalize();
-        return needReminder ? rem : null;
+        return needRemainder ? rem : null;
     }
 
     /**
@@ -1367,7 +1833,7 @@
      * This method divides a long quantity by an int to estimate
      * qhat for two multi precision numbers. It is used when
      * the signed value of n is less than zero.
-     * Returns long value where high 32 bits contain reminder value and
+     * Returns long value where high 32 bits contain remainder value and
      * low 32 bits contain quotient value.
      */
     static long divWord(long n, int d) {
@@ -1436,7 +1902,7 @@
         }
 
         // step B2
-        boolean uOdd = (k==s1);
+        boolean uOdd = (k == s1);
         MutableBigInteger t = uOdd ? v: u;
         int tsign = uOdd ? -1 : 1;
 
@@ -1478,9 +1944,9 @@
      * Calculate GCD of a and b interpreted as unsigned integers.
      */
     static int binaryGcd(int a, int b) {
-        if (b==0)
+        if (b == 0)
             return a;
-        if (a==0)
+        if (a == 0)
             return b;
 
         // Right shift a & b till their last bits equal to 1.
@@ -1582,7 +2048,7 @@
         return result;
     }
 
-    /*
+    /**
      * Returns the multiplicative inverse of val mod 2^32.  Assumes val is odd.
      */
     static int inverseMod32(int val) {
@@ -1595,7 +2061,7 @@
         return t;
     }
 
-    /*
+    /**
      * Calculate the multiplicative inverse of 2^k mod mod, where mod is odd.
      */
     static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
@@ -1631,7 +2097,7 @@
         }
 
         // The Almost Inverse Algorithm
-        while(!f.isOne()) {
+        while (!f.isOne()) {
             // If gcd(f, g) != 1, number is not invertible modulo mod
             if (f.isZero())
                 throw new ArithmeticException("BigInteger not invertible.");
@@ -1665,7 +2131,7 @@
         return fixup(c, p, k);
     }
 
-    /*
+    /**
      * The Fixup Algorithm
      * Calculates X such that X = C * 2^(-k) (mod P)
      * Assumes C<P and P is odd.
@@ -1676,7 +2142,7 @@
         // Set r to the multiplicative inverse of p mod 2^32
         int r = -inverseMod32(p.value[p.offset+p.intLen-1]);
 
-        for(int i=0, numWords = k >> 5; i<numWords; i++) {
+        for (int i=0, numWords = k >> 5; i < numWords; i++) {
             // V = R * c (mod 2^j)
             int  v = r * c.value[c.offset + c.intLen-1];
             // c = c + (v * p)
--- a/jdk/src/share/classes/java/net/Authenticator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/Authenticator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -103,17 +103,17 @@
      * Sets the authenticator that will be used by the networking code
      * when a proxy or an HTTP server asks for authentication.
      * <p>
-     * First, if there is a security manager, its <code>checkPermission</code>
+     * First, if there is a security manager, its {@code checkPermission}
      * method is called with a
-     * <code>NetPermission("setDefaultAuthenticator")</code> permission.
+     * {@code NetPermission("setDefaultAuthenticator")} permission.
      * This may result in a java.lang.SecurityException.
      *
-     * @param   a       The authenticator to be set. If a is <code>null</code> then
+     * @param   a       The authenticator to be set. If a is {@code null} then
      *                  any previously set authenticator is removed.
      *
      * @throws SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow
+     *        {@code checkPermission} method doesn't allow
      *        setting the default authenticator.
      *
      * @see SecurityManager#checkPermission
@@ -134,9 +134,9 @@
      * Ask the authenticator that has been registered with the system
      * for a password.
      * <p>
-     * First, if there is a security manager, its <code>checkPermission</code>
+     * First, if there is a security manager, its {@code checkPermission}
      * method is called with a
-     * <code>NetPermission("requestPasswordAuthentication")</code> permission.
+     * {@code NetPermission("requestPasswordAuthentication")} permission.
      * This may result in a java.lang.SecurityException.
      *
      * @param addr The InetAddress of the site requesting authorization,
@@ -151,7 +151,7 @@
      *
      * @throws SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow
+     *        {@code checkPermission} method doesn't allow
      *        the password authentication request.
      *
      * @see SecurityManager#checkPermission
@@ -193,9 +193,9 @@
      * because the hostname can be provided in cases where the InetAddress
      * is not available.
      * <p>
-     * First, if there is a security manager, its <code>checkPermission</code>
+     * First, if there is a security manager, its {@code checkPermission}
      * method is called with a
-     * <code>NetPermission("requestPasswordAuthentication")</code> permission.
+     * {@code NetPermission("requestPasswordAuthentication")} permission.
      * This may result in a java.lang.SecurityException.
      *
      * @param host The hostname of the site requesting authentication.
@@ -211,7 +211,7 @@
      *
      * @throws SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow
+     *        {@code checkPermission} method doesn't allow
      *        the password authentication request.
      *
      * @see SecurityManager#checkPermission
@@ -254,9 +254,9 @@
      * Ask the authenticator that has been registered with the system
      * for a password.
      * <p>
-     * First, if there is a security manager, its <code>checkPermission</code>
+     * First, if there is a security manager, its {@code checkPermission}
      * method is called with a
-     * <code>NetPermission("requestPasswordAuthentication")</code> permission.
+     * {@code NetPermission("requestPasswordAuthentication")} permission.
      * This may result in a java.lang.SecurityException.
      *
      * @param host The hostname of the site requesting authentication.
@@ -275,7 +275,7 @@
      *
      * @throws SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow
+     *        {@code checkPermission} method doesn't allow
      *        the password authentication request.
      *
      * @see SecurityManager#checkPermission
@@ -320,8 +320,8 @@
     }
 
     /**
-     * Gets the <code>hostname</code> of the
-     * site or proxy requesting authentication, or <code>null</code>
+     * Gets the {@code hostname} of the
+     * site or proxy requesting authentication, or {@code null}
      * if not available.
      *
      * @return the hostname of the connection requiring authentication, or null
@@ -333,8 +333,8 @@
     }
 
     /**
-     * Gets the <code>InetAddress</code> of the
-     * site requesting authorization, or <code>null</code>
+     * Gets the {@code InetAddress} of the
+     * site requesting authorization, or {@code null}
      * if not available.
      *
      * @return the InetAddress of the site requesting authorization, or null
@@ -346,7 +346,7 @@
 
     /**
      * Gets the port number for the requested connection.
-     * @return an <code>int</code> indicating the
+     * @return an {@code int} indicating the
      * port for the requested connection.
      */
     protected final int getRequestingPort() {
--- a/jdk/src/share/classes/java/net/ContentHandler.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/ContentHandler.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,21 +28,21 @@
 import java.io.IOException;
 
 /**
- * The abstract class <code>ContentHandler</code> is the superclass
- * of all classes that read an <code>Object</code> from a
- * <code>URLConnection</code>.
+ * The abstract class {@code ContentHandler} is the superclass
+ * of all classes that read an {@code Object} from a
+ * {@code URLConnection}.
  * <p>
  * An application does not generally call the
- * <code>getContent</code> method in this class directly. Instead, an
- * application calls the <code>getContent</code> method in class
- * <code>URL</code> or in <code>URLConnection</code>.
+ * {@code getContent} method in this class directly. Instead, an
+ * application calls the {@code getContent} method in class
+ * {@code URL} or in {@code URLConnection}.
  * The application's content handler factory (an instance of a class that
- * implements the interface <code>ContentHandlerFactory</code> set
- * up by a call to <code>setContentHandler</code>) is
- * called with a <code>String</code> giving the MIME type of the
+ * implements the interface {@code ContentHandlerFactory} set
+ * up by a call to {@code setContentHandler}) is
+ * called with a {@code String} giving the MIME type of the
  * object being received on the socket. The factory returns an
- * instance of a subclass of <code>ContentHandler</code>, and its
- * <code>getContent</code> method is called to create the object.
+ * instance of a subclass of {@code ContentHandler}, and its
+ * {@code getContent} method is called to create the object.
  * <p>
  * If no content handler could be found, URLConnection will
  * look for a content handler in a user-defineable set of places.
@@ -75,7 +75,7 @@
      * creates an object from it.
      *
      * @param      urlc   a URL connection.
-     * @return     the object read by the <code>ContentHandler</code>.
+     * @return     the object read by the {@code ContentHandler}.
      * @exception  IOException  if an I/O error occurs while reading the object.
      */
     abstract public Object getContent(URLConnection urlc) throws IOException;
@@ -90,7 +90,7 @@
      *
      * @param      urlc   a URL connection.
      * @param      classes      an array of types requested
-     * @return     the object read by the <code>ContentHandler</code> that is
+     * @return     the object read by the {@code ContentHandler} that is
      *                 the first match of the suggested types.
      *                 null if none of the requested  are supported.
      * @exception  IOException  if an I/O error occurs while reading the object.
--- a/jdk/src/share/classes/java/net/ContentHandlerFactory.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/ContentHandlerFactory.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,10 +28,10 @@
 /**
  * This interface defines a factory for content handlers. An
  * implementation of this interface should map a MIME type into an
- * instance of <code>ContentHandler</code>.
+ * instance of {@code ContentHandler}.
  * <p>
- * This interface is used by the <code>URLStreamHandler</code> class
- * to create a <code>ContentHandler</code> for a MIME type.
+ * This interface is used by the {@code URLStreamHandler} class
+ * to create a {@code ContentHandler} for a MIME type.
  *
  * @author  James Gosling
  * @see     java.net.ContentHandler
@@ -40,13 +40,13 @@
  */
 public interface ContentHandlerFactory {
     /**
-     * Creates a new <code>ContentHandler</code> to read an object from
-     * a <code>URLStreamHandler</code>.
+     * Creates a new {@code ContentHandler} to read an object from
+     * a {@code URLStreamHandler}.
      *
      * @param   mimetype   the MIME type for which a content handler is desired.
 
-     * @return  a new <code>ContentHandler</code> to read an object from a
-     *          <code>URLStreamHandler</code>.
+     * @return  a new {@code ContentHandler} to read an object from a
+     *          {@code URLStreamHandler}.
      * @see     java.net.ContentHandler
      * @see     java.net.URLStreamHandler
      */
--- a/jdk/src/share/classes/java/net/CookieHandler.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/CookieHandler.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
      *        there is no system-wide cookie handler currently set.
      * @throws SecurityException
      *       If a security manager has been installed and it denies
-     * {@link NetPermission}<tt>("getCookieHandler")</tt>
+     * {@link NetPermission}{@code ("getCookieHandler")}
      * @see #setDefault(CookieHandler)
      */
     public synchronized static CookieHandler getDefault() {
@@ -83,10 +83,10 @@
      * Note: non-standard http protocol handlers may ignore this setting.
      *
      * @param cHandler The HTTP cookie handler, or
-     *       <code>null</code> to unset.
+     *       {@code null} to unset.
      * @throws SecurityException
      *       If a security manager has been installed and it denies
-     * {@link NetPermission}<tt>("setCookieHandler")</tt>
+     * {@link NetPermission}{@code ("setCookieHandler")}
      * @see #getDefault()
      */
     public synchronized static void setDefault(CookieHandler cHandler) {
@@ -114,7 +114,7 @@
      * called after all request headers related to choosing cookies
      * are added, and before the request is sent.</P>
      *
-     * @param uri a <code>URI</code> representing the intended use for the
+     * @param uri a {@code URI} representing the intended use for the
      *            cookies
      * @param requestHeaders - a Map from request header
      *            field names to lists of field values representing
@@ -136,7 +136,7 @@
      * fields that are named Set-Cookie2, present in the response
      * headers into a cookie cache.
      *
-     * @param uri a <code>URI</code> where the cookies come from
+     * @param uri a {@code URI} where the cookies come from
      * @param responseHeaders an immutable map from field names to
      *            lists of field values representing the response
      *            header fields returned
--- a/jdk/src/share/classes/java/net/CookieManager.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/CookieManager.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,7 +131,7 @@
      *
      * <p>This constructor will create new cookie manager with default
      * cookie store and accept policy. The effect is same as
-     * <tt>CookieManager(null, null)</tt>.
+     * {@code CookieManager(null, null)}.
      */
     public CookieManager() {
         this(null, null);
@@ -141,12 +141,12 @@
     /**
      * Create a new cookie manager with specified cookie store and cookie policy.
      *
-     * @param store     a <tt>CookieStore</tt> to be used by cookie manager.
-     *                  if <tt>null</tt>, cookie manager will use a default one,
+     * @param store     a {@code CookieStore} to be used by cookie manager.
+     *                  if {@code null}, cookie manager will use a default one,
      *                  which is an in-memory CookieStore implmentation.
-     * @param cookiePolicy      a <tt>CookiePolicy</tt> instance
+     * @param cookiePolicy      a {@code CookiePolicy} instance
      *                          to be used by cookie manager as policy callback.
-     *                          if <tt>null</tt>, ACCEPT_ORIGINAL_SERVER will
+     *                          if {@code null}, ACCEPT_ORIGINAL_SERVER will
      *                          be used.
      */
     public CookieManager(CookieStore store,
@@ -170,11 +170,11 @@
     /**
      * To set the cookie policy of this cookie manager.
      *
-     * <p> A instance of <tt>CookieManager</tt> will have
+     * <p> A instance of {@code CookieManager} will have
      * cookie policy ACCEPT_ORIGINAL_SERVER by default. Users always
      * can call this method to set another cookie policy.
      *
-     * @param cookiePolicy      the cookie policy. Can be <tt>null</tt>, which
+     * @param cookiePolicy      the cookie policy. Can be {@code null}, which
      *                          has no effects on current cookie policy.
      */
     public void setCookiePolicy(CookiePolicy cookiePolicy) {
--- a/jdk/src/share/classes/java/net/CookiePolicy.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/CookiePolicy.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,8 +71,8 @@
      *
      * @param uri       the URI to consult accept policy with
      * @param cookie    the HttpCookie object in question
-     * @return          <tt>true</tt> if this cookie should be accepted;
-     *                  otherwise, <tt>false</tt>
+     * @return          {@code true} if this cookie should be accepted;
+     *                  otherwise, {@code false}
      */
     public boolean shouldAccept(URI uri, HttpCookie cookie);
 }
--- a/jdk/src/share/classes/java/net/CookieStore.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/CookieStore.java	Tue Aug 06 16:54:56 2013 -0700
@@ -32,8 +32,8 @@
  * A CookieStore object represents a storage for cookie. Can store and retrieve
  * cookies.
  *
- * <p>{@link CookieManager} will call <tt>CookieStore.add</tt> to save cookies
- * for every incoming HTTP response, and call <tt>CookieStore.get</tt> to
+ * <p>{@link CookieManager} will call {@code CookieStore.add} to save cookies
+ * for every incoming HTTP response, and call {@code CookieStore.get} to
  * retrieve cookie for every outgoing HTTP request. A CookieStore
  * is responsible for removing HttpCookie instances which have expired.
  *
@@ -55,11 +55,11 @@
      * then it is replaced with the new one.
      *
      * @param uri       the uri this cookie associated with.
-     *                  if <tt>null</tt>, this cookie will not be associated
+     *                  if {@code null}, this cookie will not be associated
      *                  with an URI
      * @param cookie    the cookie to store
      *
-     * @throws NullPointerException if <tt>cookie</tt> is <tt>null</tt>
+     * @throws NullPointerException if {@code cookie} is {@code null}
      *
      * @see #get
      *
@@ -77,7 +77,7 @@
      *
      * @param uri       the uri associated with the cookies to be returned
      *
-     * @throws NullPointerException if <tt>uri</tt> is <tt>null</tt>
+     * @throws NullPointerException if {@code uri} is {@code null}
      *
      * @see #add
      *
@@ -108,14 +108,14 @@
      * Remove a cookie from store.
      *
      * @param uri       the uri this cookie associated with.
-     *                  if <tt>null</tt>, the cookie to be removed is not associated
-     *                  with an URI when added; if not <tt>null</tt>, the cookie
+     *                  if {@code null}, the cookie to be removed is not associated
+     *                  with an URI when added; if not {@code null}, the cookie
      *                  to be removed is associated with the given URI when added.
      * @param cookie    the cookie to remove
      *
-     * @return          <tt>true</tt> if this store contained the specified cookie
+     * @return          {@code true} if this store contained the specified cookie
      *
-     * @throws NullPointerException if <tt>cookie</tt> is <tt>null</tt>
+     * @throws NullPointerException if {@code cookie} is {@code null}
      */
     public boolean remove(URI uri, HttpCookie cookie);
 
@@ -123,7 +123,7 @@
     /**
      * Remove all cookies in this cookie store.
      *
-     * @return          <tt>true</tt> if this store changed as a result of the call
+     * @return          {@code true} if this store changed as a result of the call
      */
     public boolean removeAll();
 }
--- a/jdk/src/share/classes/java/net/DatagramPacket.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/DatagramPacket.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,11 +68,11 @@
     int port;
 
     /**
-     * Constructs a <code>DatagramPacket</code> for receiving packets of
-     * length <code>length</code>, specifying an offset into the buffer.
+     * Constructs a {@code DatagramPacket} for receiving packets of
+     * length {@code length}, specifying an offset into the buffer.
      * <p>
-     * The <code>length</code> argument must be less than or equal to
-     * <code>buf.length</code>.
+     * The {@code length} argument must be less than or equal to
+     * {@code buf.length}.
      *
      * @param   buf      buffer for holding the incoming datagram.
      * @param   offset   the offset for the buffer
@@ -87,11 +87,11 @@
     }
 
     /**
-     * Constructs a <code>DatagramPacket</code> for receiving packets of
-     * length <code>length</code>.
+     * Constructs a {@code DatagramPacket} for receiving packets of
+     * length {@code length}.
      * <p>
-     * The <code>length</code> argument must be less than or equal to
-     * <code>buf.length</code>.
+     * The {@code length} argument must be less than or equal to
+     * {@code buf.length}.
      *
      * @param   buf      buffer for holding the incoming datagram.
      * @param   length   the number of bytes to read.
@@ -102,10 +102,10 @@
 
     /**
      * Constructs a datagram packet for sending packets of length
-     * <code>length</code> with offset <code>ioffset</code>to the
+     * {@code length} with offset {@code ioffset}to the
      * specified port number on the specified host. The
-     * <code>length</code> argument must be less than or equal to
-     * <code>buf.length</code>.
+     * {@code length} argument must be less than or equal to
+     * {@code buf.length}.
      *
      * @param   buf      the packet data.
      * @param   offset   the packet data offset.
@@ -125,10 +125,10 @@
 
     /**
      * Constructs a datagram packet for sending packets of length
-     * <code>length</code> with offset <code>ioffset</code>to the
+     * {@code length} with offset {@code ioffset}to the
      * specified port number on the specified host. The
-     * <code>length</code> argument must be less than or equal to
-     * <code>buf.length</code>.
+     * {@code length} argument must be less than or equal to
+     * {@code buf.length}.
      *
      * @param   buf      the packet data.
      * @param   offset   the packet data offset.
@@ -147,9 +147,9 @@
 
     /**
      * Constructs a datagram packet for sending packets of length
-     * <code>length</code> to the specified port number on the specified
-     * host. The <code>length</code> argument must be less than or equal
-     * to <code>buf.length</code>.
+     * {@code length} to the specified port number on the specified
+     * host. The {@code length} argument must be less than or equal
+     * to {@code buf.length}.
      *
      * @param   buf      the packet data.
      * @param   length   the packet length.
@@ -164,9 +164,9 @@
 
     /**
      * Constructs a datagram packet for sending packets of length
-     * <code>length</code> to the specified port number on the specified
-     * host. The <code>length</code> argument must be less than or equal
-     * to <code>buf.length</code>.
+     * {@code length} to the specified port number on the specified
+     * host. The {@code length} argument must be less than or equal
+     * to {@code buf.length}.
      *
      * @param   buf      the packet data.
      * @param   length   the packet length.
@@ -207,8 +207,8 @@
 
     /**
      * Returns the data buffer. The data received or the data to be sent
-     * starts from the <code>offset</code> in the buffer,
-     * and runs for <code>length</code> long.
+     * starts from the {@code offset} in the buffer,
+     * and runs for {@code length} long.
      *
      * @return  the buffer used to receive or  send data
      * @see #setData(byte[], int, int)
@@ -277,7 +277,7 @@
     /**
      * Sets the IP address of the machine to which this datagram
      * is being sent.
-     * @param iaddr the <code>InetAddress</code>
+     * @param iaddr the {@code InetAddress}
      * @since   JDK1.1
      * @see #getAddress()
      */
@@ -303,7 +303,7 @@
      * Sets the SocketAddress (usually IP address + port number) of the remote
      * host to which this datagram is being sent.
      *
-     * @param address the <code>SocketAddress</code>
+     * @param address the {@code SocketAddress}
      * @throws  IllegalArgumentException if address is null or is a
      *          SocketAddress subclass not supported by this socket
      *
@@ -324,7 +324,7 @@
      * Gets the SocketAddress (usually IP address + port number) of the remote
      * host that this packet is being sent to or is coming from.
      *
-     * @return the <code>SocketAddress</code>
+     * @return the {@code SocketAddress}
      * @since 1.4
      * @see #setSocketAddress
      */
@@ -335,7 +335,7 @@
     /**
      * Set the data buffer for this packet. With the offset of
      * this DatagramPacket set to 0, and the length set to
-     * the length of <code>buf</code>.
+     * the length of {@code buf}.
      *
      * @param buf the buffer to set for this packet.
      *
--- a/jdk/src/share/classes/java/net/DatagramSocket.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/DatagramSocket.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,14 +47,14 @@
  * a DatagramSocket is bound to a more specific address.
  * <p>
  * Example:
- * <code>
+ * {@code
  *              DatagramSocket s = new DatagramSocket(null);
  *              s.bind(new InetSocketAddress(8888));
- * </code>
+ * }
  * Which is equivalent to:
- * <code>
+ * {@code
  *              DatagramSocket s = new DatagramSocket(8888);
- * </code>
+ * }
  * Both cases will create a DatagramSocket able to receive broadcasts on
  * UDP port 8888.
  *
@@ -161,14 +161,14 @@
      * an IP address chosen by the kernel.
      *
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
+     * its {@code checkListen} method is first called
      * with 0 as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
      * @exception  SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
      */
@@ -195,21 +195,21 @@
      * Creates a datagram socket, bound to the specified local
      * socket address.
      * <p>
-     * If, if the address is <code>null</code>, creates an unbound socket.
+     * If, if the address is {@code null}, creates an unbound socket.
      * <p>
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
+     * its {@code checkListen} method is first called
      * with the port from the socket address
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
-     * @param bindaddr local socket address to bind, or <code>null</code>
+     * @param bindaddr local socket address to bind, or {@code null}
      *                 for an unbound socket.
      *
      * @exception  SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
      * @since   1.4
@@ -234,8 +234,8 @@
      * an IP address chosen by the kernel.
      *
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
-     * with the <code>port</code> argument
+     * its {@code checkListen} method is first called
+     * with the {@code port} argument
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
@@ -243,7 +243,7 @@
      * @exception  SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
      */
@@ -259,8 +259,8 @@
      * an IP address chosen by the kernel.
      *
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
-     * with the <code>port</code> argument
+     * its {@code checkListen} method is first called
+     * with the {@code port} argument
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
@@ -270,7 +270,7 @@
      * @exception  SocketException  if the socket could not be opened,
      *               or the socket could not bind to the specified local port.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      *
      * @see SecurityManager#checkListen
      * @since   JDK1.1
@@ -319,10 +319,10 @@
     }
 
     /**
-     * Get the <code>DatagramSocketImpl</code> attached to this socket,
+     * Get the {@code DatagramSocketImpl} attached to this socket,
      * creating it if necessary.
      *
-     * @return  the <code>DatagramSocketImpl</code> attached to that
+     * @return  the {@code DatagramSocketImpl} attached to that
      *          DatagramSocket
      * @throws SocketException if creation fails.
      * @since 1.4
@@ -336,14 +336,14 @@
     /**
      * Binds this DatagramSocket to a specific address and port.
      * <p>
-     * If the address is <code>null</code>, then the system will pick up
+     * If the address is {@code null}, then the system will pick up
      * an ephemeral port and a valid local address to bind the socket.
      *<p>
      * @param   addr The address and port to bind to.
      * @throws  SocketException if any error happens during the bind, or if the
      *          socket is already bound.
      * @throws  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      * @throws IllegalArgumentException if addr is a SocketAddress subclass
      *         not supported by this socket.
      * @since 1.4
@@ -496,7 +496,7 @@
      * Returns the binding state of the socket.
      * <p>
      * If the socket was bound prior to being {@link #close closed},
-     * then this method will continue to return <code>true</code>
+     * then this method will continue to return {@code true}
      * after the socket is closed.
      *
      * @return true if the socket successfully bound to an address
@@ -510,7 +510,7 @@
      * Returns the connection state of the socket.
      * <p>
      * If the socket was connected prior to being {@link #close closed},
-     * then this method will continue to return <code>true</code>
+     * then this method will continue to return {@code true}
      * after the socket is closed.
      *
      * @return true if the socket successfully connected to a server
@@ -522,7 +522,7 @@
 
     /**
      * Returns the address to which this socket is connected. Returns
-     * <code>null</code> if the socket is not connected.
+     * {@code null} if the socket is not connected.
      * <p>
      * If the socket was connected prior to being {@link #close closed},
      * then this method will continue to return the connected address
@@ -536,7 +536,7 @@
 
     /**
      * Returns the port number to which this socket is connected.
-     * Returns <code>-1</code> if the socket is not connected.
+     * Returns {@code -1} if the socket is not connected.
      * <p>
      * If the socket was connected prior to being {@link #close closed},
      * then this method will continue to return the connected port number
@@ -550,14 +550,14 @@
 
     /**
      * Returns the address of the endpoint this socket is connected to, or
-     * <code>null</code> if it is unconnected.
+     * {@code null} if it is unconnected.
      * <p>
      * If the socket was connected prior to being {@link #close closed},
      * then this method will continue to return the connected address
      * after the socket is closed.
      *
-     * @return a <code>SocketAddress</code> representing the remote
-     *         endpoint of this socket, or <code>null</code> if it is
+     * @return a {@code SocketAddress} representing the remote
+     *         endpoint of this socket, or {@code null} if it is
      *         not connected yet.
      * @see #getInetAddress()
      * @see #getPort()
@@ -573,8 +573,8 @@
     /**
      * Returns the address of the endpoint this socket is bound to.
      *
-     * @return a <code>SocketAddress</code> representing the local endpoint of this
-     *         socket, or <code>null</code> if it is closed or not bound yet.
+     * @return a {@code SocketAddress} representing the local endpoint of this
+     *         socket, or {@code null} if it is closed or not bound yet.
      * @see #getLocalAddress()
      * @see #getLocalPort()
      * @see #bind(SocketAddress)
@@ -591,28 +591,28 @@
 
     /**
      * Sends a datagram packet from this socket. The
-     * <code>DatagramPacket</code> includes information indicating the
+     * {@code DatagramPacket} includes information indicating the
      * data to be sent, its length, the IP address of the remote host,
      * and the port number on the remote host.
      *
      * <p>If there is a security manager, and the socket is not currently
      * connected to a remote address, this method first performs some
-     * security checks. First, if <code>p.getAddress().isMulticastAddress()</code>
+     * security checks. First, if {@code p.getAddress().isMulticastAddress()}
      * is true, this method calls the
-     * security manager's <code>checkMulticast</code> method
-     * with <code>p.getAddress()</code> as its argument.
+     * security manager's {@code checkMulticast} method
+     * with {@code p.getAddress()} as its argument.
      * If the evaluation of that expression is false,
      * this method instead calls the security manager's
-     * <code>checkConnect</code> method with arguments
-     * <code>p.getAddress().getHostAddress()</code> and
-     * <code>p.getPort()</code>. Each call to a security manager method
+     * {@code checkConnect} method with arguments
+     * {@code p.getAddress().getHostAddress()} and
+     * {@code p.getPort()}. Each call to a security manager method
      * could result in a SecurityException if the operation is not allowed.
      *
-     * @param      p   the <code>DatagramPacket</code> to be sent.
+     * @param      p   the {@code DatagramPacket} to be sent.
      *
      * @exception  IOException  if an I/O error occurs.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkMulticast</code> or <code>checkConnect</code>
+     *             {@code checkMulticast} or {@code checkConnect}
      *             method doesn't allow the send.
      * @exception  PortUnreachableException may be thrown if the socket is connected
      *             to a currently unreachable destination. Note, there is no
@@ -674,20 +674,20 @@
 
     /**
      * Receives a datagram packet from this socket. When this method
-     * returns, the <code>DatagramPacket</code>'s buffer is filled with
+     * returns, the {@code DatagramPacket}'s buffer is filled with
      * the data received. The datagram packet also contains the sender's
      * IP address, and the port number on the sender's machine.
      * <p>
      * This method blocks until a datagram is received. The
-     * <code>length</code> field of the datagram packet object contains
+     * {@code length} field of the datagram packet object contains
      * the length of the received message. If the message is longer than
      * the packet's length, the message is truncated.
      * <p>
      * If there is a security manager, a packet cannot be received if the
-     * security manager's <code>checkAccept</code> method
+     * security manager's {@code checkAccept} method
      * does not allow it.
      *
-     * @param      p   the <code>DatagramPacket</code> into which to place
+     * @param      p   the {@code DatagramPacket} into which to place
      *                 the incoming data.
      * @exception  IOException  if an I/O error occurs.
      * @exception  SocketTimeoutException  if setSoTimeout was previously called
@@ -786,17 +786,17 @@
      * Gets the local address to which the socket is bound.
      *
      * <p>If there is a security manager, its
-     * <code>checkConnect</code> method is first called
-     * with the host address and <code>-1</code>
+     * {@code checkConnect} method is first called
+     * with the host address and {@code -1}
      * as its arguments to see if the operation is allowed.
      *
      * @see SecurityManager#checkConnect
      * @return  the local address to which the socket is bound,
-     *          <code>null</code> if the socket is closed, or
-     *          an <code>InetAddress</code> representing
+     *          {@code null} if the socket is closed, or
+     *          an {@code InetAddress} representing
      *          {@link InetAddress#isAnyLocalAddress wildcard}
      *          address if either the socket is not bound, or
-     *          the security manager <code>checkConnect</code>
+     *          the security manager {@code checkConnect}
      *          method does not allow the operation
      * @since   1.1
      */
@@ -824,8 +824,8 @@
      * is bound.
      *
      * @return  the port number on the local host to which this socket is bound,
-                <code>-1</code> if the socket is closed, or
-                <code>0</code> if it is not bound yet.
+                {@code -1} if the socket is closed, or
+                {@code 0} if it is not bound yet.
      */
     public int getLocalPort() {
         if (isClosed())
@@ -883,7 +883,7 @@
 
     /**
      * Sets the SO_SNDBUF option to the specified value for this
-     * <tt>DatagramSocket</tt>. The SO_SNDBUF option is used by the
+     * {@code DatagramSocket}. The SO_SNDBUF option is used by the
      * network implementation as a hint to size the underlying
      * network I/O buffers. The SO_SNDBUF setting may also be used
      * by the network implementation to determine the maximum size
@@ -897,7 +897,7 @@
      * is high.
      * <p>
      * Note: If {@link #send(DatagramPacket)} is used to send a
-     * <code>DatagramPacket</code> that is larger than the setting
+     * {@code DatagramPacket} that is larger than the setting
      * of SO_SNDBUF then it is implementation specific if the
      * packet is sent or discarded.
      *
@@ -921,10 +921,10 @@
     }
 
     /**
-     * Get value of the SO_SNDBUF option for this <tt>DatagramSocket</tt>, that is the
-     * buffer size used by the platform for output on this <tt>DatagramSocket</tt>.
+     * Get value of the SO_SNDBUF option for this {@code DatagramSocket}, that is the
+     * buffer size used by the platform for output on this {@code DatagramSocket}.
      *
-     * @return the value of the SO_SNDBUF option for this <tt>DatagramSocket</tt>
+     * @return the value of the SO_SNDBUF option for this {@code DatagramSocket}
      * @exception SocketException if there is an error in
      * the underlying protocol, such as an UDP error.
      * @see #setSendBufferSize
@@ -942,7 +942,7 @@
 
     /**
      * Sets the SO_RCVBUF option to the specified value for this
-     * <tt>DatagramSocket</tt>. The SO_RCVBUF option is used by the
+     * {@code DatagramSocket}. The SO_RCVBUF option is used by the
      * the network implementation as a hint to size the underlying
      * network I/O buffers. The SO_RCVBUF setting may also be used
      * by the network implementation to determine the maximum size
@@ -979,10 +979,10 @@
     }
 
     /**
-     * Get value of the SO_RCVBUF option for this <tt>DatagramSocket</tt>, that is the
-     * buffer size used by the platform for input on this <tt>DatagramSocket</tt>.
+     * Get value of the SO_RCVBUF option for this {@code DatagramSocket}, that is the
+     * buffer size used by the platform for input on this {@code DatagramSocket}.
      *
-     * @return the value of the SO_RCVBUF option for this <tt>DatagramSocket</tt>
+     * @return the value of the SO_RCVBUF option for this {@code DatagramSocket}
      * @exception SocketException if there is an error in the underlying protocol, such as an UDP error.
      * @see #setReceiveBufferSize(int)
      */
@@ -1005,26 +1005,26 @@
      * socket to the same socket address. This is typically for the
      * purpose of receiving multicast packets
      * (See {@link java.net.MulticastSocket}). The
-     * <tt>SO_REUSEADDR</tt> socket option allows multiple
+     * {@code SO_REUSEADDR} socket option allows multiple
      * sockets to be bound to the same socket address if the
-     * <tt>SO_REUSEADDR</tt> socket option is enabled prior
+     * {@code SO_REUSEADDR} socket option is enabled prior
      * to binding the socket using {@link #bind(SocketAddress)}.
      * <p>
      * Note: This functionality is not supported by all existing platforms,
      * so it is implementation specific whether this option will be ignored
      * or not. However, if it is not supported then
-     * {@link #getReuseAddress()} will always return <code>false</code>.
+     * {@link #getReuseAddress()} will always return {@code false}.
      * <p>
-     * When a <tt>DatagramSocket</tt> is created the initial setting
-     * of <tt>SO_REUSEADDR</tt> is disabled.
+     * When a {@code DatagramSocket} is created the initial setting
+     * of {@code SO_REUSEADDR} is disabled.
      * <p>
-     * The behaviour when <tt>SO_REUSEADDR</tt> is enabled or
+     * The behaviour when {@code SO_REUSEADDR} is enabled or
      * disabled after a socket is bound (See {@link #isBound()})
      * is not defined.
      *
      * @param on  whether to enable or disable the
      * @exception SocketException if an error occurs enabling or
-     *            disabling the <tt>SO_RESUEADDR</tt> socket option,
+     *            disabling the {@code SO_RESUEADDR} socket option,
      *            or the socket is closed.
      * @since 1.4
      * @see #getReuseAddress()
@@ -1045,7 +1045,7 @@
     /**
      * Tests if SO_REUSEADDR is enabled.
      *
-     * @return a <code>boolean</code> indicating whether or not SO_REUSEADDR is enabled.
+     * @return a {@code boolean} indicating whether or not SO_REUSEADDR is enabled.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as an UDP error.
      * @since   1.4
@@ -1083,7 +1083,7 @@
 
     /**
      * Tests if SO_BROADCAST is enabled.
-     * @return a <code>boolean</code> indicating whether or not SO_BROADCAST is enabled.
+     * @return a {@code boolean} indicating whether or not SO_BROADCAST is enabled.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as an UDP error.
      * @since 1.4
@@ -1105,7 +1105,7 @@
      * 255} or an IllegalArgumentException will be thrown.
      * <p>Notes:
      * <p>For Internet Protocol v4 the value consists of an
-     * <code>integer</code>, the least significant 8 bits of which
+     * {@code integer}, the least significant 8 bits of which
      * represent the value of the TOS octet in IP packets sent by
      * the socket.
      * RFC 1349 defines the TOS values as follows:
@@ -1123,10 +1123,10 @@
      * SocketException indicating that the operation is not
      * permitted.
      * <p>
-     * for Internet Protocol v6 <code>tc</code> is the value that
+     * for Internet Protocol v6 {@code tc} is the value that
      * would be placed into the sin6_flowinfo field of the IP header.
      *
-     * @param tc        an <code>int</code> value for the bitset.
+     * @param tc        an {@code int} value for the bitset.
      * @throws SocketException if there is an error setting the
      * traffic class or type-of-service
      * @since 1.4
@@ -1205,7 +1205,7 @@
      * DatagramChannel.open} method.
      *
      * @return  the datagram channel associated with this datagram socket,
-     *          or <tt>null</tt> if this socket was not created for a channel
+     *          or {@code null} if this socket was not created for a channel
      *
      * @since 1.4
      * @spec JSR-51
@@ -1224,14 +1224,14 @@
      * application. The factory can be specified only once.
      * <p>
      * When an application creates a new datagram socket, the socket
-     * implementation factory's <code>createDatagramSocketImpl</code> method is
+     * implementation factory's {@code createDatagramSocketImpl} method is
      * called to create the actual datagram socket implementation.
      * <p>
-     * Passing <code>null</code> to the method is a no-op unless the factory
+     * Passing {@code null} to the method is a no-op unless the factory
      * was already set.
      *
      * <p>If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
@@ -1240,7 +1240,7 @@
      *              datagram socket factory.
      * @exception  SocketException  if the factory is already defined.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't allow the
+     *             {@code checkSetFactory} method doesn't allow the
      operation.
      * @see
      java.net.DatagramSocketImplFactory#createDatagramSocketImpl()
--- a/jdk/src/share/classes/java/net/DatagramSocketImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/DatagramSocketImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,7 +101,7 @@
     protected void disconnect() {}
 
     /**
-     * Peek at the packet to see who it is from. Updates the specified <code>InetAddress</code>
+     * Peek at the packet to see who it is from. Updates the specified {@code InetAddress}
      * to the address which the packet came from.
      * @param i an InetAddress object
      * @return the port number which the packet came from.
@@ -114,7 +114,7 @@
 
     /**
      * Peek at the packet to see who it is from. The data is copied into the specified
-     * <code>DatagramPacket</code>. The data is returned,
+     * {@code DatagramPacket}. The data is returned,
      * but not consumed, so that a subsequent peekData/receive operation
      * will see the same data.
      * @param p the Packet Received.
@@ -163,7 +163,7 @@
 
     /**
      * Set the TTL (time-to-live) option.
-     * @param ttl an <tt>int</tt> specifying the time-to-live value
+     * @param ttl an {@code int} specifying the time-to-live value
      * @exception IOException if an I/O exception occurs
      * while setting the time-to-live option.
      * @see #getTimeToLive()
@@ -174,7 +174,7 @@
      * Retrieve the TTL (time-to-live) option.
      * @exception IOException if an I/O exception occurs
      * while retrieving the time-to-live option
-     * @return an <tt>int</tt> representing the time-to-live value
+     * @return an {@code int} representing the time-to-live value
      * @see #setTimeToLive(int)
      */
     protected abstract int getTimeToLive() throws IOException;
@@ -227,7 +227,7 @@
 
     /**
      * Gets the local port.
-     * @return an <tt>int</tt> representing the local port value
+     * @return an {@code int} representing the local port value
      */
     protected int getLocalPort() {
         return localPort;
@@ -235,7 +235,7 @@
 
     /**
      * Gets the datagram socket file descriptor.
-     * @return a <tt>FileDescriptor</tt> object representing the datagram socket
+     * @return a {@code FileDescriptor} object representing the datagram socket
      * file descriptor
      */
     protected FileDescriptor getFileDescriptor() {
--- a/jdk/src/share/classes/java/net/DatagramSocketImplFactory.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/DatagramSocketImplFactory.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 
 /**
  * This interface defines a factory for datagram socket implementations. It
- * is used by the classes <code>DatagramSocket</code> to create actual socket
+ * is used by the classes {@code DatagramSocket} to create actual socket
  * implementations.
  *
  * @author  Yingxian Wang
@@ -37,9 +37,9 @@
 public
 interface DatagramSocketImplFactory {
     /**
-     * Creates a new <code>DatagramSocketImpl</code> instance.
+     * Creates a new {@code DatagramSocketImpl} instance.
      *
-     * @return  a new instance of <code>DatagramSocketImpl</code>.
+     * @return  a new instance of {@code DatagramSocketImpl}.
      * @see     java.net.DatagramSocketImpl
      */
     DatagramSocketImpl createDatagramSocketImpl();
--- a/jdk/src/share/classes/java/net/FileNameMap.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/FileNameMap.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
     /**
      * Gets the MIME type for the specified file name.
      * @param fileName the specified file name
-     * @return a <code>String</code> indicating the MIME
+     * @return a {@code String} indicating the MIME
      * type for the specified file name.
      */
     public String getContentTypeFor(String fileName);
--- a/jdk/src/share/classes/java/net/HttpCookie.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/HttpCookie.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -470,7 +470,7 @@
      * protocol.
      *
      * @return  {@code false} if the cookie can be sent over any standard
-     *          protocol; otherwise, <code>true</code>
+     *          protocol; otherwise, {@code true}
      *
      * @see  #setSecure
      */
--- a/jdk/src/share/classes/java/net/HttpRetryException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/HttpRetryException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
     private String location;
 
     /**
-     * Constructs a new <code>HttpRetryException</code> from the
+     * Constructs a new {@code HttpRetryException} from the
      * specified response code and exception detail message
      *
      * @param   detail   the detail message.
@@ -55,7 +55,7 @@
     }
 
     /**
-     * Constructs a new <code>HttpRetryException</code> with detail message
+     * Constructs a new {@code HttpRetryException} with detail message
      * responseCode and the contents of the Location response header field.
      *
      * @param   detail   the detail message.
--- a/jdk/src/share/classes/java/net/HttpURLConnection.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/HttpURLConnection.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,14 +76,14 @@
 
     /**
      * The chunk-length when using chunked encoding streaming mode for output.
-     * A value of <code>-1</code> means chunked encoding is disabled for output.
+     * A value of {@code -1} means chunked encoding is disabled for output.
      * @since 1.5
      */
     protected int chunkLength = -1;
 
     /**
      * The fixed content-length when using fixed-length streaming mode.
-     * A value of <code>-1</code> means fixed-length streaming mode is disabled
+     * A value of {@code -1} means fixed-length streaming mode is disabled
      * for output.
      *
      * <P> <B>NOTE:</B> {@link #fixedContentLengthLong} is recommended instead
@@ -103,15 +103,15 @@
     protected long fixedContentLengthLong = -1;
 
     /**
-     * Returns the key for the <code>n</code><sup>th</sup> header field.
-     * Some implementations may treat the <code>0</code><sup>th</sup>
+     * Returns the key for the {@code n}<sup>th</sup> header field.
+     * Some implementations may treat the {@code 0}<sup>th</sup>
      * header field as special, i.e. as the status line returned by the HTTP
      * server. In this case, {@link #getHeaderField(int) getHeaderField(0)} returns the status
-     * line, but <code>getHeaderFieldKey(0)</code> returns null.
+     * line, but {@code getHeaderFieldKey(0)} returns null.
      *
      * @param   n   an index, where {@code n >=0}.
-     * @return  the key for the <code>n</code><sup>th</sup> header field,
-     *          or <code>null</code> if the key does not exist.
+     * @return  the key for the {@code n}<sup>th</sup> header field,
+     *          or {@code null} if the key does not exist.
      */
     public String getHeaderFieldKey (int n) {
         return null;
@@ -251,8 +251,8 @@
     }
 
     /**
-     * Returns the value for the <code>n</code><sup>th</sup> header field.
-     * Some implementations may treat the <code>0</code><sup>th</sup>
+     * Returns the value for the {@code n}<sup>th</sup> header field.
+     * Some implementations may treat the {@code 0}<sup>th</sup>
      * header field as special, i.e. as the status line returned by the HTTP
      * server.
      * <p>
@@ -261,8 +261,8 @@
      * the headers in the message.
      *
      * @param   n   an index, where {@code n>=0}.
-     * @return  the value of the <code>n</code><sup>th</sup> header field,
-     *          or <code>null</code> if the value does not exist.
+     * @return  the value of the {@code n}<sup>th</sup> header field,
+     *          or {@code null} if the value does not exist.
      * @see     java.net.HttpURLConnection#getHeaderFieldKey(int)
      */
     public String getHeaderField(int n) {
@@ -270,7 +270,7 @@
     }
 
     /**
-     * An <code>int</code> representing the three digit HTTP Status-Code.
+     * An {@code int} representing the three digit HTTP Status-Code.
      * <ul>
      * <li> 1xx: Informational
      * <li> 2xx: Success
@@ -292,12 +292,12 @@
     private static boolean followRedirects = true;
 
     /**
-     * If <code>true</code>, the protocol will automatically follow redirects.
-     * If <code>false</code>, the protocol will not automatically follow
+     * If {@code true}, the protocol will automatically follow redirects.
+     * If {@code false}, the protocol will not automatically follow
      * redirects.
      * <p>
-     * This field is set by the <code>setInstanceFollowRedirects</code>
-     * method. Its value is returned by the <code>getInstanceFollowRedirects</code>
+     * This field is set by the {@code setInstanceFollowRedirects}
+     * method. Its value is returned by the {@code getInstanceFollowRedirects}
      * method.
      * <p>
      * Its default value is based on the value of the static followRedirects
@@ -328,14 +328,14 @@
      * cannot change this variable.
      * <p>
      * If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
-     * @param set a <code>boolean</code> indicating whether or not
+     * @param set a {@code boolean} indicating whether or not
      * to follow HTTP redirects.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't
+     *             {@code checkSetFactory} method doesn't
      *             allow the operation.
      * @see        SecurityManager#checkSetFactory
      * @see #getFollowRedirects()
@@ -350,12 +350,12 @@
     }
 
     /**
-     * Returns a <code>boolean</code> indicating
+     * Returns a {@code boolean} indicating
      * whether or not HTTP redirects (3xx) should
      * be automatically followed.
      *
-     * @return <code>true</code> if HTTP redirects should
-     * be automatically followed, <tt>false</tt> if not.
+     * @return {@code true} if HTTP redirects should
+     * be automatically followed, {@code false} if not.
      * @see #setFollowRedirects(boolean)
      */
     public static boolean getFollowRedirects() {
@@ -364,13 +364,13 @@
 
     /**
      * Sets whether HTTP redirects (requests with response code 3xx) should
-     * be automatically followed by this <code>HttpURLConnection</code>
+     * be automatically followed by this {@code HttpURLConnection}
      * instance.
      * <p>
      * The default value comes from followRedirects, which defaults to
      * true.
      *
-     * @param followRedirects a <code>boolean</code> indicating
+     * @param followRedirects a {@code boolean} indicating
      * whether or not to follow HTTP redirects.
      *
      * @see    java.net.HttpURLConnection#instanceFollowRedirects
@@ -382,11 +382,11 @@
      }
 
      /**
-     * Returns the value of this <code>HttpURLConnection</code>'s
-     * <code>instanceFollowRedirects</code> field.
+     * Returns the value of this {@code HttpURLConnection}'s
+     * {@code instanceFollowRedirects} field.
      *
-     * @return  the value of this <code>HttpURLConnection</code>'s
-     *          <code>instanceFollowRedirects</code> field.
+     * @return  the value of this {@code HttpURLConnection}'s
+     *          {@code instanceFollowRedirects} field.
      * @see     java.net.HttpURLConnection#instanceFollowRedirects
      * @see #setInstanceFollowRedirects(boolean)
      * @since 1.3
@@ -540,7 +540,7 @@
      * Returns null if none could be discerned from the responses
      * (the result was not valid HTTP).
      * @throws IOException if an error occurred connecting to the server.
-     * @return the HTTP response message, or <code>null</code>
+     * @return the HTTP response message, or {@code null}
      */
     public String getResponseMessage() throws IOException {
         getResponseCode();
@@ -583,7 +583,7 @@
      * @exception IOException if an error occurs while computing
      *            the permission.
      *
-     * @return a <code>SocketPermission</code> object representing the
+     * @return a {@code SocketPermission} object representing the
      *         permission necessary to connect to the destination
      *         host and port.
      */
--- a/jdk/src/share/classes/java/net/IDN.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/IDN.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,7 +104,7 @@
      * @param input     the string to be processed
      * @param flag      process flag; can be 0 or any logical OR of possible flags
      *
-     * @return          the translated <tt>String</tt>
+     * @return          the translated {@code String}
      *
      * @throws IllegalArgumentException   if the input string doesn't conform to RFC 3490 specification
      */
@@ -130,13 +130,13 @@
      *
      * <p> This convenience method works as if by invoking the
      * two-argument counterpart as follows:
-     * <blockquote><tt>
+     * <blockquote>
      * {@link #toASCII(String, int) toASCII}(input,&nbsp;0);
-     * </tt></blockquote>
+     * </blockquote>
      *
      * @param input     the string to be processed
      *
-     * @return          the translated <tt>String</tt>
+     * @return          the translated {@code String}
      *
      * @throws IllegalArgumentException   if the input string doesn't conform to RFC 3490 specification
      */
@@ -161,7 +161,7 @@
      * @param input     the string to be processed
      * @param flag      process flag; can be 0 or any logical OR of possible flags
      *
-     * @return          the translated <tt>String</tt>
+     * @return          the translated {@code String}
      */
     public static String toUnicode(String input, int flag) {
         int p = 0, q = 0;
@@ -184,13 +184,13 @@
      *
      * <p> This convenience method works as if by invoking the
      * two-argument counterpart as follows:
-     * <blockquote><tt>
+     * <blockquote>
      * {@link #toUnicode(String, int) toUnicode}(input,&nbsp;0);
-     * </tt></blockquote>
+     * </blockquote>
      *
      * @param input     the string to be processed
      *
-     * @return          the translated <tt>String</tt>
+     * @return          the translated {@code String}
      */
     public static String toUnicode(String input) {
         return toUnicode(input, 0);
--- a/jdk/src/share/classes/java/net/Inet4Address.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/Inet4Address.java	Tue Aug 06 16:54:56 2013 -0700
@@ -42,10 +42,10 @@
  * takes one of the following forms:
  *
  * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- * <tr><td><tt>d.d.d.d</tt></td></tr>
- * <tr><td><tt>d.d.d</tt></td></tr>
- * <tr><td><tt>d.d</tt></td></tr>
- * <tr><td><tt>d</tt></td></tr>
+ * <tr><td>{@code d.d.d.d}</td></tr>
+ * <tr><td>{@code d.d.d}</td></tr>
+ * <tr><td>{@code d.d}</td></tr>
+ * <tr><td>{@code d}</td></tr>
  * </table></blockquote>
  *
  * <p> When four parts are specified, each is interpreted as a byte of
@@ -153,7 +153,7 @@
      * Utility routine to check if the InetAddress is an
      * IP multicast address. IP multicast address is a Class D
      * address i.e first four bits of the address are 1110.
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * an IP multicast address
      * @since   JDK1.1
      */
@@ -163,7 +163,7 @@
 
     /**
      * Utility routine to check if the InetAddress in a wildcard address.
-     * @return a <code>boolean</code> indicating if the Inetaddress is
+     * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
      */
@@ -174,7 +174,7 @@
     /**
      * Utility routine to check if the InetAddress is a loopback address.
      *
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * a loopback address; or false otherwise.
      * @since 1.4
      */
@@ -187,7 +187,7 @@
     /**
      * Utility routine to check if the InetAddress is an link local address.
      *
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * a link local address; or false if address is not a link local unicast address.
      * @since 1.4
      */
@@ -204,7 +204,7 @@
     /**
      * Utility routine to check if the InetAddress is a site local address.
      *
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * a site local address; or false if address is not a site local unicast address.
      * @since 1.4
      */
@@ -224,7 +224,7 @@
     /**
      * Utility routine to check if the multicast address has global scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of global scope, false if it is not
      *         of global scope or it is not a multicast address
      * @since 1.4
@@ -240,7 +240,7 @@
     /**
      * Utility routine to check if the multicast address has node scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of node-local scope, false if it is not
      *         of node-local scope or it is not a multicast address
      * @since 1.4
@@ -253,7 +253,7 @@
     /**
      * Utility routine to check if the multicast address has link scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of link-local scope, false if it is not
      *         of link-local scope or it is not a multicast address
      * @since 1.4
@@ -269,7 +269,7 @@
     /**
      * Utility routine to check if the multicast address has site scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of site-local scope, false if it is not
      *         of site-local scope or it is not a multicast address
      * @since 1.4
@@ -284,7 +284,7 @@
     /**
      * Utility routine to check if the multicast address has organization scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of organization-local scope,
      *         false if it is not of organization-local scope
      *         or it is not a multicast address
@@ -299,9 +299,9 @@
     }
 
     /**
-     * Returns the raw IP address of this <code>InetAddress</code>
+     * Returns the raw IP address of this {@code InetAddress}
      * object. The result is in network byte order: the highest order
-     * byte of the address is in <code>getAddress()[0]</code>.
+     * byte of the address is in {@code getAddress()[0]}.
      *
      * @return  the raw IP address of this object.
      */
@@ -337,18 +337,18 @@
 
     /**
      * Compares this object against the specified object.
-     * The result is <code>true</code> if and only if the argument is
-     * not <code>null</code> and it represents the same IP address as
+     * The result is {@code true} if and only if the argument is
+     * not {@code null} and it represents the same IP address as
      * this object.
      * <p>
-     * Two instances of <code>InetAddress</code> represent the same IP
+     * Two instances of {@code InetAddress} represent the same IP
      * address if the length of the byte arrays returned by
-     * <code>getAddress</code> is the same for both, and each of the
+     * {@code getAddress} is the same for both, and each of the
      * array components is the same for the byte arrays.
      *
      * @param   obj   the object to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      * @see     java.net.InetAddress#getAddress()
      */
     public boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/net/Inet6Address.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/Inet6Address.java	Tue Aug 06 16:54:56 2013 -0700
@@ -47,7 +47,7 @@
  *   address. This is the full form.  For example,
  *
  *   <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- *   <tr><td><tt>1080:0:0:0:8:800:200C:417A</tt><td></tr>
+ *   <tr><td>{@code 1080:0:0:0:8:800:200C:417A}<td></tr>
  *   </table></blockquote>
  *
  *   <p> Note that it is not necessary to write the leading zeros in
@@ -64,7 +64,7 @@
  *   zeros in an address. For example,
  *
  *   <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- *   <tr><td><tt>1080::8:800:200C:417A</tt><td></tr>
+ *   <tr><td>{@code 1080::8:800:200C:417A}<td></tr>
  *   </table></blockquote>
  *
  *   <li><p> An alternative form that is sometimes more convenient
@@ -75,8 +75,8 @@
  *   standard IPv4 representation address, for example,
  *
  *   <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- *   <tr><td><tt>::FFFF:129.144.52.38</tt><td></tr>
- *   <tr><td><tt>::129.144.52.38</tt><td></tr>
+ *   <tr><td>{@code ::FFFF:129.144.52.38}<td></tr>
+ *   <tr><td>{@code ::129.144.52.38}<td></tr>
  *   </table></blockquote>
  *
  *   <p> where "::FFFF:d.d.d.d" and "::d.d.d.d" are, respectively, the
@@ -85,23 +85,23 @@
  *   in the "d.d.d.d" form. The following forms are invalid:
  *
  *   <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- *   <tr><td><tt>::FFFF:d.d.d</tt><td></tr>
- *   <tr><td><tt>::FFFF:d.d</tt><td></tr>
- *   <tr><td><tt>::d.d.d</tt><td></tr>
- *   <tr><td><tt>::d.d</tt><td></tr>
+ *   <tr><td>{@code ::FFFF:d.d.d}<td></tr>
+ *   <tr><td>{@code ::FFFF:d.d}<td></tr>
+ *   <tr><td>{@code ::d.d.d}<td></tr>
+ *   <tr><td>{@code ::d.d}<td></tr>
  *   </table></blockquote>
  *
  *   <p> The following form:
  *
  *   <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- *   <tr><td><tt>::FFFF:d</tt><td></tr>
+ *   <tr><td>{@code ::FFFF:d}<td></tr>
  *   </table></blockquote>
  *
  *   <p> is valid, however it is an unconventional representation of
  *   the IPv4-compatible IPv6 address,
  *
  *   <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- *   <tr><td><tt>::255.255.0.d</tt><td></tr>
+ *   <tr><td>{@code ::255.255.0.d}<td></tr>
  *   </table></blockquote>
  *
  *   <p> while "::d" corresponds to the general IPv6 address
@@ -258,7 +258,7 @@
      * Create an Inet6Address in the exact manner of {@link
      * InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is
      * set to the value corresponding to the given interface for the address
-     * type specified in <code>addr</code>. The call will fail with an
+     * type specified in {@code addr}. The call will fail with an
      * UnknownHostException if the given interface does not have a numeric
      * scope_id assigned for the given address type (eg. link-local or site-local).
      * See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
--- a/jdk/src/share/classes/java/net/InetAddress.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/InetAddress.java	Tue Aug 06 16:54:56 2013 -0700
@@ -296,7 +296,7 @@
     /**
      * Utility routine to check if the InetAddress is an
      * IP multicast address.
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * an IP multicast address
      * @since   JDK1.1
      */
@@ -306,7 +306,7 @@
 
     /**
      * Utility routine to check if the InetAddress in a wildcard address.
-     * @return a <code>boolean</code> indicating if the Inetaddress is
+     * @return a {@code boolean} indicating if the Inetaddress is
      *         a wildcard address.
      * @since 1.4
      */
@@ -317,7 +317,7 @@
     /**
      * Utility routine to check if the InetAddress is a loopback address.
      *
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * a loopback address; or false otherwise.
      * @since 1.4
      */
@@ -328,7 +328,7 @@
     /**
      * Utility routine to check if the InetAddress is an link local address.
      *
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * a link local address; or false if address is not a link local unicast address.
      * @since 1.4
      */
@@ -339,7 +339,7 @@
     /**
      * Utility routine to check if the InetAddress is a site local address.
      *
-     * @return a <code>boolean</code> indicating if the InetAddress is
+     * @return a {@code boolean} indicating if the InetAddress is
      * a site local address; or false if address is not a site local unicast address.
      * @since 1.4
      */
@@ -350,7 +350,7 @@
     /**
      * Utility routine to check if the multicast address has global scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of global scope, false if it is not
      *         of global scope or it is not a multicast address
      * @since 1.4
@@ -362,7 +362,7 @@
     /**
      * Utility routine to check if the multicast address has node scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of node-local scope, false if it is not
      *         of node-local scope or it is not a multicast address
      * @since 1.4
@@ -374,7 +374,7 @@
     /**
      * Utility routine to check if the multicast address has link scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of link-local scope, false if it is not
      *         of link-local scope or it is not a multicast address
      * @since 1.4
@@ -386,7 +386,7 @@
     /**
      * Utility routine to check if the multicast address has site scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of site-local scope, false if it is not
      *         of site-local scope or it is not a multicast address
      * @since 1.4
@@ -398,7 +398,7 @@
     /**
      * Utility routine to check if the multicast address has organization scope.
      *
-     * @return a <code>boolean</code> indicating if the address has
+     * @return a {@code boolean} indicating if the address has
      *         is a multicast address of organization-local scope,
      *         false if it is not of organization-local scope
      *         or it is not a multicast address
@@ -424,9 +424,9 @@
      * in an IllegalArgumentException being thrown.
      *
      * @param   timeout the time, in milliseconds, before the call aborts
-     * @return a <code>boolean</code> indicating if the address is reachable.
+     * @return a {@code boolean} indicating if the address is reachable.
      * @throws IOException if a network error occurs
-     * @throws  IllegalArgumentException if <code>timeout</code> is negative.
+     * @throws  IllegalArgumentException if {@code timeout} is negative.
      * @since 1.5
      */
     public boolean isReachable(int timeout) throws IOException {
@@ -442,10 +442,10 @@
      * privilege can be obtained, otherwise it will try to establish
      * a TCP connection on port 7 (Echo) of the destination host.
      * <p>
-     * The <code>network interface</code> and <code>ttl</code> parameters
+     * The {@code network interface} and {@code ttl} parameters
      * let the caller specify which network interface the test will go through
      * and the maximum number of hops the packets should go through.
-     * A negative value for the <code>ttl</code> will result in an
+     * A negative value for the {@code ttl} will result in an
      * IllegalArgumentException being thrown.
      * <p>
      * The timeout value, in milliseconds, indicates the maximum amount of time
@@ -458,9 +458,9 @@
      * @param   ttl     the maximum numbers of hops to try or 0 for the
      *                  default
      * @param   timeout the time, in milliseconds, before the call aborts
-     * @throws  IllegalArgumentException if either <code>timeout</code>
-     *                          or <code>ttl</code> are negative.
-     * @return a <code>boolean</code>indicating if the address is reachable.
+     * @throws  IllegalArgumentException if either {@code timeout}
+     *                          or {@code ttl} are negative.
+     * @return a {@code boolean}indicating if the address is reachable.
      * @throws IOException if a network error occurs
      * @since 1.5
      */
@@ -486,8 +486,8 @@
      * {@link #getCanonicalHostName() getCanonicalHostName}.
      *
      * <p>If there is a security manager, its
-     * <code>checkConnect</code> method is first called
-     * with the hostname and <code>-1</code>
+     * {@code checkConnect} method is first called
+     * with the hostname and {@code -1}
      * as its arguments to see if the operation is allowed.
      * If the operation is not allowed, it will return
      * the textual representation of the IP address.
@@ -511,8 +511,8 @@
      * here without a security check.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkConnect</code> method
-     * with the hostname and <code>-1</code>
+     * calls its {@code checkConnect} method
+     * with the hostname and {@code -1}
      * as its arguments to see if the calling code is allowed to know
      * the hostname for this IP address, i.e., to connect to the host.
      * If the operation is not allowed, it will return
@@ -539,8 +539,8 @@
      * the FQDN depending on the underlying system configuration.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkConnect</code> method
-     * with the hostname and <code>-1</code>
+     * calls its {@code checkConnect} method
+     * with the hostname and {@code -1}
      * as its arguments to see if the calling code is allowed to know
      * the hostname for this IP address, i.e., to connect to the host.
      * If the operation is not allowed, it will return
@@ -566,8 +566,8 @@
      * Returns the hostname for this address.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkConnect</code> method
-     * with the hostname and <code>-1</code>
+     * calls its {@code checkConnect} method
+     * with the hostname and {@code -1}
      * as its arguments to see if the calling code is allowed to know
      * the hostname for this IP address, i.e., to connect to the host.
      * If the operation is not allowed, it will return
@@ -633,9 +633,9 @@
     }
 
     /**
-     * Returns the raw IP address of this <code>InetAddress</code>
+     * Returns the raw IP address of this {@code InetAddress}
      * object. The result is in network byte order: the highest order
-     * byte of the address is in <code>getAddress()[0]</code>.
+     * byte of the address is in {@code getAddress()[0]}.
      *
      * @return  the raw IP address of this object.
      */
@@ -664,18 +664,18 @@
 
     /**
      * Compares this object against the specified object.
-     * The result is <code>true</code> if and only if the argument is
-     * not <code>null</code> and it represents the same IP address as
+     * The result is {@code true} if and only if the argument is
+     * not {@code null} and it represents the same IP address as
      * this object.
      * <p>
-     * Two instances of <code>InetAddress</code> represent the same IP
+     * Two instances of {@code InetAddress} represent the same IP
      * address if the length of the byte arrays returned by
-     * <code>getAddress</code> is the same for both, and each of the
+     * {@code getAddress} is the same for both, and each of the
      * array components is the same for the byte arrays.
      *
      * @param   obj   the object to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      * @see     java.net.InetAddress#getAddress()
      */
     public boolean equals(Object obj) {
@@ -683,7 +683,7 @@
     }
 
     /**
-     * Converts this IP address to a <code>String</code>. The
+     * Converts this IP address to a {@code String}. The
      * string returned is of the form: hostname / literal IP
      * address.
      *
@@ -974,7 +974,7 @@
      * No name service is checked for the validity of the address.
      *
      * <p> The host name can either be a machine name, such as
-     * "<code>java.sun.com</code>", or a textual representation of its IP
+     * "{@code java.sun.com}", or a textual representation of its IP
      * address.
      * <p> No validity checking is done on the host name either.
      *
@@ -1019,26 +1019,26 @@
      * Determines the IP address of a host, given the host's name.
      *
      * <p> The host name can either be a machine name, such as
-     * "<code>java.sun.com</code>", or a textual representation of its
+     * "{@code java.sun.com}", or a textual representation of its
      * IP address. If a literal IP address is supplied, only the
      * validity of the address format is checked.
      *
-     * <p> For <code>host</code> specified in literal IPv6 address,
+     * <p> For {@code host} specified in literal IPv6 address,
      * either the form defined in RFC 2732 or the literal IPv6 address
      * format defined in RFC 2373 is accepted. IPv6 scoped addresses are also
      * supported. See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6
      * scoped addresses.
      *
-     * <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt>
+     * <p> If the host is {@code null} then an {@code InetAddress}
      * representing an address of the loopback interface is returned.
      * See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a>
      * section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>
      * section&nbsp;2.5.3. </p>
      *
-     * @param      host   the specified host, or <code>null</code>.
+     * @param      host   the specified host, or {@code null}.
      * @return     an IP address for the given host name.
      * @exception  UnknownHostException  if no IP address for the
-     *               <code>host</code> could be found, or if a scope_id was specified
+     *               {@code host} could be found, or if a scope_id was specified
      *               for a global IPv6 address.
      * @exception  SecurityException if a security manager exists
      *             and its checkConnect method doesn't allow the operation
@@ -1059,37 +1059,37 @@
      * based on the configured name service on the system.
      *
      * <p> The host name can either be a machine name, such as
-     * "<code>java.sun.com</code>", or a textual representation of its IP
+     * "{@code java.sun.com}", or a textual representation of its IP
      * address. If a literal IP address is supplied, only the
      * validity of the address format is checked.
      *
-     * <p> For <code>host</code> specified in <i>literal IPv6 address</i>,
+     * <p> For {@code host} specified in <i>literal IPv6 address</i>,
      * either the form defined in RFC 2732 or the literal IPv6 address
      * format defined in RFC 2373 is accepted. A literal IPv6 address may
      * also be qualified by appending a scoped zone identifier or scope_id.
      * The syntax and usage of scope_ids is described
      * <a href="Inet6Address.html#scoped">here</a>.
-     * <p> If the host is <tt>null</tt> then an <tt>InetAddress</tt>
+     * <p> If the host is {@code null} then an {@code InetAddress}
      * representing an address of the loopback interface is returned.
      * See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC&nbsp;3330</a>
      * section&nbsp;2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>
      * section&nbsp;2.5.3. </p>
      *
-     * <p> If there is a security manager and <code>host</code> is not
-     * null and <code>host.length() </code> is not equal to zero, the
+     * <p> If there is a security manager and {@code host} is not
+     * null and {@code host.length() } is not equal to zero, the
      * security manager's
-     * <code>checkConnect</code> method is called
-     * with the hostname and <code>-1</code>
+     * {@code checkConnect} method is called
+     * with the hostname and {@code -1}
      * as its arguments to see if the operation is allowed.
      *
-     * @param      host   the name of the host, or <code>null</code>.
+     * @param      host   the name of the host, or {@code null}.
      * @return     an array of all the IP addresses for a given host name.
      *
      * @exception  UnknownHostException  if no IP address for the
-     *               <code>host</code> could be found, or if a scope_id was specified
+     *               {@code host} could be found, or if a scope_id was specified
      *               for a global IPv6 address.
      * @exception  SecurityException  if a security manager exists and its
-     *               <code>checkConnect</code> method doesn't allow the operation.
+     *               {@code checkConnect} method doesn't allow the operation.
      *
      * @see SecurityManager#checkConnect
      */
@@ -1389,9 +1389,9 @@
     }
 
     /**
-     * Returns an <code>InetAddress</code> object given the raw IP address .
+     * Returns an {@code InetAddress} object given the raw IP address .
      * The argument is in network byte order: the highest order
-     * byte of the address is in <code>getAddress()[0]</code>.
+     * byte of the address is in {@code getAddress()[0]}.
      *
      * <p> This method doesn't block, i.e. no reverse name service lookup
      * is performed.
@@ -1417,14 +1417,14 @@
     /**
      * Returns the address of the local host. This is achieved by retrieving
      * the name of the host from the system, then resolving that name into
-     * an <code>InetAddress</code>.
+     * an {@code InetAddress}.
      *
      * <P>Note: The resolved address may be cached for a short period of time.
      * </P>
      *
      * <p>If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with the local host name and <code>-1</code>
+     * {@code checkConnect} method is called
+     * with the local host name and {@code -1}
      * as its arguments to see if the operation is allowed.
      * If the operation is not allowed, an InetAddress representing
      * the loopback address is returned.
--- a/jdk/src/share/classes/java/net/InetSocketAddress.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/InetSocketAddress.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,7 +43,7 @@
  * as returned values.
  * <p>
  * The <i>wildcard</i> is a special local IP address. It usually means "any"
- * and can only be used for <code>bind</code> operations.
+ * and can only be used for {@code bind} operations.
  *
  * @see java.net.Socket
  * @see java.net.ServerSocket
@@ -155,8 +155,8 @@
      * and the port number a specified value.
      * <p>
      * A valid port value is between 0 and 65535.
-     * A port number of <code>zero</code> will let the system pick up an
-     * ephemeral port in a <code>bind</code> operation.
+     * A port number of {@code zero} will let the system pick up an
+     * ephemeral port in a {@code bind} operation.
      * <p>
      * @param   port    The port number
      * @throws IllegalArgumentException if the port parameter is outside the specified
@@ -171,10 +171,10 @@
      * Creates a socket address from an IP address and a port number.
      * <p>
      * A valid port value is between 0 and 65535.
-     * A port number of <code>zero</code> will let the system pick up an
-     * ephemeral port in a <code>bind</code> operation.
+     * A port number of {@code zero} will let the system pick up an
+     * ephemeral port in a {@code bind} operation.
      * <P>
-     * A <code>null</code> address will assign the <i>wildcard</i> address.
+     * A {@code null} address will assign the <i>wildcard</i> address.
      * <p>
      * @param   addr    The IP address
      * @param   port    The port number
@@ -195,13 +195,13 @@
      * An attempt will be made to resolve the hostname into an InetAddress.
      * If that attempt fails, the address will be flagged as <I>unresolved</I>.
      * <p>
-     * If there is a security manager, its <code>checkConnect</code> method
+     * If there is a security manager, its {@code checkConnect} method
      * is called with the host name as its argument to check the permissiom
      * to resolve it. This could result in a SecurityException.
      * <P>
      * A valid port value is between 0 and 65535.
-     * A port number of <code>zero</code> will let the system pick up an
-     * ephemeral port in a <code>bind</code> operation.
+     * A port number of {@code zero} will let the system pick up an
+     * ephemeral port in a {@code bind} operation.
      * <P>
      * @param   hostname the Host name
      * @param   port    The port number
@@ -237,8 +237,8 @@
      * The address will be flagged as <I>unresolved</I>.
      * <p>
      * A valid port value is between 0 and 65535.
-     * A port number of <code>zero</code> will let the system pick up an
-     * ephemeral port in a <code>bind</code> operation.
+     * A port number of {@code zero} will let the system pick up an
+     * ephemeral port in a {@code bind} operation.
      * <P>
      * @param   host    the Host name
      * @param   port    The port number
@@ -246,7 +246,7 @@
      *                  the range of valid port values, or if the hostname
      *                  parameter is <TT>null</TT>.
      * @see     #isUnresolved()
-     * @return  a <code>InetSocketAddress</code> representing the unresolved
+     * @return  a {@code InetSocketAddress} representing the unresolved
      *          socket address
      * @since 1.5
      */
@@ -326,16 +326,16 @@
 
     /**
      *
-     * Gets the <code>InetAddress</code>.
+     * Gets the {@code InetAddress}.
      *
-     * @return the InetAdress or <code>null</code> if it is unresolved.
+     * @return the InetAdress or {@code null} if it is unresolved.
      */
     public final InetAddress getAddress() {
         return holder.getAddress();
     }
 
     /**
-     * Gets the <code>hostname</code>.
+     * Gets the {@code hostname}.
      * Note: This method may trigger a name service reverse lookup if the
      * address was created with a literal IP address.
      *
@@ -360,8 +360,8 @@
     /**
      * Checks whether the address has been resolved or not.
      *
-     * @return <code>true</code> if the hostname couldn't be resolved into
-     *          an <code>InetAddress</code>.
+     * @return {@code true} if the hostname couldn't be resolved into
+     *          an {@code InetAddress}.
      */
     public final boolean isUnresolved() {
         return holder.isUnresolved();
@@ -382,11 +382,11 @@
 
     /**
      * Compares this object against the specified object.
-     * The result is <code>true</code> if and only if the argument is
-     * not <code>null</code> and it represents the same address as
+     * The result is {@code true} if and only if the argument is
+     * not {@code null} and it represents the same address as
      * this object.
      * <p>
-     * Two instances of <code>InetSocketAddress</code> represent the same
+     * Two instances of {@code InetSocketAddress} represent the same
      * address if both the InetAddresses (or hostnames if it is unresolved) and port
      * numbers are equal.
      * If both addresses are unresolved, then the hostname and the port number
@@ -396,8 +396,8 @@
      * considered equal.
      *
      * @param   obj   the object to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      * @see java.net.InetAddress#equals(java.lang.Object)
      */
     @Override
--- a/jdk/src/share/classes/java/net/InterfaceAddress.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/InterfaceAddress.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,23 +47,23 @@
     }
 
     /**
-     * Returns an <code>InetAddress</code> for this address.
+     * Returns an {@code InetAddress} for this address.
      *
-     * @return the <code>InetAddress</code> for this address.
+     * @return the {@code InetAddress} for this address.
      */
     public InetAddress getAddress() {
         return address;
     }
 
     /**
-     * Returns an <code>InetAddress</code> for the brodcast address
+     * Returns an {@code InetAddress} for the brodcast address
      * for this InterfaceAddress.
      * <p>
      * Only IPv4 networks have broadcast address therefore, in the case
-     * of an IPv6 network, <code>null</code> will be returned.
+     * of an IPv6 network, {@code null} will be returned.
      *
-     * @return the <code>InetAddress</code> representing the broadcast
-     *         address or <code>null</code> if there is no broadcast address.
+     * @return the {@code InetAddress} representing the broadcast
+     *         address or {@code null} if there is no broadcast address.
      */
     public InetAddress getBroadcast() {
         return broadcast;
@@ -76,7 +76,7 @@
      * or 24 (255.255.255.0). <p>
      * Typical IPv6 values would be 128 (::1/128) or 10 (fe80::203:baff:fe27:1243/10)
      *
-     * @return a <code>short</code> representing the prefix length for the
+     * @return a {@code short} representing the prefix length for the
      *         subnet of that address.
      */
      public short getNetworkPrefixLength() {
@@ -85,17 +85,17 @@
 
     /**
      * Compares this object against the specified object.
-     * The result is <code>true</code> if and only if the argument is
-     * not <code>null</code> and it represents the same interface address as
+     * The result is {@code true} if and only if the argument is
+     * not {@code null} and it represents the same interface address as
      * this object.
      * <p>
-     * Two instances of <code>InterfaceAddress</code> represent the same
+     * Two instances of {@code InterfaceAddress} represent the same
      * address if the InetAddress, the prefix length and the broadcast are
      * the same for both.
      *
      * @param   obj   the object to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      * @see     java.net.InterfaceAddress#hashCode()
      */
     public boolean equals(Object obj) {
@@ -122,7 +122,7 @@
     }
 
     /**
-     * Converts this Interface address to a <code>String</code>. The
+     * Converts this Interface address to a {@code String}. The
      * string returned is of the form: InetAddress / prefix length [ broadcast address ].
      *
      * @return  a string representation of this Interface address.
--- a/jdk/src/share/classes/java/net/JarURLConnection.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/JarURLConnection.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -45,18 +45,14 @@
  *
  * <p>for example:
  *
- * <p><code>
- * jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class<br>
- * </code>
+ * <p>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class}
  *
  * <p>Jar URLs should be used to refer to a JAR file or entries in
  * a JAR file. The example above is a JAR URL which refers to a JAR
  * entry. If the entry name is omitted, the URL refers to the whole
  * JAR file:
  *
- * <code>
- * jar:http://www.foo.com/bar/baz.jar!/
- * </code>
+ * {@code jar:http://www.foo.com/bar/baz.jar!/}
  *
  * <p>Users should cast the generic URLConnection to a
  * JarURLConnection when they know that the URL they created is a JAR
@@ -76,19 +72,19 @@
  * <dl>
  *
  * <dt>A Jar entry
- * <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class</code>
+ * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class}
  *
  * <dt>A Jar file
- * <dd><code>jar:http://www.foo.com/bar/baz.jar!/</code>
+ * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/}
  *
  * <dt>A Jar directory
- * <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/</code>
+ * <dd>{@code jar:http://www.foo.com/bar/baz.jar!/COM/foo/}
  *
  * </dl>
  *
- * <p><code>!/</code> is refered to as the <em>separator</em>.
+ * <p>{@code !/} is refered to as the <em>separator</em>.
  *
- * <p>When constructing a JAR url via <code>new URL(context, spec)</code>,
+ * <p>When constructing a JAR url via {@code new URL(context, spec)},
  * the following rules apply:
  *
  * <ul>
@@ -294,7 +290,7 @@
      * can only be called once
      * the connection has been completely verified by reading
      * from the input stream until the end of the stream has been
-     * reached. Otherwise, this method will return <code>null</code>
+     * reached. Otherwise, this method will return {@code null}
      *
      * @return the Certificate object for this connection if the URL
      * for it points to a JAR file entry, null otherwise.
--- a/jdk/src/share/classes/java/net/MalformedURLException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/MalformedURLException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,13 +39,13 @@
     private static final long serialVersionUID = -182787522200415866L;
 
     /**
-     * Constructs a <code>MalformedURLException</code> with no detail message.
+     * Constructs a {@code MalformedURLException} with no detail message.
      */
     public MalformedURLException() {
     }
 
     /**
-     * Constructs a <code>MalformedURLException</code> with the
+     * Constructs a {@code MalformedURLException} with the
      * specified detail message.
      *
      * @param   msg   the detail message.
--- a/jdk/src/share/classes/java/net/MulticastSocket.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/MulticastSocket.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -92,7 +92,7 @@
      * Create a multicast socket.
      *
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
+     * its {@code checkListen} method is first called
      * with 0 as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      * <p>
@@ -103,7 +103,7 @@
      * @exception IOException if an I/O exception occurs
      * while creating the MulticastSocket
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      * @see SecurityManager#checkListen
      * @see java.net.DatagramSocket#setReuseAddress(boolean)
      */
@@ -115,8 +115,8 @@
      * Create a multicast socket and bind it to a specific port.
      *
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
-     * with the <code>port</code> argument
+     * its {@code checkListen} method is first called
+     * with the {@code port} argument
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      * <p>
@@ -128,7 +128,7 @@
      * @exception IOException if an I/O exception occurs
      * while creating the MulticastSocket
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      * @see SecurityManager#checkListen
      * @see java.net.DatagramSocket#setReuseAddress(boolean)
      */
@@ -139,10 +139,10 @@
     /**
      * Create a MulticastSocket bound to the specified socket address.
      * <p>
-     * Or, if the address is <code>null</code>, create an unbound socket.
+     * Or, if the address is {@code null}, create an unbound socket.
      * <p>
      * <p>If there is a security manager,
-     * its <code>checkListen</code> method is first called
+     * its {@code checkListen} method is first called
      * with the SocketAddress port as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      * <p>
@@ -150,12 +150,12 @@
      * {@link DatagramSocket#setReuseAddress(boolean)} method is
      * called to enable the SO_REUSEADDR socket option.
      *
-     * @param bindaddr Socket address to bind to, or <code>null</code> for
+     * @param bindaddr Socket address to bind to, or {@code null} for
      *                 an unbound socket.
      * @exception IOException if an I/O exception occurs
      * while creating the MulticastSocket
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkListen</code> method doesn't allow the operation.
+     *             {@code checkListen} method doesn't allow the operation.
      * @see SecurityManager#checkListen
      * @see java.net.DatagramSocket#setReuseAddress(boolean)
      *
@@ -197,7 +197,7 @@
 
     /**
      * Set the default time-to-live for multicast packets sent out
-     * on this <code>MulticastSocket</code> in order to control the
+     * on this {@code MulticastSocket} in order to control the
      * scope of the multicasts.
      *
      * <p>The ttl is an <b>unsigned</b> 8-bit quantity, and so <B>must</B> be
@@ -279,11 +279,11 @@
 
     /**
      * Joins a multicast group. Its behavior may be affected by
-     * <code>setInterface</code> or <code>setNetworkInterface</code>.
+     * {@code setInterface} or {@code setNetworkInterface}.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkMulticast</code> method
-     * with the <code>mcastaddr</code> argument
+     * calls its {@code checkMulticast} method
+     * with the {@code mcastaddr} argument
      * as its argument.
      *
      * @param mcastaddr is the multicast address to join
@@ -291,7 +291,7 @@
      * @exception IOException if there is an error joining
      * or when the address is not a multicast address.
      * @exception  SecurityException  if a security manager exists and its
-     * <code>checkMulticast</code> method doesn't allow the join.
+     * {@code checkMulticast} method doesn't allow the join.
      *
      * @see SecurityManager#checkMulticast(InetAddress)
      */
@@ -325,18 +325,18 @@
 
     /**
      * Leave a multicast group. Its behavior may be affected by
-     * <code>setInterface</code> or <code>setNetworkInterface</code>.
+     * {@code setInterface} or {@code setNetworkInterface}.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkMulticast</code> method
-     * with the <code>mcastaddr</code> argument
+     * calls its {@code checkMulticast} method
+     * with the {@code mcastaddr} argument
      * as its argument.
      *
      * @param mcastaddr is the multicast address to leave
      * @exception IOException if there is an error leaving
      * or when the address is not a multicast address.
      * @exception  SecurityException  if a security manager exists and its
-     * <code>checkMulticast</code> method doesn't allow the operation.
+     * {@code checkMulticast} method doesn't allow the operation.
      *
      * @see SecurityManager#checkMulticast(InetAddress)
      */
@@ -362,8 +362,8 @@
      * Joins the specified multicast group at the specified interface.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkMulticast</code> method
-     * with the <code>mcastaddr</code> argument
+     * calls its {@code checkMulticast} method
+     * with the {@code mcastaddr} argument
      * as its argument.
      *
      * @param mcastaddr is the multicast address to join
@@ -375,7 +375,7 @@
      * @exception IOException if there is an error joining
      * or when the address is not a multicast address.
      * @exception  SecurityException  if a security manager exists and its
-     * <code>checkMulticast</code> method doesn't allow the join.
+     * {@code checkMulticast} method doesn't allow the join.
      * @throws  IllegalArgumentException if mcastaddr is null or is a
      *          SocketAddress subclass not supported by this socket
      *
@@ -410,8 +410,8 @@
      * Leave a multicast group on a specified local interface.
      *
      * <p>If there is a security manager, this method first
-     * calls its <code>checkMulticast</code> method
-     * with the <code>mcastaddr</code> argument
+     * calls its {@code checkMulticast} method
+     * with the {@code mcastaddr} argument
      * as its argument.
      *
      * @param mcastaddr is the multicast address to leave
@@ -422,7 +422,7 @@
      * @exception IOException if there is an error leaving
      * or when the address is not a multicast address.
      * @exception  SecurityException  if a security manager exists and its
-     * <code>checkMulticast</code> method doesn't allow the operation.
+     * {@code checkMulticast} method doesn't allow the operation.
      * @throws  IllegalArgumentException if mcastaddr is null or is a
      *          SocketAddress subclass not supported by this socket
      *
@@ -478,7 +478,7 @@
      * Retrieve the address of the network interface used for
      * multicast packets.
      *
-     * @return An <code>InetAddress</code> representing
+     * @return An {@code InetAddress} representing
      *  the address of the network interface used for
      *  multicast packets.
      *
@@ -562,7 +562,7 @@
      *
      * @exception SocketException if there is an error in
      * the underlying protocol, such as a TCP error.
-     * @return the multicast <code>NetworkInterface</code> currently set
+     * @return the multicast {@code NetworkInterface} currently set
      * @see #setNetworkInterface(NetworkInterface)
      * @since 1.4
      */
@@ -587,7 +587,7 @@
      * <p>Because this option is a hint, applications that want to
      * verify what loopback mode is set to should call
      * {@link #getLoopbackMode()}
-     * @param disable <code>true</code> to disable the LoopbackMode
+     * @param disable {@code true} to disable the LoopbackMode
      * @throws SocketException if an error occurs while setting the value
      * @since 1.4
      * @see #getLoopbackMode
@@ -615,18 +615,18 @@
      * otherwise it is preferable to set a TTL once on the socket, and
      * use that default TTL for all packets.  This method does <B>not
      * </B> alter the default TTL for the socket. Its behavior may be
-     * affected by <code>setInterface</code>.
+     * affected by {@code setInterface}.
      *
      * <p>If there is a security manager, this method first performs some
-     * security checks. First, if <code>p.getAddress().isMulticastAddress()</code>
+     * security checks. First, if {@code p.getAddress().isMulticastAddress()}
      * is true, this method calls the
-     * security manager's <code>checkMulticast</code> method
-     * with <code>p.getAddress()</code> and <code>ttl</code> as its arguments.
+     * security manager's {@code checkMulticast} method
+     * with {@code p.getAddress()} and {@code ttl} as its arguments.
      * If the evaluation of that expression is false,
      * this method instead calls the security manager's
-     * <code>checkConnect</code> method with arguments
-     * <code>p.getAddress().getHostAddress()</code> and
-     * <code>p.getPort()</code>. Each call to a security manager method
+     * {@code checkConnect} method with arguments
+     * {@code p.getAddress().getHostAddress()} and
+     * {@code p.getPort()}. Each call to a security manager method
      * could result in a SecurityException if the operation is not allowed.
      *
      * @param p is the packet to be sent. The packet should contain
@@ -639,7 +639,7 @@
      * @exception IOException is raised if an error occurs i.e
      * error while setting ttl.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkMulticast</code> or <code>checkConnect</code>
+     *             {@code checkMulticast} or {@code checkConnect}
      *             method doesn't allow the send.
      *
      * @deprecated Use the following code or its equivalent instead:
--- a/jdk/src/share/classes/java/net/NetPermission.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/NetPermission.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -177,8 +177,8 @@
      *
      * @param name the name of the NetPermission.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
      */
 
     public NetPermission(String name)
@@ -194,8 +194,8 @@
      * @param name the name of the NetPermission.
      * @param actions should be null.
      *
-     * @throws NullPointerException if <code>name</code> is <code>null</code>.
-     * @throws IllegalArgumentException if <code>name</code> is empty.
+     * @throws NullPointerException if {@code name} is {@code null}.
+     * @throws IllegalArgumentException if {@code name} is empty.
      */
 
     public NetPermission(String name, String actions)
--- a/jdk/src/share/classes/java/net/NetworkInterface.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/NetworkInterface.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,9 +98,9 @@
      * Convenience method to return an Enumeration with all or a
      * subset of the InetAddresses bound to this network interface.
      * <p>
-     * If there is a security manager, its <code>checkConnect</code>
+     * If there is a security manager, its {@code checkConnect}
      * method is called for each InetAddress. Only InetAddresses where
-     * the <code>checkConnect</code> doesn't throw a SecurityException
+     * the {@code checkConnect} doesn't throw a SecurityException
      * will be returned in the Enumeration. However, if the caller has the
      * {@link NetPermission}("getNetworkInformation") permission, then all
      * InetAddresses are returned.
@@ -154,15 +154,15 @@
     }
 
     /**
-     * Get a List of all or a subset of the <code>InterfaceAddresses</code>
+     * Get a List of all or a subset of the {@code InterfaceAddresses}
      * of this network interface.
      * <p>
-     * If there is a security manager, its <code>checkConnect</code>
+     * If there is a security manager, its {@code checkConnect}
      * method is called with the InetAddress for each InterfaceAddress.
-     * Only InterfaceAddresses where the <code>checkConnect</code> doesn't throw
+     * Only InterfaceAddresses where the {@code checkConnect} doesn't throw
      * a SecurityException will be returned in the List.
      *
-     * @return a <code>List</code> object with all or a subset of the
+     * @return a {@code List} object with all or a subset of the
      *         InterfaceAddresss of this network interface
      * @since 1.6
      */
@@ -216,10 +216,10 @@
 
     /**
      * Returns the parent NetworkInterface of this interface if this is
-     * a subinterface, or <code>null</code> if it is a physical
+     * a subinterface, or {@code null} if it is a physical
      * (non virtual) interface or has no parent.
      *
-     * @return The <code>NetworkInterface</code> this interface is attached to.
+     * @return The {@code NetworkInterface} this interface is attached to.
      * @since 1.6
      */
     public NetworkInterface getParent() {
@@ -260,15 +260,15 @@
      * @param   name
      *          The name of the network interface.
      *
-     * @return  A <tt>NetworkInterface</tt> with the specified name,
-     *          or <tt>null</tt> if there is no network interface
+     * @return  A {@code NetworkInterface} with the specified name,
+     *          or {@code null} if there is no network interface
      *          with the specified name.
      *
      * @throws  SocketException
      *          If an I/O error occurs.
      *
      * @throws  NullPointerException
-     *          If the specified name is <tt>null</tt>.
+     *          If the specified name is {@code null}.
      */
     public static NetworkInterface getByName(String name) throws SocketException {
         if (name == null)
@@ -303,17 +303,17 @@
      * returned.
      *
      * @param   addr
-     *          The <tt>InetAddress</tt> to search with.
+     *          The {@code InetAddress} to search with.
      *
-     * @return  A <tt>NetworkInterface</tt>
-     *          or <tt>null</tt> if there is no network interface
+     * @return  A {@code NetworkInterface}
+     *          or {@code null} if there is no network interface
      *          with the specified IP address.
      *
      * @throws  SocketException
      *          If an I/O error occurs.
      *
      * @throws  NullPointerException
-     *          If the specified address is <tt>null</tt>.
+     *          If the specified address is {@code null}.
      */
     public static NetworkInterface getByInetAddress(InetAddress addr) throws SocketException {
         if (addr == null) {
@@ -378,7 +378,7 @@
     /**
      * Returns whether a network interface is up and running.
      *
-     * @return  <code>true</code> if the interface is up and running.
+     * @return  {@code true} if the interface is up and running.
      * @exception       SocketException if an I/O error occurs.
      * @since 1.6
      */
@@ -390,7 +390,7 @@
     /**
      * Returns whether a network interface is a loopback interface.
      *
-     * @return  <code>true</code> if the interface is a loopback interface.
+     * @return  {@code true} if the interface is a loopback interface.
      * @exception       SocketException if an I/O error occurs.
      * @since 1.6
      */
@@ -404,7 +404,7 @@
      * A typical point to point interface would be a PPP connection through
      * a modem.
      *
-     * @return  <code>true</code> if the interface is a point to point
+     * @return  {@code true} if the interface is a point to point
      *          interface.
      * @exception       SocketException if an I/O error occurs.
      * @since 1.6
@@ -417,7 +417,7 @@
     /**
      * Returns whether a network interface supports multicasting or not.
      *
-     * @return  <code>true</code> if the interface supports Multicasting.
+     * @return  {@code true} if the interface supports Multicasting.
      * @exception       SocketException if an I/O error occurs.
      * @since 1.6
      */
@@ -432,7 +432,7 @@
      * If a security manager is set, then the caller must have
      * the permission {@link NetPermission}("getNetworkInformation").
      *
-     * @return  a byte array containing the address, or <code>null</code> if
+     * @return  a byte array containing the address, or {@code null} if
      *          the address doesn't exist, is not accessible or a security
      *          manager is set and the caller does not have the permission
      *          NetPermission("getNetworkInformation")
@@ -481,7 +481,7 @@
      * can be several virtual interfaces attached to a single physical
      * interface.
      *
-     * @return <code>true</code> if this interface is a virtual interface.
+     * @return {@code true} if this interface is a virtual interface.
      * @since 1.6
      */
     public boolean isVirtual() {
@@ -497,16 +497,16 @@
 
     /**
      * Compares this object against the specified object.
-     * The result is <code>true</code> if and only if the argument is
-     * not <code>null</code> and it represents the same NetworkInterface
+     * The result is {@code true} if and only if the argument is
+     * not {@code null} and it represents the same NetworkInterface
      * as this object.
      * <p>
-     * Two instances of <code>NetworkInterface</code> represent the same
+     * Two instances of {@code NetworkInterface} represent the same
      * NetworkInterface if both name and addrs are the same for both.
      *
      * @param   obj   the object to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      * @see     java.net.InetAddress#getAddress()
      */
     public boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/net/PasswordAuthentication.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/PasswordAuthentication.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,11 +43,11 @@
     private char[] password;
 
     /**
-     * Creates a new <code>PasswordAuthentication</code> object from the given
+     * Creates a new {@code PasswordAuthentication} object from the given
      * user name and password.
      *
      * <p> Note that the given user password is cloned before it is stored in
-     * the new <code>PasswordAuthentication</code> object.
+     * the new {@code PasswordAuthentication} object.
      *
      * @param userName the user name
      * @param password the user's password
--- a/jdk/src/share/classes/java/net/PortUnreachableException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/PortUnreachableException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
     private static final long serialVersionUID = 8462541992376507323L;
 
     /**
-     * Constructs a new <code>PortUnreachableException</code> with a
+     * Constructs a new {@code PortUnreachableException} with a
      * detail message.
      * @param msg the detail message
      */
@@ -45,7 +45,7 @@
     }
 
     /**
-     * Construct a new <code>PortUnreachableException</code> with no
+     * Construct a new {@code PortUnreachableException} with no
      * detailed message.
      */
     public PortUnreachableException() {}
--- a/jdk/src/share/classes/java/net/ProtocolException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/ProtocolException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
     private static final long serialVersionUID = -6098449442062388080L;
 
     /**
-     * Constructs a new <code>ProtocolException</code> with the
+     * Constructs a new {@code ProtocolException} with the
      * specified detail message.
      *
      * @param   host   the detail message.
@@ -49,7 +49,7 @@
     }
 
     /**
-     * Constructs a new <code>ProtocolException</code> with no detail message.
+     * Constructs a new {@code ProtocolException} with no detail message.
      */
     public ProtocolException() {
     }
--- a/jdk/src/share/classes/java/net/Proxy.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/Proxy.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 /**
  * This class represents a proxy setting, typically a type (http, socks) and
  * a socket address.
- * A <code>Proxy</code> is an immutable object.
+ * A {@code Proxy} is an immutable object.
  *
  * @see     java.net.ProxySelector
  * @author Yingxian Wang
@@ -61,17 +61,17 @@
     private SocketAddress sa;
 
     /**
-     * A proxy setting that represents a <code>DIRECT</code> connection,
+     * A proxy setting that represents a {@code DIRECT} connection,
      * basically telling the protocol handler not to use any proxying.
      * Used, for instance, to create sockets bypassing any other global
      * proxy settings (like SOCKS):
      * <P>
-     * <code>Socket s = new Socket(Proxy.NO_PROXY);</code><br>
+     * {@code Socket s = new Socket(Proxy.NO_PROXY);}<br>
      * <P>
      */
     public final static Proxy NO_PROXY = new Proxy();
 
-    // Creates the proxy that represents a <code>DIRECT</code> connection.
+    // Creates the proxy that represents a {@code DIRECT} connection.
     private Proxy() {
         type = Type.DIRECT;
         sa = null;
@@ -82,11 +82,11 @@
      * Certain combinations are illegal. For instance, for types Http, and
      * Socks, a SocketAddress <b>must</b> be provided.
      * <P>
-     * Use the <code>Proxy.NO_PROXY</code> constant
+     * Use the {@code Proxy.NO_PROXY} constant
      * for representing a direct connection.
      *
-     * @param type the <code>Type</code> of the proxy
-     * @param sa the <code>SocketAddress</code> for that proxy
+     * @param type the {@code Type} of the proxy
+     * @param sa the {@code SocketAddress} for that proxy
      * @throws IllegalArgumentException when the type and the address are
      * incompatible
      */
@@ -108,9 +108,9 @@
 
     /**
      * Returns the socket address of the proxy, or
-     * <code>null</code> if its a direct connection.
+     * {@code null} if its a direct connection.
      *
-     * @return a <code>SocketAddress</code> representing the socket end
+     * @return a {@code SocketAddress} representing the socket end
      *         point of the proxy
      */
     public SocketAddress address() {
@@ -121,7 +121,7 @@
      * Constructs a string representation of this Proxy.
      * This String is constructed by calling toString() on its type
      * and concatenating " @ " and the toString() result from its address
-     * if its type is not <code>DIRECT</code>.
+     * if its type is not {@code DIRECT}.
      *
      * @return  a string representation of this object.
      */
@@ -133,16 +133,16 @@
 
         /**
      * Compares this object against the specified object.
-     * The result is <code>true</code> if and only if the argument is
-     * not <code>null</code> and it represents the same proxy as
+     * The result is {@code true} if and only if the argument is
+     * not {@code null} and it represents the same proxy as
      * this object.
      * <p>
-     * Two instances of <code>Proxy</code> represent the same
+     * Two instances of {@code Proxy} represent the same
      * address if both the SocketAddresses and type are equal.
      *
      * @param   obj   the object to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      * @see java.net.InetSocketAddress#equals(java.lang.Object)
      */
     public final boolean equals(Object obj) {
--- a/jdk/src/share/classes/java/net/ProxySelector.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/ProxySelector.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,9 +83,9 @@
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it denies
-     * {@link NetPermission}<tt>("getProxySelector")</tt>
+     * {@link NetPermission}{@code ("getProxySelector")}
      * @see #setDefault(ProxySelector)
-     * @return the system-wide <code>ProxySelector</code>
+     * @return the system-wide {@code ProxySelector}
      * @since 1.5
      */
     public static ProxySelector getDefault() {
@@ -102,11 +102,11 @@
      * Note: non-standard protocol handlers may ignore this setting.
      *
      * @param ps The HTTP proxy selector, or
-     *          <code>null</code> to unset the proxy selector.
+     *          {@code null} to unset the proxy selector.
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it denies
-     * {@link NetPermission}<tt>("setProxySelector")</tt>
+     * {@link NetPermission}{@code ("setProxySelector")}
      *
      * @see #getDefault()
      * @since 1.5
@@ -127,7 +127,7 @@
      * <UL>
      * <LI>http URI for http connections</LI>
      * <LI>https URI for https connections
-     * <LI><code>socket://host:port</code><br>
+     * <LI>{@code socket://host:port}<br>
      *     for tcp client sockets connections</LI>
      * </UL>
      *
--- a/jdk/src/share/classes/java/net/ResponseCache.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/ResponseCache.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -74,10 +74,10 @@
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it denies
-     * {@link NetPermission}<tt>("getResponseCache")</tt>
+     * {@link NetPermission}{@code ("getResponseCache")}
      *
      * @see #setDefault(ResponseCache)
-     * @return the system-wide <code>ResponseCache</code>
+     * @return the system-wide {@code ResponseCache}
      * @since 1.5
      */
     public synchronized  static ResponseCache getDefault() {
@@ -94,11 +94,11 @@
      * Note: non-standard procotol handlers may ignore this setting.
      *
      * @param responseCache The response cache, or
-     *          <code>null</code> to unset the cache.
+     *          {@code null} to unset the cache.
      *
      * @throws  SecurityException
      *          If a security manager has been installed and it denies
-     * {@link NetPermission}<tt>("setResponseCache")</tt>
+     * {@link NetPermission}{@code ("setResponseCache")}
      *
      * @see #getDefault()
      * @since 1.5
@@ -118,14 +118,14 @@
      * to get the network resource. If a cached response is returned,
      * that resource is used instead.
      *
-     * @param uri a <code>URI</code> used to reference the requested
+     * @param uri a {@code URI} used to reference the requested
      *            network resource
-     * @param rqstMethod a <code>String</code> representing the request
+     * @param rqstMethod a {@code String} representing the request
      *            method
      * @param rqstHeaders - a Map from request header
      *            field names to lists of field values representing
      *            the current request headers
-     * @return a <code>CacheResponse</code> instance if available
+     * @return a {@code CacheResponse} instance if available
      *          from cache, or null otherwise
      * @throws  IOException if an I/O error occurs
      * @throws  IllegalArgumentException if any one of the arguments is null
@@ -148,11 +148,11 @@
      * use to write the resource into the cache. If the resource is
      * not to be cached, then put must return null.
      *
-     * @param uri a <code>URI</code> used to reference the requested
+     * @param uri a {@code URI} used to reference the requested
      *            network resource
      * @param conn - a URLConnection instance that is used to fetch
      *            the response to be cached
-     * @return a <code>CacheRequest</code> for recording the
+     * @return a {@code CacheRequest} for recording the
      *            response to be cached. Null return indicates that
      *            the caller does not intend to cache the response.
      * @throws IOException if an I/O error occurs
--- a/jdk/src/share/classes/java/net/ServerSocket.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/ServerSocket.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,7 @@
  * based on that request, and then possibly returns a result to the requester.
  * <p>
  * The actual work of the server socket is performed by an instance
- * of the <code>SocketImpl</code> class. An application can
+ * of the {@code SocketImpl} class. An application can
  * change the socket factory that creates the socket
  * implementation to configure itself to create sockets
  * appropriate to the local firewall.
@@ -89,31 +89,31 @@
 
     /**
      * Creates a server socket, bound to the specified port. A port number
-     * of <code>0</code> means that the port number is automatically
+     * of {@code 0} means that the port number is automatically
      * allocated, typically from an ephemeral port range. This port
      * number can then be retrieved by calling {@link #getLocalPort getLocalPort}.
      * <p>
      * The maximum queue length for incoming connection indications (a
-     * request to connect) is set to <code>50</code>. If a connection
+     * request to connect) is set to {@code 50}. If a connection
      * indication arrives when the queue is full, the connection is refused.
      * <p>
      * If the application has specified a server socket factory, that
-     * factory's <code>createSocketImpl</code> method is called to create
+     * factory's {@code createSocketImpl} method is called to create
      * the actual socket implementation. Otherwise a "plain" socket is created.
      * <p>
      * If there is a security manager,
-     * its <code>checkListen</code> method is called
-     * with the <code>port</code> argument
+     * its {@code checkListen} method is called
+     * with the {@code port} argument
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
      *
-     * @param      port  the port number, or <code>0</code> to use a port
+     * @param      port  the port number, or {@code 0} to use a port
      *                   number that is automatically allocated.
      *
      * @exception  IOException  if an I/O error occurs when opening the socket.
      * @exception  SecurityException
-     * if a security manager exists and its <code>checkListen</code>
+     * if a security manager exists and its {@code checkListen}
      * method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
@@ -131,42 +131,42 @@
     /**
      * Creates a server socket and binds it to the specified local port
      * number, with the specified backlog.
-     * A port number of <code>0</code> means that the port number is
+     * A port number of {@code 0} means that the port number is
      * automatically allocated, typically from an ephemeral port range.
      * This port number can then be retrieved by calling
      * {@link #getLocalPort getLocalPort}.
      * <p>
      * The maximum queue length for incoming connection indications (a
-     * request to connect) is set to the <code>backlog</code> parameter. If
+     * request to connect) is set to the {@code backlog} parameter. If
      * a connection indication arrives when the queue is full, the
      * connection is refused.
      * <p>
      * If the application has specified a server socket factory, that
-     * factory's <code>createSocketImpl</code> method is called to create
+     * factory's {@code createSocketImpl} method is called to create
      * the actual socket implementation. Otherwise a "plain" socket is created.
      * <p>
      * If there is a security manager,
-     * its <code>checkListen</code> method is called
-     * with the <code>port</code> argument
+     * its {@code checkListen} method is called
+     * with the {@code port} argument
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
-     * The <code>backlog</code> argument is the requested maximum number of
+     * The {@code backlog} argument is the requested maximum number of
      * pending connections on the socket. Its exact semantics are implementation
      * specific. In particular, an implementation may impose a maximum length
      * or may choose to ignore the parameter altogther. The value provided
-     * should be greater than <code>0</code>. If it is less than or equal to
-     * <code>0</code>, then an implementation specific default will be used.
+     * should be greater than {@code 0}. If it is less than or equal to
+     * {@code 0}, then an implementation specific default will be used.
      * <P>
      *
-     * @param      port     the port number, or <code>0</code> to use a port
+     * @param      port     the port number, or {@code 0} to use a port
      *                      number that is automatically allocated.
      * @param      backlog  requested maximum length of the queue of incoming
      *                      connections.
      *
      * @exception  IOException  if an I/O error occurs when opening the socket.
      * @exception  SecurityException
-     * if a security manager exists and its <code>checkListen</code>
+     * if a security manager exists and its {@code checkListen}
      * method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
@@ -189,32 +189,32 @@
      * If <i>bindAddr</i> is null, it will default accepting
      * connections on any/all local addresses.
      * The port must be between 0 and 65535, inclusive.
-     * A port number of <code>0</code> means that the port number is
+     * A port number of {@code 0} means that the port number is
      * automatically allocated, typically from an ephemeral port range.
      * This port number can then be retrieved by calling
      * {@link #getLocalPort getLocalPort}.
      *
      * <P>If there is a security manager, this method
-     * calls its <code>checkListen</code> method
-     * with the <code>port</code> argument
+     * calls its {@code checkListen} method
+     * with the {@code port} argument
      * as its argument to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
-     * The <code>backlog</code> argument is the requested maximum number of
+     * The {@code backlog} argument is the requested maximum number of
      * pending connections on the socket. Its exact semantics are implementation
      * specific. In particular, an implementation may impose a maximum length
      * or may choose to ignore the parameter altogther. The value provided
-     * should be greater than <code>0</code>. If it is less than or equal to
-     * <code>0</code>, then an implementation specific default will be used.
+     * should be greater than {@code 0}. If it is less than or equal to
+     * {@code 0}, then an implementation specific default will be used.
      * <P>
-     * @param port  the port number, or <code>0</code> to use a port
+     * @param port  the port number, or {@code 0} to use a port
      *              number that is automatically allocated.
      * @param backlog requested maximum length of the queue of incoming
      *                connections.
      * @param bindAddr the local InetAddress the server will bind to
      *
      * @throws  SecurityException if a security manager exists and
-     * its <code>checkListen</code> method doesn't allow the operation.
+     * its {@code checkListen} method doesn't allow the operation.
      *
      * @throws  IOException if an I/O error occurs when opening the socket.
      * @exception  IllegalArgumentException if the port parameter is outside
@@ -245,10 +245,10 @@
     }
 
     /**
-     * Get the <code>SocketImpl</code> attached to this socket, creating
+     * Get the {@code SocketImpl} attached to this socket, creating
      * it if necessary.
      *
-     * @return  the <code>SocketImpl</code> attached to that ServerSocket.
+     * @return  the {@code SocketImpl} attached to that ServerSocket.
      * @throws SocketException if creation fails.
      * @since 1.4
      */
@@ -310,17 +310,17 @@
 
     /**
      *
-     * Binds the <code>ServerSocket</code> to a specific address
+     * Binds the {@code ServerSocket} to a specific address
      * (IP address and port number).
      * <p>
-     * If the address is <code>null</code>, then the system will pick up
+     * If the address is {@code null}, then the system will pick up
      * an ephemeral port and a valid local address to bind the socket.
      * <p>
      * @param   endpoint        The IP address and port number to bind to.
      * @throws  IOException if the bind operation fails, or if the socket
      *                     is already bound.
-     * @throws  SecurityException       if a <code>SecurityManager</code> is present and
-     * its <code>checkListen</code> method doesn't allow the operation.
+     * @throws  SecurityException       if a {@code SecurityManager} is present and
+     * its {@code checkListen} method doesn't allow the operation.
      * @throws  IllegalArgumentException if endpoint is a
      *          SocketAddress subclass not supported by this socket
      * @since 1.4
@@ -331,25 +331,25 @@
 
     /**
      *
-     * Binds the <code>ServerSocket</code> to a specific address
+     * Binds the {@code ServerSocket} to a specific address
      * (IP address and port number).
      * <p>
-     * If the address is <code>null</code>, then the system will pick up
+     * If the address is {@code null}, then the system will pick up
      * an ephemeral port and a valid local address to bind the socket.
      * <P>
-     * The <code>backlog</code> argument is the requested maximum number of
+     * The {@code backlog} argument is the requested maximum number of
      * pending connections on the socket. Its exact semantics are implementation
      * specific. In particular, an implementation may impose a maximum length
      * or may choose to ignore the parameter altogther. The value provided
-     * should be greater than <code>0</code>. If it is less than or equal to
-     * <code>0</code>, then an implementation specific default will be used.
+     * should be greater than {@code 0}. If it is less than or equal to
+     * {@code 0}, then an implementation specific default will be used.
      * @param   endpoint        The IP address and port number to bind to.
      * @param   backlog         requested maximum length of the queue of
      *                          incoming connections.
      * @throws  IOException if the bind operation fails, or if the socket
      *                     is already bound.
-     * @throws  SecurityException       if a <code>SecurityManager</code> is present and
-     * its <code>checkListen</code> method doesn't allow the operation.
+     * @throws  SecurityException       if a {@code SecurityManager} is present and
+     * its {@code checkListen} method doesn't allow the operation.
      * @throws  IllegalArgumentException if endpoint is a
      *          SocketAddress subclass not supported by this socket
      * @since 1.4
@@ -480,18 +480,18 @@
      * Listens for a connection to be made to this socket and accepts
      * it. The method blocks until a connection is made.
      *
-     * <p>A new Socket <code>s</code> is created and, if there
+     * <p>A new Socket {@code s} is created and, if there
      * is a security manager,
-     * the security manager's <code>checkAccept</code> method is called
-     * with <code>s.getInetAddress().getHostAddress()</code> and
-     * <code>s.getPort()</code>
+     * the security manager's {@code checkAccept} method is called
+     * with {@code s.getInetAddress().getHostAddress()} and
+     * {@code s.getPort()}
      * as its arguments to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
      * @exception  IOException  if an I/O error occurs when waiting for a
      *               connection.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkAccept</code> method doesn't allow the operation.
+     *             {@code checkAccept} method doesn't allow the operation.
      * @exception  SocketTimeoutException if a timeout was previously set with setSoTimeout and
      *             the timeout has been reached.
      * @exception  java.nio.channels.IllegalBlockingModeException
@@ -597,7 +597,7 @@
      * method.
      *
      * @return  the server-socket channel associated with this socket,
-     *          or <tt>null</tt> if this socket was not created
+     *          or {@code null} if this socket was not created
      *          for a channel
      *
      * @since 1.4
@@ -678,18 +678,18 @@
      * <p>
      * When a TCP connection is closed the connection may remain
      * in a timeout state for a period of time after the connection
-     * is closed (typically known as the <tt>TIME_WAIT</tt> state
-     * or <tt>2MSL</tt> wait state).
+     * is closed (typically known as the {@code TIME_WAIT} state
+     * or {@code 2MSL} wait state).
      * For applications using a well known socket address or port
      * it may not be possible to bind a socket to the required
-     * <tt>SocketAddress</tt> if there is a connection in the
+     * {@code SocketAddress} if there is a connection in the
      * timeout state involving the socket address or port.
      * <p>
      * Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} prior to
      * binding the socket using {@link #bind(SocketAddress)} allows the socket
      * to be bound even though a previous connection is in a timeout state.
      * <p>
-     * When a <tt>ServerSocket</tt> is created the initial setting
+     * When a {@code ServerSocket} is created the initial setting
      * of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is not defined.
      * Applications can use {@link #getReuseAddress()} to determine the initial
      * setting of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}.
@@ -717,7 +717,7 @@
     /**
      * Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
      *
-     * @return a <code>boolean</code> indicating whether or not
+     * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -732,7 +732,7 @@
 
     /**
      * Returns the implementation address and implementation port of
-     * this socket as a <code>String</code>.
+     * this socket as a {@code String}.
      * <p>
      * If there is a security manager set, its {@code checkConnect} method is
      * called with the local address and {@code -1} as its arguments to see
@@ -773,14 +773,14 @@
      * application. The factory can be specified only once.
      * <p>
      * When an application creates a new server socket, the socket
-     * implementation factory's <code>createSocketImpl</code> method is
+     * implementation factory's {@code createSocketImpl} method is
      * called to create the actual socket implementation.
      * <p>
-     * Passing <code>null</code> to the method is a no-op unless the factory
+     * Passing {@code null} to the method is a no-op unless the factory
      * was already set.
      * <p>
      * If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
@@ -789,7 +789,7 @@
      *               socket factory.
      * @exception  SocketException  if the factory has already been defined.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't allow the operation.
+     *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        java.net.SocketImplFactory#createSocketImpl()
      * @see        SecurityManager#checkSetFactory
      */
@@ -807,7 +807,7 @@
     /**
      * Sets a default proposed value for the
      * {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option for sockets
-     * accepted from this <tt>ServerSocket</tt>. The value actually set
+     * accepted from this {@code ServerSocket}. The value actually set
      * in the accepted socket must be determined by calling
      * {@link Socket#getReceiveBufferSize()} after the socket
      * is returned by {@link #accept()}.
@@ -851,13 +851,13 @@
 
     /**
      * Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option
-     * for this <tt>ServerSocket</tt>, that is the proposed buffer size that
-     * will be used for Sockets accepted from this <tt>ServerSocket</tt>.
+     * for this {@code ServerSocket}, that is the proposed buffer size that
+     * will be used for Sockets accepted from this {@code ServerSocket}.
      *
      * <p>Note, the value actually set in the accepted socket is determined by
      * calling {@link Socket#getReceiveBufferSize()}.
      * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF}
-     *         option for this <tt>Socket</tt>.
+     *         option for this {@code Socket}.
      * @exception SocketException if there is an error
      *            in the underlying protocol, such as a TCP error.
      * @see #setReceiveBufferSize(int)
@@ -891,24 +891,24 @@
      * compared, with larger values indicating stronger preferences.  If the
      * application prefers short connection time over both low latency and high
      * bandwidth, for example, then it could invoke this method with the values
-     * <tt>(1, 0, 0)</tt>.  If the application prefers high bandwidth above low
+     * {@code (1, 0, 0)}.  If the application prefers high bandwidth above low
      * latency, and low latency above short connection time, then it could
-     * invoke this method with the values <tt>(0, 1, 2)</tt>.
+     * invoke this method with the values {@code (0, 1, 2)}.
      *
      * <p> Invoking this method after this socket has been bound
      * will have no effect. This implies that in order to use this capability
      * requires the socket to be created with the no-argument constructor.
      *
      * @param  connectionTime
-     *         An <tt>int</tt> expressing the relative importance of a short
+     *         An {@code int} expressing the relative importance of a short
      *         connection time
      *
      * @param  latency
-     *         An <tt>int</tt> expressing the relative importance of low
+     *         An {@code int} expressing the relative importance of low
      *         latency
      *
      * @param  bandwidth
-     *         An <tt>int</tt> expressing the relative importance of high
+     *         An {@code int} expressing the relative importance of high
      *         bandwidth
      *
      * @since 1.5
--- a/jdk/src/share/classes/java/net/Socket.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/Socket.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@
  * between two machines.
  * <p>
  * The actual work of the socket is performed by an instance of the
- * <code>SocketImpl</code> class. An application, by changing
+ * {@code SocketImpl} class. An application, by changing
  * the socket factory that creates the socket implementation,
  * can configure itself to create sockets appropriate to the local
  * firewall.
@@ -88,14 +88,14 @@
      * Creates an unconnected socket, specifying the type of proxy, if any,
      * that should be used regardless of any other settings.
      * <P>
-     * If there is a security manager, its <code>checkConnect</code> method
+     * If there is a security manager, its {@code checkConnect} method
      * is called with the proxy host address and port number
      * as its arguments. This could result in a SecurityException.
      * <P>
      * Examples:
-     * <UL> <LI><code>Socket s = new Socket(Proxy.NO_PROXY);</code> will create
+     * <UL> <LI>{@code Socket s = new Socket(Proxy.NO_PROXY);} will create
      * a plain socket ignoring any other proxy configuration.</LI>
-     * <LI><code>Socket s = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("socks.mydom.com", 1080)));</code>
+     * <LI>{@code Socket s = new Socket(new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("socks.mydom.com", 1080)));}
      * will create a socket connecting through the specified SOCKS proxy
      * server.</LI>
      * </UL>
@@ -103,7 +103,7 @@
      * @param proxy a {@link java.net.Proxy Proxy} object specifying what kind
      *              of proxying should be used.
      * @throws IllegalArgumentException if the proxy is of an invalid type
-     *          or <code>null</code>.
+     *          or {@code null}.
      * @throws SecurityException if a security manager is present and
      *                           permission to connect to the proxy is
      *                           denied.
@@ -173,21 +173,22 @@
      * Creates a stream socket and connects it to the specified port
      * number on the named host.
      * <p>
-     * If the specified host is <tt>null</tt> it is the equivalent of
-     * specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>.
+     * If the specified host is {@code null} it is the equivalent of
+     * specifying the address as
+     * {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
      * In other words, it is equivalent to specifying an address of the
      * loopback interface. </p>
      * <p>
      * If the application has specified a server socket factory, that
-     * factory's <code>createSocketImpl</code> method is called to create
+     * factory's {@code createSocketImpl} method is called to create
      * the actual socket implementation. Otherwise a "plain" socket is created.
      * <p>
      * If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with the host address and <code>port</code>
+     * {@code checkConnect} method is called
+     * with the host address and {@code port}
      * as its arguments. This could result in a SecurityException.
      *
-     * @param      host   the host name, or <code>null</code> for the loopback address.
+     * @param      host   the host name, or {@code null} for the loopback address.
      * @param      port   the port number.
      *
      * @exception  UnknownHostException if the IP address of
@@ -195,7 +196,7 @@
      *
      * @exception  IOException  if an I/O error occurs when creating the socket.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkConnect</code> method doesn't allow the operation.
+     *             {@code checkConnect} method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
@@ -217,23 +218,23 @@
      * number at the specified IP address.
      * <p>
      * If the application has specified a socket factory, that factory's
-     * <code>createSocketImpl</code> method is called to create the
+     * {@code createSocketImpl} method is called to create the
      * actual socket implementation. Otherwise a "plain" socket is created.
      * <p>
      * If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with the host address and <code>port</code>
+     * {@code checkConnect} method is called
+     * with the host address and {@code port}
      * as its arguments. This could result in a SecurityException.
      *
      * @param      address   the IP address.
      * @param      port      the port number.
      * @exception  IOException  if an I/O error occurs when creating the socket.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkConnect</code> method doesn't allow the operation.
+     *             {@code checkConnect} method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
-     * @exception  NullPointerException if <code>address</code> is null.
+     * @exception  NullPointerException if {@code address} is null.
      * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
      * @see        java.net.SocketImpl
      * @see        java.net.SocketImplFactory#createSocketImpl()
@@ -249,28 +250,29 @@
      * the specified remote port. The Socket will also bind() to the local
      * address and port supplied.
      * <p>
-     * If the specified host is <tt>null</tt> it is the equivalent of
-     * specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>.
+     * If the specified host is {@code null} it is the equivalent of
+     * specifying the address as
+     * {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
      * In other words, it is equivalent to specifying an address of the
      * loopback interface. </p>
      * <p>
-     * A local port number of <code>zero</code> will let the system pick up a
-     * free port in the <code>bind</code> operation.</p>
+     * A local port number of {@code zero} will let the system pick up a
+     * free port in the {@code bind} operation.</p>
      * <p>
      * If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with the host address and <code>port</code>
+     * {@code checkConnect} method is called
+     * with the host address and {@code port}
      * as its arguments. This could result in a SecurityException.
      *
-     * @param host the name of the remote host, or <code>null</code> for the loopback address.
+     * @param host the name of the remote host, or {@code null} for the loopback address.
      * @param port the remote port
      * @param localAddr the local address the socket is bound to, or
-     *        <code>null</code> for the <code>anyLocal</code> address.
+     *        {@code null} for the {@code anyLocal} address.
      * @param localPort the local port the socket is bound to, or
-     *        <code>zero</code> for a system selected free port.
+     *        {@code zero} for a system selected free port.
      * @exception  IOException  if an I/O error occurs when creating the socket.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkConnect</code> method doesn't allow the operation.
+     *             {@code checkConnect} method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter or localPort
      *             parameter is outside the specified range of valid port values,
      *             which is between 0 and 65535, inclusive.
@@ -289,30 +291,31 @@
      * the specified remote port. The Socket will also bind() to the local
      * address and port supplied.
      * <p>
-     * If the specified local address is <tt>null</tt> it is the equivalent of
-     * specifying the address as the AnyLocal address (see <tt>{@link java.net.InetAddress#isAnyLocalAddress InetAddress.isAnyLocalAddress}()</tt>).
+     * If the specified local address is {@code null} it is the equivalent of
+     * specifying the address as the AnyLocal address
+     * (see {@link java.net.InetAddress#isAnyLocalAddress InetAddress.isAnyLocalAddress}{@code ()}).
      * <p>
-     * A local port number of <code>zero</code> will let the system pick up a
-     * free port in the <code>bind</code> operation.</p>
+     * A local port number of {@code zero} will let the system pick up a
+     * free port in the {@code bind} operation.</p>
      * <p>
      * If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with the host address and <code>port</code>
+     * {@code checkConnect} method is called
+     * with the host address and {@code port}
      * as its arguments. This could result in a SecurityException.
      *
      * @param address the remote address
      * @param port the remote port
      * @param localAddr the local address the socket is bound to, or
-     *        <code>null</code> for the <code>anyLocal</code> address.
+     *        {@code null} for the {@code anyLocal} address.
      * @param localPort the local port the socket is bound to or
-     *        <code>zero</code> for a system selected free port.
+     *        {@code zero} for a system selected free port.
      * @exception  IOException  if an I/O error occurs when creating the socket.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkConnect</code> method doesn't allow the operation.
+     *             {@code checkConnect} method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter or localPort
      *             parameter is outside the specified range of valid port values,
      *             which is between 0 and 65535, inclusive.
-     * @exception  NullPointerException if <code>address</code> is null.
+     * @exception  NullPointerException if {@code address} is null.
      * @see        SecurityManager#checkConnect
      * @since   JDK1.1
      */
@@ -326,33 +329,34 @@
      * Creates a stream socket and connects it to the specified port
      * number on the named host.
      * <p>
-     * If the specified host is <tt>null</tt> it is the equivalent of
-     * specifying the address as <tt>{@link java.net.InetAddress#getByName InetAddress.getByName}(null)</tt>.
+     * If the specified host is {@code null} it is the equivalent of
+     * specifying the address as
+     * {@link java.net.InetAddress#getByName InetAddress.getByName}{@code (null)}.
      * In other words, it is equivalent to specifying an address of the
      * loopback interface. </p>
      * <p>
-     * If the stream argument is <code>true</code>, this creates a
-     * stream socket. If the stream argument is <code>false</code>, it
+     * If the stream argument is {@code true}, this creates a
+     * stream socket. If the stream argument is {@code false}, it
      * creates a datagram socket.
      * <p>
      * If the application has specified a server socket factory, that
-     * factory's <code>createSocketImpl</code> method is called to create
+     * factory's {@code createSocketImpl} method is called to create
      * the actual socket implementation. Otherwise a "plain" socket is created.
      * <p>
      * If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with the host address and <code>port</code>
+     * {@code checkConnect} method is called
+     * with the host address and {@code port}
      * as its arguments. This could result in a SecurityException.
      * <p>
      * If a UDP socket is used, TCP/IP related socket options will not apply.
      *
-     * @param      host     the host name, or <code>null</code> for the loopback address.
+     * @param      host     the host name, or {@code null} for the loopback address.
      * @param      port     the port number.
-     * @param      stream   a <code>boolean</code> indicating whether this is
+     * @param      stream   a {@code boolean} indicating whether this is
      *                      a stream socket or a datagram socket.
      * @exception  IOException  if an I/O error occurs when creating the socket.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkConnect</code> method doesn't allow the operation.
+     *             {@code checkConnect} method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
@@ -373,32 +377,32 @@
      * Creates a socket and connects it to the specified port number at
      * the specified IP address.
      * <p>
-     * If the stream argument is <code>true</code>, this creates a
-     * stream socket. If the stream argument is <code>false</code>, it
+     * If the stream argument is {@code true}, this creates a
+     * stream socket. If the stream argument is {@code false}, it
      * creates a datagram socket.
      * <p>
      * If the application has specified a server socket factory, that
-     * factory's <code>createSocketImpl</code> method is called to create
+     * factory's {@code createSocketImpl} method is called to create
      * the actual socket implementation. Otherwise a "plain" socket is created.
      *
      * <p>If there is a security manager, its
-     * <code>checkConnect</code> method is called
-     * with <code>host.getHostAddress()</code> and <code>port</code>
+     * {@code checkConnect} method is called
+     * with {@code host.getHostAddress()} and {@code port}
      * as its arguments. This could result in a SecurityException.
      * <p>
      * If UDP socket is used, TCP/IP related socket options will not apply.
      *
      * @param      host     the IP address.
      * @param      port      the port number.
-     * @param      stream    if <code>true</code>, create a stream socket;
+     * @param      stream    if {@code true}, create a stream socket;
      *                       otherwise, create a datagram socket.
      * @exception  IOException  if an I/O error occurs when creating the socket.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkConnect</code> method doesn't allow the operation.
+     *             {@code checkConnect} method doesn't allow the operation.
      * @exception  IllegalArgumentException if the port parameter is outside
      *             the specified range of valid port values, which is between
      *             0 and 65535, inclusive.
-     * @exception  NullPointerException if <code>host</code> is null.
+     * @exception  NullPointerException if {@code host} is null.
      * @see        java.net.Socket#setSocketImplFactory(java.net.SocketImplFactory)
      * @see        java.net.SocketImpl
      * @see        java.net.SocketImplFactory#createSocketImpl()
@@ -437,8 +441,8 @@
     /**
      * Creates the socket implementation.
      *
-     * @param stream a <code>boolean</code> value : <code>true</code> for a TCP socket,
-     *               <code>false</code> for UDP.
+     * @param stream a {@code boolean} value : {@code true} for a TCP socket,
+     *               {@code false} for UDP.
      * @throws IOException if creation fails
      * @since 1.4
      */
@@ -500,10 +504,10 @@
 
 
     /**
-     * Get the <code>SocketImpl</code> attached to this socket, creating
+     * Get the {@code SocketImpl} attached to this socket, creating
      * it if necessary.
      *
-     * @return  the <code>SocketImpl</code> attached to that ServerSocket.
+     * @return  the {@code SocketImpl} attached to that ServerSocket.
      * @throws SocketException if creation fails
      * @since 1.4
      */
@@ -516,7 +520,7 @@
     /**
      * Connects this socket to the server.
      *
-     * @param   endpoint the <code>SocketAddress</code>
+     * @param   endpoint the {@code SocketAddress}
      * @throws  IOException if an error occurs during the connection
      * @throws  java.nio.channels.IllegalBlockingModeException
      *          if this socket has an associated channel,
@@ -535,7 +539,7 @@
      * A timeout of zero is interpreted as an infinite timeout. The connection
      * will then block until established or an error occurs.
      *
-     * @param   endpoint the <code>SocketAddress</code>
+     * @param   endpoint the {@code SocketAddress}
      * @param   timeout  the timeout value to be used in milliseconds.
      * @throws  IOException if an error occurs during the connection
      * @throws  SocketTimeoutException if timeout expires before connecting
@@ -597,10 +601,10 @@
     /**
      * Binds the socket to a local address.
      * <P>
-     * If the address is <code>null</code>, then the system will pick up
+     * If the address is {@code null}, then the system will pick up
      * an ephemeral port and a valid local address to bind the socket.
      *
-     * @param   bindpoint the <code>SocketAddress</code> to bind to
+     * @param   bindpoint the {@code SocketAddress} to bind to
      * @throws  IOException if the bind operation fails, or if the socket
      *                     is already bound.
      * @throws  IllegalArgumentException if bindpoint is a
@@ -668,7 +672,7 @@
      * after the socket is closed.
      *
      * @return  the remote IP address to which this socket is connected,
-     *          or <code>null</code> if the socket is not connected.
+     *          or {@code null} if the socket is not connected.
      */
     public InetAddress getInetAddress() {
         if (!isConnected())
@@ -760,15 +764,15 @@
 
     /**
      * Returns the address of the endpoint this socket is connected to, or
-     * <code>null</code> if it is unconnected.
+     * {@code null} if it is unconnected.
      * <p>
      * If the socket was connected prior to being {@link #close closed},
      * then this method will continue to return the connected address
      * after the socket is closed.
      *
 
-     * @return a <code>SocketAddress</code> representing the remote endpoint of this
-     *         socket, or <code>null</code> if it is not connected yet.
+     * @return a {@code SocketAddress} representing the remote endpoint of this
+     *         socket, or {@code null} if it is not connected yet.
      * @see #getInetAddress()
      * @see #getPort()
      * @see #connect(SocketAddress, int)
@@ -785,10 +789,10 @@
      * Returns the address of the endpoint this socket is bound to.
      * <p>
      * If a socket bound to an endpoint represented by an
-     * <code>InetSocketAddress </code> is {@link #close closed},
-     * then this method will continue to return an <code>InetSocketAddress</code>
+     * {@code InetSocketAddress } is {@link #close closed},
+     * then this method will continue to return an {@code InetSocketAddress}
      * after the socket is closed. In that case the returned
-     * <code>InetSocketAddress</code>'s address is the
+     * {@code InetSocketAddress}'s address is the
      * {@link InetAddress#isAnyLocalAddress wildcard} address
      * and its port is the local port that it was bound to.
      * <p>
@@ -828,7 +832,7 @@
      * methods.
      *
      * @return  the socket channel associated with this socket,
-     *          or <tt>null</tt> if this socket was not created
+     *          or {@code null} if this socket was not created
      *          for a channel
      *
      * @since 1.4
@@ -843,7 +847,7 @@
      *
      * <p> If this socket has an associated channel then the resulting input
      * stream delegates all of its operations to the channel.  If the channel
-     * is in non-blocking mode then the input stream's <tt>read</tt> operations
+     * is in non-blocking mode then the input stream's {@code read} operations
      * will throw an {@link java.nio.channels.IllegalBlockingModeException}.
      *
      * <p>Under abnormal conditions the underlying connection may be
@@ -867,7 +871,7 @@
      *   <li><p>If there are no bytes buffered on the socket, and the
      *   socket has not been closed using {@link #close close}, then
      *   {@link java.io.InputStream#available available} will
-     *   return <code>0</code>.
+     *   return {@code 0}.
      *
      * </ul>
      *
@@ -910,7 +914,7 @@
      *
      * <p> If this socket has an associated channel then the resulting output
      * stream delegates all of its operations to the channel.  If the channel
-     * is in non-blocking mode then the output stream's <tt>write</tt>
+     * is in non-blocking mode then the output stream's {@code write}
      * operations will throw an {@link
      * java.nio.channels.IllegalBlockingModeException}.
      *
@@ -949,8 +953,8 @@
      * Enable/disable {@link SocketOptions#TCP_NODELAY TCP_NODELAY}
      * (disable/enable Nagle's algorithm).
      *
-     * @param on <code>true</code> to enable TCP_NODELAY,
-     * <code>false</code> to disable.
+     * @param on {@code true} to enable TCP_NODELAY,
+     * {@code false} to disable.
      *
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -968,7 +972,7 @@
     /**
      * Tests if {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled.
      *
-     * @return a <code>boolean</code> indicating whether or not
+     * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#TCP_NODELAY TCP_NODELAY} is enabled.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -1066,9 +1070,9 @@
      * and there is no capability to distinguish between normal data and urgent
      * data unless provided by a higher level protocol.
      *
-     * @param on <code>true</code> to enable
+     * @param on {@code true} to enable
      *           {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE},
-     *           <code>false</code> to disable.
+     *           {@code false} to disable.
      *
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -1086,7 +1090,7 @@
     /**
      * Tests if {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE} is enabled.
      *
-     * @return a <code>boolean</code> indicating whether or not
+     * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_OOBINLINE SO_OOBINLINE}is enabled.
      *
      * @exception SocketException if there is an error
@@ -1151,7 +1155,7 @@
 
     /**
      * Sets the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option to the
-     * specified value for this <tt>Socket</tt>.
+     * specified value for this {@code Socket}.
      * The {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option is used by the
      * platform's networking code as a hint for the size to set the underlying
      * network I/O buffers.
@@ -1184,10 +1188,10 @@
 
     /**
      * Get value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF} option
-     * for this <tt>Socket</tt>, that is the buffer size used by the platform
-     * for output on this <tt>Socket</tt>.
+     * for this {@code Socket}, that is the buffer size used by the platform
+     * for output on this {@code Socket}.
      * @return the value of the {@link SocketOptions#SO_SNDBUF SO_SNDBUF}
-     *         option for this <tt>Socket</tt>.
+     *         option for this {@code Socket}.
      *
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -1208,7 +1212,7 @@
 
     /**
      * Sets the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option to the
-     * specified value for this <tt>Socket</tt>. The
+     * specified value for this {@code Socket}. The
      * {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option is
      * used by the platform's networking code as a hint for the size to set
      * the underlying network I/O buffers.
@@ -1258,11 +1262,11 @@
 
     /**
      * Gets the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF} option
-     * for this <tt>Socket</tt>, that is the buffer size used by the platform
-     * for input on this <tt>Socket</tt>.
+     * for this {@code Socket}, that is the buffer size used by the platform
+     * for input on this {@code Socket}.
      *
      * @return the value of the {@link SocketOptions#SO_RCVBUF SO_RCVBUF}
-     *         option for this <tt>Socket</tt>.
+     *         option for this {@code Socket}.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
      * @see #setReceiveBufferSize(int)
@@ -1298,7 +1302,7 @@
     /**
      * Tests if {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled.
      *
-     * @return a <code>boolean</code> indicating whether or not
+     * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_KEEPALIVE SO_KEEPALIVE} is enabled.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -1321,7 +1325,7 @@
      * 255} or an IllegalArgumentException will be thrown.
      * <p>Notes:
      * <p>For Internet Protocol v4 the value consists of an
-     * <code>integer</code>, the least significant 8 bits of which
+     * {@code integer}, the least significant 8 bits of which
      * represent the value of the TOS octet in IP packets sent by
      * the socket.
      * RFC 1349 defines the TOS values as follows:
@@ -1347,10 +1351,10 @@
      * in the underlying platform. Applications should not assume that
      * they can change the TOS field after the connection.
      * <p>
-     * For Internet Protocol v6 <code>tc</code> is the value that
+     * For Internet Protocol v6 {@code tc} is the value that
      * would be placed into the sin6_flowinfo field of the IP header.
      *
-     * @param tc        an <code>int</code> value for the bitset.
+     * @param tc        an {@code int} value for the bitset.
      * @throws SocketException if there is an error setting the
      * traffic class or type-of-service
      * @since 1.4
@@ -1392,11 +1396,11 @@
      * <p>
      * When a TCP connection is closed the connection may remain
      * in a timeout state for a period of time after the connection
-     * is closed (typically known as the <tt>TIME_WAIT</tt> state
-     * or <tt>2MSL</tt> wait state).
+     * is closed (typically known as the {@code TIME_WAIT} state
+     * or {@code 2MSL} wait state).
      * For applications using a well known socket address or port
      * it may not be possible to bind a socket to the required
-     * <tt>SocketAddress</tt> if there is a connection in the
+     * {@code SocketAddress} if there is a connection in the
      * timeout state involving the socket address or port.
      * <p>
      * Enabling {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR}
@@ -1404,7 +1408,7 @@
      * the socket to be bound even though a previous connection is in a timeout
      * state.
      * <p>
-     * When a <tt>Socket</tt> is created the initial setting
+     * When a {@code Socket} is created the initial setting
      * of {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is disabled.
      * <p>
      * The behaviour when {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is
@@ -1430,7 +1434,7 @@
     /**
      * Tests if {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
      *
-     * @return a <code>boolean</code> indicating whether or not
+     * @return a {@code boolean} indicating whether or not
      *         {@link SocketOptions#SO_REUSEADDR SO_REUSEADDR} is enabled.
      * @exception SocketException if there is an error
      * in the underlying protocol, such as a TCP error.
@@ -1536,7 +1540,7 @@
     }
 
     /**
-     * Converts this socket to a <code>String</code>.
+     * Converts this socket to a {@code String}.
      *
      * @return  a string representation of this socket.
      */
@@ -1555,7 +1559,7 @@
      * Returns the connection state of the socket.
      * <p>
      * Note: Closing a socket doesn't clear its connection state, which means
-     * this method will return <code>true</code> for a closed socket
+     * this method will return {@code true} for a closed socket
      * (see {@link #isClosed()}) if it was successfuly connected prior
      * to being closed.
      *
@@ -1571,7 +1575,7 @@
      * Returns the binding state of the socket.
      * <p>
      * Note: Closing a socket doesn't clear its binding state, which means
-     * this method will return <code>true</code> for a closed socket
+     * this method will return {@code true} for a closed socket
      * (see {@link #isClosed()}) if it was successfuly bound prior
      * to being closed.
      *
@@ -1629,13 +1633,13 @@
      * application. The factory can be specified only once.
      * <p>
      * When an application creates a new client socket, the socket
-     * implementation factory's <code>createSocketImpl</code> method is
+     * implementation factory's {@code createSocketImpl} method is
      * called to create the actual socket implementation.
      * <p>
-     * Passing <code>null</code> to the method is a no-op unless the factory
+     * Passing {@code null} to the method is a no-op unless the factory
      * was already set.
      * <p>If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
@@ -1644,7 +1648,7 @@
      *               socket factory.
      * @exception  SocketException  if the factory is already defined.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't allow the operation.
+     *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        java.net.SocketImplFactory#createSocketImpl()
      * @see        SecurityManager#checkSetFactory
      */
@@ -1678,23 +1682,23 @@
      * values represent a lower priority than positive values. If the
      * application prefers short connection time over both low latency and high
      * bandwidth, for example, then it could invoke this method with the values
-     * <tt>(1, 0, 0)</tt>.  If the application prefers high bandwidth above low
+     * {@code (1, 0, 0)}.  If the application prefers high bandwidth above low
      * latency, and low latency above short connection time, then it could
-     * invoke this method with the values <tt>(0, 1, 2)</tt>.
+     * invoke this method with the values {@code (0, 1, 2)}.
      *
      * <p> Invoking this method after this socket has been connected
      * will have no effect.
      *
      * @param  connectionTime
-     *         An <tt>int</tt> expressing the relative importance of a short
+     *         An {@code int} expressing the relative importance of a short
      *         connection time
      *
      * @param  latency
-     *         An <tt>int</tt> expressing the relative importance of low
+     *         An {@code int} expressing the relative importance of low
      *         latency
      *
      * @param  bandwidth
-     *         An <tt>int</tt> expressing the relative importance of high
+     *         An {@code int} expressing the relative importance of high
      *         bandwidth
      *
      * @since 1.5
--- a/jdk/src/share/classes/java/net/SocketException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
     private static final long serialVersionUID = -5935874303556886934L;
 
     /**
-     * Constructs a new <code>SocketException</code> with the
+     * Constructs a new {@code SocketException} with the
      * specified detail message.
      *
      * @param msg the detail message.
@@ -48,7 +48,7 @@
     }
 
     /**
-     * Constructs a new <code>SocketException</code> with no detail message.
+     * Constructs a new {@code SocketException} with no detail message.
      */
     public SocketException() {
     }
--- a/jdk/src/share/classes/java/net/SocketImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
 import java.io.FileDescriptor;
 
 /**
- * The abstract class <code>SocketImpl</code> is a common superclass
+ * The abstract class {@code SocketImpl} is a common superclass
  * of all classes that actually implement sockets. It is used to
  * create both client and server sockets.
  * <p>
@@ -71,7 +71,7 @@
     /**
      * Creates either a stream or a datagram socket.
      *
-     * @param      stream   if <code>true</code>, create a stream socket;
+     * @param      stream   if {@code true}, create a stream socket;
      *                      otherwise, create a datagram socket.
      * @exception  IOException  if an I/O error occurs while creating the
      *               socket.
@@ -122,7 +122,7 @@
 
     /**
      * Sets the maximum queue length for incoming connection indications
-     * (a request to connect) to the <code>count</code> argument. If a
+     * (a request to connect) to the {@code count} argument. If a
      * connection indication arrives when the queue is full, the
      * connection is refused.
      *
@@ -217,9 +217,9 @@
     }
 
     /**
-     * Returns the value of this socket's <code>fd</code> field.
+     * Returns the value of this socket's {@code fd} field.
      *
-     * @return  the value of this socket's <code>fd</code> field.
+     * @return  the value of this socket's {@code fd} field.
      * @see     java.net.SocketImpl#fd
      */
     protected FileDescriptor getFileDescriptor() {
@@ -227,9 +227,9 @@
     }
 
     /**
-     * Returns the value of this socket's <code>address</code> field.
+     * Returns the value of this socket's {@code address} field.
      *
-     * @return  the value of this socket's <code>address</code> field.
+     * @return  the value of this socket's {@code address} field.
      * @see     java.net.SocketImpl#address
      */
     protected InetAddress getInetAddress() {
@@ -237,9 +237,9 @@
     }
 
     /**
-     * Returns the value of this socket's <code>port</code> field.
+     * Returns the value of this socket's {@code port} field.
      *
-     * @return  the value of this socket's <code>port</code> field.
+     * @return  the value of this socket's {@code port} field.
      * @see     java.net.SocketImpl#port
      */
     protected int getPort() {
@@ -270,9 +270,9 @@
     protected abstract void sendUrgentData (int data) throws IOException;
 
     /**
-     * Returns the value of this socket's <code>localport</code> field.
+     * Returns the value of this socket's {@code localport} field.
      *
-     * @return  the value of this socket's <code>localport</code> field.
+     * @return  the value of this socket's {@code localport} field.
      * @see     java.net.SocketImpl#localport
      */
     protected int getLocalPort() {
@@ -296,7 +296,7 @@
     }
 
     /**
-     * Returns the address and port of this socket as a <code>String</code>.
+     * Returns the address and port of this socket as a {@code String}.
      *
      * @return  a string representation of this socket.
      */
@@ -328,23 +328,23 @@
      * values represent a lower priority than positive values. If the
      * application prefers short connection time over both low latency and high
      * bandwidth, for example, then it could invoke this method with the values
-     * <tt>(1, 0, 0)</tt>.  If the application prefers high bandwidth above low
+     * {@code (1, 0, 0)}.  If the application prefers high bandwidth above low
      * latency, and low latency above short connection time, then it could
-     * invoke this method with the values <tt>(0, 1, 2)</tt>.
+     * invoke this method with the values {@code (0, 1, 2)}.
      *
      * By default, this method does nothing, unless it is overridden in a
      * a sub-class.
      *
      * @param  connectionTime
-     *         An <tt>int</tt> expressing the relative importance of a short
+     *         An {@code int} expressing the relative importance of a short
      *         connection time
      *
      * @param  latency
-     *         An <tt>int</tt> expressing the relative importance of low
+     *         An {@code int} expressing the relative importance of low
      *         latency
      *
      * @param  bandwidth
-     *         An <tt>int</tt> expressing the relative importance of high
+     *         An {@code int} expressing the relative importance of high
      *         bandwidth
      *
      * @since 1.5
--- a/jdk/src/share/classes/java/net/SocketImplFactory.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketImplFactory.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,8 +27,8 @@
 
 /**
  * This interface defines a factory for socket implementations. It
- * is used by the classes <code>Socket</code> and
- * <code>ServerSocket</code> to create actual socket
+ * is used by the classes {@code Socket} and
+ * {@code ServerSocket} to create actual socket
  * implementations.
  *
  * @author  Arthur van Hoff
@@ -39,9 +39,9 @@
 public
 interface SocketImplFactory {
     /**
-     * Creates a new <code>SocketImpl</code> instance.
+     * Creates a new {@code SocketImpl} instance.
      *
-     * @return  a new instance of <code>SocketImpl</code>.
+     * @return  a new instance of {@code SocketImpl}.
      * @see     java.net.SocketImpl
      */
     SocketImpl createSocketImpl();
--- a/jdk/src/share/classes/java/net/SocketInputStream.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketInputStream.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,8 +67,8 @@
      * Returns the unique {@link java.nio.channels.FileChannel FileChannel}
      * object associated with this file input stream.</p>
      *
-     * The <code>getChannel</code> method of <code>SocketInputStream</code>
-     * returns <code>null</code> since it is a socket based stream.</p>
+     * The {@code getChannel} method of {@code SocketInputStream}
+     * returns {@code null} since it is a socket based stream.</p>
      *
      * @return  the file channel associated with this file input stream
      *
--- a/jdk/src/share/classes/java/net/SocketOptions.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketOptions.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -115,7 +115,7 @@
      * }
      * </PRE>
      *
-     * @param optID an <code>int</code> identifying the option to fetch
+     * @param optID an {@code int} identifying the option to fetch
      * @return the value of the option
      * @throws SocketException if the socket is closed
      * @throws SocketException if <I>optID</I> is unknown along the
--- a/jdk/src/share/classes/java/net/SocketOutputStream.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketOutputStream.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -64,8 +64,8 @@
      * Returns the unique {@link java.nio.channels.FileChannel FileChannel}
      * object associated with this file output stream. </p>
      *
-     * The <code>getChannel</code> method of <code>SocketOutputStream</code>
-     * returns <code>null</code> since it is a socket based stream.</p>
+     * The {@code getChannel} method of {@code SocketOutputStream}
+     * returns {@code null} since it is a socket based stream.</p>
      *
      * @return  the file channel associated with this file output stream
      *
--- a/jdk/src/share/classes/java/net/SocketPermission.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocketPermission.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,7 +110,7 @@
  * </pre>
  *
  * is granted to some code, it allows that code to connect to port 7777 on
- * <code>puffin.eng.sun.com</code>, and to accept connections on that port.
+ * {@code puffin.eng.sun.com}, and to accept connections on that port.
  *
  * <p>Similarly, if the following permission:
  *
@@ -788,7 +788,7 @@
      * port range is ignored when p only contains the action, 'resolve'.<p>
      * </ul>
      *
-     * Then <code>implies</code> checks each of the following, in order,
+     * Then {@code implies} checks each of the following, in order,
      * and for each returns true if the stated condition is true:<p>
      * <ul>
      * <li> If this object was initialized with a single IP address and one of <i>p</i>'s
@@ -802,7 +802,7 @@
      * <li>If this canonical name equals <i>p</i>'s canonical name.<p>
      * </ul>
      *
-     * If none of the above are true, <code>implies</code> returns false.
+     * If none of the above are true, {@code implies} returns false.
      * @param p the permission to check against.
      *
      * @return true if the specified permission is implied by this object,
@@ -1131,7 +1131,7 @@
      * <p>
      * SocketPermission objects must be stored in a manner that allows them
      * to be inserted into the collection in any order, but that also enables the
-     * PermissionCollection <code>implies</code>
+     * PermissionCollection {@code implies}
      * method to be implemented in an efficient (and consistent) manner.
      *
      * @return a new PermissionCollection object suitable for storing SocketPermissions.
--- a/jdk/src/share/classes/java/net/SocksSocketImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/SocksSocketImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -315,7 +315,7 @@
      * grants the connections, then the connect is successful and all
      * further traffic will go to the "real" endpoint.
      *
-     * @param   endpoint        the <code>SocketAddress</code> to connect to.
+     * @param   endpoint        the {@code SocketAddress} to connect to.
      * @param   timeout         the timeout value in milliseconds
      * @throws  IOException     if the connection can't be established.
      * @throws  SecurityException if there is a security manager and it
@@ -1032,9 +1032,9 @@
 
 
     /**
-     * Returns the value of this socket's <code>address</code> field.
+     * Returns the value of this socket's {@code address} field.
      *
-     * @return  the value of this socket's <code>address</code> field.
+     * @return  the value of this socket's {@code address} field.
      * @see     java.net.SocketImpl#address
      */
     @Override
@@ -1046,9 +1046,9 @@
     }
 
     /**
-     * Returns the value of this socket's <code>port</code> field.
+     * Returns the value of this socket's {@code port} field.
      *
-     * @return  the value of this socket's <code>port</code> field.
+     * @return  the value of this socket's {@code port} field.
      * @see     java.net.SocketImpl#port
      */
     @Override
--- a/jdk/src/share/classes/java/net/URI.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URI.java	Tue Aug 06 16:54:56 2013 -0700
@@ -67,24 +67,24 @@
  * form has the syntax
  *
  * <blockquote>
- * [<i>scheme</i><tt><b>:</b></tt>]<i>scheme-specific-part</i>[<tt><b>#</b></tt><i>fragment</i>]
+ * [<i>scheme</i><b>{@code :}</b>]<i>scheme-specific-part</i>[<b>{@code #}</b><i>fragment</i>]
  * </blockquote>
  *
  * where square brackets [...] delineate optional components and the characters
- * <tt><b>:</b></tt> and <tt><b>#</b></tt> stand for themselves.
+ * <b>{@code :}</b> and <b>{@code #}</b> stand for themselves.
  *
  * <p> An <i>absolute</i> URI specifies a scheme; a URI that is not absolute is
  * said to be <i>relative</i>.  URIs are also classified according to whether
  * they are <i>opaque</i> or <i>hierarchical</i>.
  *
  * <p> An <i>opaque</i> URI is an absolute URI whose scheme-specific part does
- * not begin with a slash character (<tt>'/'</tt>).  Opaque URIs are not
+ * not begin with a slash character ({@code '/'}).  Opaque URIs are not
  * subject to further parsing.  Some examples of opaque URIs are:
  *
  * <blockquote><table cellpadding=0 cellspacing=0 summary="layout">
- * <tr><td><tt>mailto:java-net@java.sun.com</tt><td></tr>
- * <tr><td><tt>news:comp.lang.java</tt><td></tr>
- * <tr><td><tt>urn:isbn:096139210x</tt></td></tr>
+ * <tr><td>{@code mailto:java-net@java.sun.com}<td></tr>
+ * <tr><td>{@code news:comp.lang.java}<td></tr>
+ * <tr><td>{@code urn:isbn:096139210x}</td></tr>
  * </table></blockquote>
  *
  * <p> A <i>hierarchical</i> URI is either an absolute URI whose
@@ -93,20 +93,20 @@
  * URIs are:
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/</tt><br>
- * <tt>docs/guide/collections/designfaq.html#28</tt><br>
- * <tt>../../../demo/jfc/SwingSet2/src/SwingSet2.java</tt><br>
- * <tt>file:///~/calendar</tt>
+ * {@code http://java.sun.com/j2se/1.3/}<br>
+ * {@code docs/guide/collections/designfaq.html#28}<br>
+ * {@code ../../../demo/jfc/SwingSet2/src/SwingSet2.java}<br>
+ * {@code file:///~/calendar}
  * </blockquote>
  *
  * <p> A hierarchical URI is subject to further parsing according to the syntax
  *
  * <blockquote>
- * [<i>scheme</i><tt><b>:</b></tt>][<tt><b>//</b></tt><i>authority</i>][<i>path</i>][<tt><b>?</b></tt><i>query</i>][<tt><b>#</b></tt><i>fragment</i>]
+ * [<i>scheme</i><b>{@code :}</b>][<b>{@code //}</b><i>authority</i>][<i>path</i>][<b>{@code ?}</b><i>query</i>][<b>{@code #}</b><i>fragment</i>]
  * </blockquote>
  *
- * where the characters <tt><b>:</b></tt>, <tt><b>/</b></tt>,
- * <tt><b>?</b></tt>, and <tt><b>#</b></tt> stand for themselves.  The
+ * where the characters <b>{@code :}</b>, <b>{@code /}</b>,
+ * <b>{@code ?}</b>, and <b>{@code #}</b> stand for themselves.  The
  * scheme-specific part of a hierarchical URI consists of the characters
  * between the scheme and fragment components.
  *
@@ -115,16 +115,16 @@
  * parses according to the familiar syntax
  *
  * <blockquote>
- * [<i>user-info</i><tt><b>@</b></tt>]<i>host</i>[<tt><b>:</b></tt><i>port</i>]
+ * [<i>user-info</i><b>{@code @}</b>]<i>host</i>[<b>{@code :}</b><i>port</i>]
  * </blockquote>
  *
- * where the characters <tt><b>@</b></tt> and <tt><b>:</b></tt> stand for
+ * where the characters <b>{@code @}</b> and <b>{@code :}</b> stand for
  * themselves.  Nearly all URI schemes currently in use are server-based.  An
  * authority component that does not parse in this way is considered to be
  * registry-based.
  *
  * <p> The path component of a hierarchical URI is itself said to be absolute
- * if it begins with a slash character (<tt>'/'</tt>); otherwise it is
+ * if it begins with a slash character ({@code '/'}); otherwise it is
  * relative.  The path of a hierarchical URI that is either absolute or
  * specifies an authority is always absolute.
  *
@@ -132,21 +132,21 @@
  *
  * <blockquote><table summary="Describes the components of a URI:scheme,scheme-specific-part,authority,user-info,host,port,path,query,fragment">
  * <tr><th><i>Component</i></th><th><i>Type</i></th></tr>
- * <tr><td>scheme</td><td><tt>String</tt></td></tr>
- * <tr><td>scheme-specific-part&nbsp;&nbsp;&nbsp;&nbsp;</td><td><tt>String</tt></td></tr>
- * <tr><td>authority</td><td><tt>String</tt></td></tr>
- * <tr><td>user-info</td><td><tt>String</tt></td></tr>
- * <tr><td>host</td><td><tt>String</tt></td></tr>
- * <tr><td>port</td><td><tt>int</tt></td></tr>
- * <tr><td>path</td><td><tt>String</tt></td></tr>
- * <tr><td>query</td><td><tt>String</tt></td></tr>
- * <tr><td>fragment</td><td><tt>String</tt></td></tr>
+ * <tr><td>scheme</td><td>{@code String}</td></tr>
+ * <tr><td>scheme-specific-part&nbsp;&nbsp;&nbsp;&nbsp;</td><td>{@code String}</td></tr>
+ * <tr><td>authority</td><td>{@code String}</td></tr>
+ * <tr><td>user-info</td><td>{@code String}</td></tr>
+ * <tr><td>host</td><td>{@code String}</td></tr>
+ * <tr><td>port</td><td>{@code int}</td></tr>
+ * <tr><td>path</td><td>{@code String}</td></tr>
+ * <tr><td>query</td><td>{@code String}</td></tr>
+ * <tr><td>fragment</td><td>{@code String}</td></tr>
  * </table></blockquote>
  *
  * In a given instance any particular component is either <i>undefined</i> or
  * <i>defined</i> with a distinct value.  Undefined string components are
- * represented by <tt>null</tt>, while undefined integer components are
- * represented by <tt>-1</tt>.  A string component may be defined to have the
+ * represented by {@code null}, while undefined integer components are
+ * represented by {@code -1}.  A string component may be defined to have the
  * empty string as its value; this is not equivalent to that component being
  * undefined.
  *
@@ -165,10 +165,10 @@
  * The key operations supported by this class are those of
  * <i>normalization</i>, <i>resolution</i>, and <i>relativization</i>.
  *
- * <p> <i>Normalization</i> is the process of removing unnecessary <tt>"."</tt>
- * and <tt>".."</tt> segments from the path component of a hierarchical URI.
- * Each <tt>"."</tt> segment is simply removed.  A <tt>".."</tt> segment is
- * removed only if it is preceded by a non-<tt>".."</tt> segment.
+ * <p> <i>Normalization</i> is the process of removing unnecessary {@code "."}
+ * and {@code ".."} segments from the path component of a hierarchical URI.
+ * Each {@code "."} segment is simply removed.  A {@code ".."} segment is
+ * removed only if it is preceded by a non-{@code ".."} segment.
  * Normalization has no effect upon opaque URIs.
  *
  * <p> <i>Resolution</i> is the process of resolving one URI against another,
@@ -179,45 +179,47 @@
  * normalized.  The result, for example, of resolving
  *
  * <blockquote>
- * <tt>docs/guide/collections/designfaq.html#28&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt>(1)
+ * {@code docs/guide/collections/designfaq.html#28}
+ * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+ * &nbsp;&nbsp;&nbsp;&nbsp;(1)
  * </blockquote>
  *
- * against the base URI <tt>http://java.sun.com/j2se/1.3/</tt> is the result
+ * against the base URI {@code http://java.sun.com/j2se/1.3/} is the result
  * URI
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28</tt>
+ * {@code http://java.sun.com/j2se/1.3/docs/guide/collections/designfaq.html#28}
  * </blockquote>
  *
  * Resolving the relative URI
  *
  * <blockquote>
- * <tt>../../../demo/jfc/SwingSet2/src/SwingSet2.java&nbsp;&nbsp;&nbsp;&nbsp;</tt>(2)
+ * {@code ../../../demo/jfc/SwingSet2/src/SwingSet2.java}&nbsp;&nbsp;&nbsp;&nbsp;(2)
  * </blockquote>
  *
  * against this result yields, in turn,
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/demo/jfc/SwingSet2/src/SwingSet2.java</tt>
+ * {@code http://java.sun.com/j2se/1.3/demo/jfc/SwingSet2/src/SwingSet2.java}
  * </blockquote>
  *
  * Resolution of both absolute and relative URIs, and of both absolute and
  * relative paths in the case of hierarchical URIs, is supported.  Resolving
- * the URI <tt>file:///~calendar</tt> against any other URI simply yields the
+ * the URI {@code file:///~calendar} against any other URI simply yields the
  * original URI, since it is absolute.  Resolving the relative URI (2) above
  * against the relative base URI (1) yields the normalized, but still relative,
  * URI
  *
  * <blockquote>
- * <tt>demo/jfc/SwingSet2/src/SwingSet2.java</tt>
+ * {@code demo/jfc/SwingSet2/src/SwingSet2.java}
  * </blockquote>
  *
  * <p> <i>Relativization</i>, finally, is the inverse of resolution: For any
  * two normalized URIs <i>u</i> and&nbsp;<i>v</i>,
  *
  * <blockquote>
- *   <i>u</i><tt>.relativize(</tt><i>u</i><tt>.resolve(</tt><i>v</i><tt>)).equals(</tt><i>v</i><tt>)</tt>&nbsp;&nbsp;and<br>
- *   <i>u</i><tt>.resolve(</tt><i>u</i><tt>.relativize(</tt><i>v</i><tt>)).equals(</tt><i>v</i><tt>)</tt>&nbsp;&nbsp;.<br>
+ *   <i>u</i>{@code .relativize(}<i>u</i>{@code .resolve(}<i>v</i>{@code )).equals(}<i>v</i>{@code )}&nbsp;&nbsp;and<br>
+ *   <i>u</i>{@code .resolve(}<i>u</i>{@code .relativize(}<i>v</i>{@code )).equals(}<i>v</i>{@code )}&nbsp;&nbsp;.<br>
  * </blockquote>
  *
  * This operation is often useful when constructing a document containing URIs
@@ -225,16 +227,16 @@
  * possible.  For example, relativizing the URI
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3/docs/guide/index.html</tt>
+ * {@code http://java.sun.com/j2se/1.3/docs/guide/index.html}
  * </blockquote>
  *
  * against the base URI
  *
  * <blockquote>
- * <tt>http://java.sun.com/j2se/1.3</tt>
+ * {@code http://java.sun.com/j2se/1.3}
  * </blockquote>
  *
- * yields the relative URI <tt>docs/guide/index.html</tt>.
+ * yields the relative URI {@code docs/guide/index.html}.
  *
  *
  * <h4> Character categories </h4>
@@ -247,26 +249,26 @@
  * <blockquote><table cellspacing=2 summary="Describes categories alpha,digit,alphanum,unreserved,punct,reserved,escaped,and other">
  *   <tr><th valign=top><i>alpha</i></th>
  *       <td>The US-ASCII alphabetic characters,
- *        <tt>'A'</tt>&nbsp;through&nbsp;<tt>'Z'</tt>
- *        and <tt>'a'</tt>&nbsp;through&nbsp;<tt>'z'</tt></td></tr>
+ *        {@code 'A'}&nbsp;through&nbsp;{@code 'Z'}
+ *        and {@code 'a'}&nbsp;through&nbsp;{@code 'z'}</td></tr>
  *   <tr><th valign=top><i>digit</i></th>
  *       <td>The US-ASCII decimal digit characters,
- *       <tt>'0'</tt>&nbsp;through&nbsp;<tt>'9'</tt></td></tr>
+ *       {@code '0'}&nbsp;through&nbsp;{@code '9'}</td></tr>
  *   <tr><th valign=top><i>alphanum</i></th>
  *       <td>All <i>alpha</i> and <i>digit</i> characters</td></tr>
  *   <tr><th valign=top><i>unreserved</i>&nbsp;&nbsp;&nbsp;&nbsp;</th>
  *       <td>All <i>alphanum</i> characters together with those in the string
- *        <tt>"_-!.~'()*"</tt></td></tr>
+ *        {@code "_-!.~'()*"}</td></tr>
  *   <tr><th valign=top><i>punct</i></th>
- *       <td>The characters in the string <tt>",;:$&amp;+="</tt></td></tr>
+ *       <td>The characters in the string {@code ",;:$&+="}</td></tr>
  *   <tr><th valign=top><i>reserved</i></th>
  *       <td>All <i>punct</i> characters together with those in the string
- *        <tt>"?/[]@"</tt></td></tr>
+ *        {@code "?/[]@"}</td></tr>
  *   <tr><th valign=top><i>escaped</i></th>
  *       <td>Escaped octets, that is, triplets consisting of the percent
- *           character (<tt>'%'</tt>) followed by two hexadecimal digits
- *           (<tt>'0'</tt>-<tt>'9'</tt>, <tt>'A'</tt>-<tt>'F'</tt>, and
- *           <tt>'a'</tt>-<tt>'f'</tt>)</td></tr>
+ *           character ({@code '%'}) followed by two hexadecimal digits
+ *           ({@code '0'}-{@code '9'}, {@code 'A'}-{@code 'F'}, and
+ *           {@code 'a'}-{@code 'f'})</td></tr>
  *   <tr><th valign=top><i>other</i></th>
  *       <td>The Unicode characters that are not in the US-ASCII character set,
  *           are not control characters (according to the {@link
@@ -306,14 +308,14 @@
  *
  *   <li><p><a name="encode"></a> A character is <i>encoded</i> by replacing it
  *   with the sequence of escaped octets that represent that character in the
- *   UTF-8 character set.  The Euro currency symbol (<tt>'&#92;u20AC'</tt>),
- *   for example, is encoded as <tt>"%E2%82%AC"</tt>.  <i>(<b>Deviation from
+ *   UTF-8 character set.  The Euro currency symbol ({@code '\u005Cu20AC'}),
+ *   for example, is encoded as {@code "%E2%82%AC"}.  <i>(<b>Deviation from
  *   RFC&nbsp;2396</b>, which does not specify any particular character
  *   set.)</i> </p></li>
  *
  *   <li><p><a name="quote"></a> An illegal character is <i>quoted</i> simply by
  *   encoding it.  The space character, for example, is quoted by replacing it
- *   with <tt>"%20"</tt>.  UTF-8 contains US-ASCII, hence for US-ASCII
+ *   with {@code "%20"}.  UTF-8 contains US-ASCII, hence for US-ASCII
  *   characters this transformation has exactly the effect required by
  *   RFC&nbsp;2396. </p></li>
  *
@@ -325,7 +327,7 @@
  *   decoding any encoded non-US-ASCII characters.  If a <a
  *   href="../nio/charset/CharsetDecoder.html#ce">decoding error</a> occurs
  *   when decoding the escaped octets then the erroneous octets are replaced by
- *   <tt>'&#92;uFFFD'</tt>, the Unicode replacement character.  </p></li>
+ *   {@code '\u005CuFFFD'}, the Unicode replacement character.  </p></li>
  *
  * </ul>
  *
@@ -343,7 +345,7 @@
  *   #URI(java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)
  *   multi-argument constructors} quote illegal characters as
  *   required by the components in which they appear.  The percent character
- *   (<tt>'%'</tt>) is always quoted by these constructors.  Any <i>other</i>
+ *   ({@code '%'}) is always quoted by these constructors.  Any <i>other</i>
  *   characters are preserved.  </p></li>
  *
  *   <li><p> The {@link #getRawUserInfo() getRawUserInfo}, {@link #getRawPath()
@@ -379,42 +381,33 @@
  * For any URI <i>u</i>, it is always the case that
  *
  * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.toString()).equals(</tt><i>u</i><tt>)</tt>&nbsp;.
+ * {@code new URI(}<i>u</i>{@code .toString()).equals(}<i>u</i>{@code )}&nbsp;.
  * </blockquote>
  *
  * For any URI <i>u</i> that does not contain redundant syntax such as two
- * slashes before an empty authority (as in <tt>file:///tmp/</tt>&nbsp;) or a
+ * slashes before an empty authority (as in {@code file:///tmp/}&nbsp;) or a
  * colon following a host name but no port (as in
- * <tt>http://java.sun.com:</tt>&nbsp;), and that does not encode characters
+ * {@code http://java.sun.com:}&nbsp;), and that does not encode characters
  * except those that must be quoted, the following identities also hold:
- *
- * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.getScheme(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getSchemeSpecificPart(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getFragment())<br>
- * .equals(</tt><i>u</i><tt>)</tt>
- * </blockquote>
- *
+ * <p><pre>
+ *     new URI(<i>u</i>.getScheme(),
+ *             <i>u</i>.getSchemeSpecificPart(),
+ *             <i>u</i>.getFragment())
+ *     .equals(<i>u</i>)</pre>
  * in all cases,
- *
- * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.getScheme(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getUserInfo(),&nbsp;</tt><i>u</i><tt>.getAuthority(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getPath(),&nbsp;</tt><i>u</i><tt>.getQuery(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getFragment())<br>
- * .equals(</tt><i>u</i><tt>)</tt>
- * </blockquote>
- *
+ * <p><pre>
+ *     new URI(<i>u</i>.getScheme(),
+ *             <i>u</i>.getUserInfo(), <i>u</i>.getAuthority(),
+ *             <i>u</i>.getPath(), <i>u</i>.getQuery(),
+ *             <i>u</i>.getFragment())
+ *     .equals(<i>u</i>)</pre>
  * if <i>u</i> is hierarchical, and
- *
- * <blockquote>
- * <tt>new URI(</tt><i>u</i><tt>.getScheme(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getUserInfo(),&nbsp;</tt><i>u</i><tt>.getHost(),&nbsp;</tt><i>u</i><tt>.getPort(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getPath(),&nbsp;</tt><i>u</i><tt>.getQuery(),<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt><i>u</i><tt>.getFragment())<br>
- * .equals(</tt><i>u</i><tt>)</tt>
- * </blockquote>
- *
+ * <p><pre>
+ *     new URI(<i>u</i>.getScheme(),
+ *             <i>u</i>.getUserInfo(), <i>u</i>.getHost(), <i>u</i>.getPort(),
+ *             <i>u</i>.getPath(), <i>u</i>.getQuery(),
+ *             <i>u</i>.getFragment())
+ *     .equals(<i>u</i>)</pre>
  * if <i>u</i> is hierarchical and has either no authority or a server-based
  * authority.
  *
@@ -425,8 +418,8 @@
  * resource <i>locator</i>.  Hence every URL is a URI, abstractly speaking, but
  * not every URI is a URL.  This is because there is another subcategory of
  * URIs, uniform resource <i>names</i> (URNs), which name resources but do not
- * specify how to locate them.  The <tt>mailto</tt>, <tt>news</tt>, and
- * <tt>isbn</tt> URIs shown above are examples of URNs.
+ * specify how to locate them.  The {@code mailto}, {@code news}, and
+ * {@code isbn} URIs shown above are examples of URNs.
  *
  * <p> The conceptual distinction between URIs and URLs is reflected in the
  * differences between this class and the {@link URL} class.
@@ -530,12 +523,12 @@
      * href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a>,
      * Appendix&nbsp;A, <b><i>except for the following deviations:</i></b> </p>
      *
-     * <ul type=disc>
+     * <ul>
      *
      *   <li><p> An empty authority component is permitted as long as it is
      *   followed by a non-empty path, a query component, or a fragment
      *   component.  This allows the parsing of URIs such as
-     *   <tt>"file:///foo/bar"</tt>, which seems to be the intent of
+     *   {@code "file:///foo/bar"}, which seems to be the intent of
      *   RFC&nbsp;2396 although the grammar does not permit it.  If the
      *   authority component is empty then the user-information, host, and port
      *   components are undefined. </p></li>
@@ -543,7 +536,7 @@
      *   <li><p> Empty relative paths are permitted; this seems to be the
      *   intent of RFC&nbsp;2396 although the grammar does not permit it.  The
      *   primary consequence of this deviation is that a standalone fragment
-     *   such as <tt>"#foo"</tt> parses as a relative URI with an empty path
+     *   such as {@code "#foo"} parses as a relative URI with an empty path
      *   and the given fragment, and can be usefully <a
      *   href="#resolve-frag">resolved</a> against a base URI.
      *
@@ -560,12 +553,12 @@
      *   href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a>
      *   section&nbsp;3.2.2 although the grammar does not permit it. The
      *   consequence of this deviation is that the authority component of a
-     *   hierarchical URI such as <tt>s://123</tt>, will parse as a server-based
+     *   hierarchical URI such as {@code s://123}, will parse as a server-based
      *   authority. </p></li>
      *
      *   <li><p> IPv6 addresses are permitted for the host component.  An IPv6
-     *   address must be enclosed in square brackets (<tt>'['</tt> and
-     *   <tt>']'</tt>) as specified by <a
+     *   address must be enclosed in square brackets ({@code '['} and
+     *   {@code ']'}) as specified by <a
      *   href="http://www.ietf.org/rfc/rfc2732.txt">RFC&nbsp;2732</a>.  The
      *   IPv6 address itself must parse according to <a
      *   href="http://www.ietf.org/rfc/rfc2373.txt">RFC&nbsp;2373</a>.  IPv6
@@ -585,7 +578,7 @@
      * @param  str   The string to be parsed into a URI
      *
      * @throws  NullPointerException
-     *          If <tt>str</tt> is <tt>null</tt>
+     *          If {@code str} is {@code null}
      *
      * @throws  URISyntaxException
      *          If the given string violates RFC&nbsp;2396, as augmented
@@ -599,10 +592,10 @@
      * Constructs a hierarchical URI from the given components.
      *
      * <p> If a scheme is given then the path, if also given, must either be
-     * empty or begin with a slash character (<tt>'/'</tt>).  Otherwise a
-     * component of the new URI may be left undefined by passing <tt>null</tt>
-     * for the corresponding parameter or, in the case of the <tt>port</tt>
-     * parameter, by passing <tt>-1</tt>.
+     * empty or begin with a slash character ({@code '/'}).  Otherwise a
+     * component of the new URI may be left undefined by passing {@code null}
+     * for the corresponding parameter or, in the case of the {@code port}
+     * parameter, by passing {@code -1}.
      *
      * <p> This constructor first builds a URI string from the given components
      * according to the rules specified in <a
@@ -614,37 +607,37 @@
      *   <li><p> Initially, the result string is empty. </p></li>
      *
      *   <li><p> If a scheme is given then it is appended to the result,
-     *   followed by a colon character (<tt>':'</tt>).  </p></li>
+     *   followed by a colon character ({@code ':'}).  </p></li>
      *
      *   <li><p> If user information, a host, or a port are given then the
-     *   string <tt>"//"</tt> is appended.  </p></li>
+     *   string {@code "//"} is appended.  </p></li>
      *
      *   <li><p> If user information is given then it is appended, followed by
-     *   a commercial-at character (<tt>'@'</tt>).  Any character not in the
+     *   a commercial-at character ({@code '@'}).  Any character not in the
      *   <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
      *   categories is <a href="#quote">quoted</a>.  </p></li>
      *
      *   <li><p> If a host is given then it is appended.  If the host is a
      *   literal IPv6 address but is not enclosed in square brackets
-     *   (<tt>'['</tt> and <tt>']'</tt>) then the square brackets are added.
+     *   ({@code '['} and {@code ']'}) then the square brackets are added.
      *   </p></li>
      *
      *   <li><p> If a port number is given then a colon character
-     *   (<tt>':'</tt>) is appended, followed by the port number in decimal.
+     *   ({@code ':'}) is appended, followed by the port number in decimal.
      *   </p></li>
      *
      *   <li><p> If a path is given then it is appended.  Any character not in
      *   the <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
-     *   categories, and not equal to the slash character (<tt>'/'</tt>) or the
-     *   commercial-at character (<tt>'@'</tt>), is quoted.  </p></li>
+     *   categories, and not equal to the slash character ({@code '/'}) or the
+     *   commercial-at character ({@code '@'}), is quoted.  </p></li>
      *
      *   <li><p> If a query is given then a question-mark character
-     *   (<tt>'?'</tt>) is appended, followed by the query.  Any character that
+     *   ({@code '?'}) is appended, followed by the query.  Any character that
      *   is not a <a href="#legal-chars">legal URI character</a> is quoted.
      *   </p></li>
      *
      *   <li><p> Finally, if a fragment is given then a hash character
-     *   (<tt>'#'</tt>) is appended, followed by the fragment.  Any character
+     *   ({@code '#'}) is appended, followed by the fragment.  Any character
      *   that is not a legal URI character is quoted.  </p></li>
      *
      * </ol>
@@ -684,8 +677,8 @@
      * Constructs a hierarchical URI from the given components.
      *
      * <p> If a scheme is given then the path, if also given, must either be
-     * empty or begin with a slash character (<tt>'/'</tt>).  Otherwise a
-     * component of the new URI may be left undefined by passing <tt>null</tt>
+     * empty or begin with a slash character ({@code '/'}).  Otherwise a
+     * component of the new URI may be left undefined by passing {@code null}
      * for the corresponding parameter.
      *
      * <p> This constructor first builds a URI string from the given components
@@ -698,28 +691,28 @@
      *   <li><p> Initially, the result string is empty.  </p></li>
      *
      *   <li><p> If a scheme is given then it is appended to the result,
-     *   followed by a colon character (<tt>':'</tt>).  </p></li>
+     *   followed by a colon character ({@code ':'}).  </p></li>
      *
-     *   <li><p> If an authority is given then the string <tt>"//"</tt> is
+     *   <li><p> If an authority is given then the string {@code "//"} is
      *   appended, followed by the authority.  If the authority contains a
      *   literal IPv6 address then the address must be enclosed in square
-     *   brackets (<tt>'['</tt> and <tt>']'</tt>).  Any character not in the
+     *   brackets ({@code '['} and {@code ']'}).  Any character not in the
      *   <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
      *   categories, and not equal to the commercial-at character
-     *   (<tt>'@'</tt>), is <a href="#quote">quoted</a>.  </p></li>
+     *   ({@code '@'}), is <a href="#quote">quoted</a>.  </p></li>
      *
      *   <li><p> If a path is given then it is appended.  Any character not in
      *   the <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, or <i>other</i>
-     *   categories, and not equal to the slash character (<tt>'/'</tt>) or the
-     *   commercial-at character (<tt>'@'</tt>), is quoted.  </p></li>
+     *   categories, and not equal to the slash character ({@code '/'}) or the
+     *   commercial-at character ({@code '@'}), is quoted.  </p></li>
      *
      *   <li><p> If a query is given then a question-mark character
-     *   (<tt>'?'</tt>) is appended, followed by the query.  Any character that
+     *   ({@code '?'}) is appended, followed by the query.  Any character that
      *   is not a <a href="#legal-chars">legal URI character</a> is quoted.
      *   </p></li>
      *
      *   <li><p> Finally, if a fragment is given then a hash character
-     *   (<tt>'#'</tt>) is appended, followed by the fragment.  Any character
+     *   ({@code '#'}) is appended, followed by the fragment.  Any character
      *   that is not a legal URI character is quoted.  </p></li>
      *
      * </ol>
@@ -756,15 +749,15 @@
     /**
      * Constructs a hierarchical URI from the given components.
      *
-     * <p> A component may be left undefined by passing <tt>null</tt>.
+     * <p> A component may be left undefined by passing {@code null}.
      *
      * <p> This convenience constructor works as if by invoking the
      * seven-argument constructor as follows:
      *
-     * <blockquote><tt>
-     * new&nbsp;{@link #URI(String, String, String, int, String, String, String)
-     * URI}(scheme,&nbsp;null,&nbsp;host,&nbsp;-1,&nbsp;path,&nbsp;null,&nbsp;fragment);
-     * </tt></blockquote>
+     * <blockquote>
+     * {@code new} {@link #URI(String, String, String, int, String, String, String)
+     * URI}{@code (scheme, null, host, -1, path, null, fragment);}
+     * </blockquote>
      *
      * @param   scheme    Scheme name
      * @param   host      Host name
@@ -784,7 +777,7 @@
     /**
      * Constructs a URI from the given components.
      *
-     * <p> A component may be left undefined by passing <tt>null</tt>.
+     * <p> A component may be left undefined by passing {@code null}.
      *
      * <p> This constructor first builds a URI in string form using the given
      * components as follows:  </p>
@@ -794,14 +787,14 @@
      *   <li><p> Initially, the result string is empty.  </p></li>
      *
      *   <li><p> If a scheme is given then it is appended to the result,
-     *   followed by a colon character (<tt>':'</tt>).  </p></li>
+     *   followed by a colon character ({@code ':'}).  </p></li>
      *
      *   <li><p> If a scheme-specific part is given then it is appended.  Any
      *   character that is not a <a href="#legal-chars">legal URI character</a>
      *   is <a href="#quote">quoted</a>.  </p></li>
      *
      *   <li><p> Finally, if a fragment is given then a hash character
-     *   (<tt>'#'</tt>) is appended to the string, followed by the fragment.
+     *   ({@code '#'}) is appended to the string, followed by the fragment.
      *   Any character that is not a legal URI character is quoted.  </p></li>
      *
      * </ol>
@@ -847,7 +840,7 @@
      * @return The new URI
      *
      * @throws  NullPointerException
-     *          If <tt>str</tt> is <tt>null</tt>
+     *          If {@code str} is {@code null}
      *
      * @throws  IllegalArgumentException
      *          If the given string violates RFC&nbsp;2396
@@ -882,7 +875,7 @@
      * cannot always distinguish a malformed server-based authority from a
      * legitimate registry-based authority.  It must therefore treat some
      * instances of the former as instances of the latter.  The authority
-     * component in the URI string <tt>"//foo:bar"</tt>, for example, is not a
+     * component in the URI string {@code "//foo:bar"}, for example, is not a
      * legal server-based authority but it is legal as a registry-based
      * authority.
      *
@@ -892,7 +885,7 @@
      * treated as an error.  In these cases a statement such as
      *
      * <blockquote>
-     * <tt>URI </tt><i>u</i><tt> = new URI(str).parseServerAuthority();</tt>
+     * {@code URI }<i>u</i>{@code  = new URI(str).parseServerAuthority();}
      * </blockquote>
      *
      * <p> can be used to ensure that <i>u</i> always refers to a URI that, if
@@ -936,26 +929,26 @@
      *
      * <ol>
      *
-     *   <li><p> All <tt>"."</tt> segments are removed. </p></li>
+     *   <li><p> All {@code "."} segments are removed. </p></li>
      *
-     *   <li><p> If a <tt>".."</tt> segment is preceded by a non-<tt>".."</tt>
+     *   <li><p> If a {@code ".."} segment is preceded by a non-{@code ".."}
      *   segment then both of these segments are removed.  This step is
      *   repeated until it is no longer applicable. </p></li>
      *
      *   <li><p> If the path is relative, and if its first segment contains a
-     *   colon character (<tt>':'</tt>), then a <tt>"."</tt> segment is
+     *   colon character ({@code ':'}), then a {@code "."} segment is
      *   prepended.  This prevents a relative URI with a path such as
-     *   <tt>"a:b/c/d"</tt> from later being re-parsed as an opaque URI with a
-     *   scheme of <tt>"a"</tt> and a scheme-specific part of <tt>"b/c/d"</tt>.
+     *   {@code "a:b/c/d"} from later being re-parsed as an opaque URI with a
+     *   scheme of {@code "a"} and a scheme-specific part of {@code "b/c/d"}.
      *   <b><i>(Deviation from RFC&nbsp;2396)</i></b> </p></li>
      *
      * </ol>
      *
-     * <p> A normalized path will begin with one or more <tt>".."</tt> segments
-     * if there were insufficient non-<tt>".."</tt> segments preceding them to
-     * allow their removal.  A normalized path will begin with a <tt>"."</tt>
+     * <p> A normalized path will begin with one or more {@code ".."} segments
+     * if there were insufficient non-{@code ".."} segments preceding them to
+     * allow their removal.  A normalized path will begin with a {@code "."}
      * segment if one was inserted by step 3 above.  Otherwise, a normalized
-     * path will not contain any <tt>"."</tt> or <tt>".."</tt> segments. </p>
+     * path will not contain any {@code "."} or {@code ".."} segments. </p>
      *
      * @return  A URI equivalent to this URI,
      *          but whose path is in normal form
@@ -975,7 +968,7 @@
      * query components are undefined, then a URI with the given fragment but
      * with all other components equal to those of this URI is returned.  This
      * allows a URI representing a standalone fragment reference, such as
-     * <tt>"#foo"</tt>, to be usefully resolved against a base URI.
+     * {@code "#foo"}, to be usefully resolved against a base URI.
      *
      * <p> Otherwise this method constructs a new hierarchical URI in a manner
      * consistent with <a
@@ -993,7 +986,7 @@
      *   <li><p> Otherwise the new URI's authority component is copied from
      *   this URI, and its path is computed as follows: </p>
      *
-     *   <ol type=a>
+     *   <ol>
      *
      *     <li><p> If the given URI's path is absolute then the new URI's path
      *     is taken from the given URI. </p></li>
@@ -1016,7 +1009,7 @@
      * @return The resulting URI
      *
      * @throws  NullPointerException
-     *          If <tt>uri</tt> is <tt>null</tt>
+     *          If {@code uri} is {@code null}
      */
     public URI resolve(URI uri) {
         return resolve(this, uri);
@@ -1027,14 +1020,14 @@
      * against this URI.
      *
      * <p> This convenience method works as if invoking it were equivalent to
-     * evaluating the expression <tt>{@link #resolve(java.net.URI)
-     * resolve}(URI.{@link #create(String) create}(str))</tt>. </p>
+     * evaluating the expression {@link #resolve(java.net.URI)
+     * resolve}{@code (URI.}{@link #create(String) create}{@code (str))}. </p>
      *
      * @param  str   The string to be parsed into a URI
      * @return The resulting URI
      *
      * @throws  NullPointerException
-     *          If <tt>str</tt> is <tt>null</tt>
+     *          If {@code str} is {@code null}
      *
      * @throws  IllegalArgumentException
      *          If the given string violates RFC&nbsp;2396
@@ -1067,7 +1060,7 @@
      * @return The resulting URI
      *
      * @throws  NullPointerException
-     *          If <tt>uri</tt> is <tt>null</tt>
+     *          If {@code uri} is {@code null}
      */
     public URI relativize(URI uri) {
         return relativize(this, uri);
@@ -1077,7 +1070,7 @@
      * Constructs a URL from this URI.
      *
      * <p> This convenience method works as if invoking it were equivalent to
-     * evaluating the expression <tt>new&nbsp;URL(this.toString())</tt> after
+     * evaluating the expression {@code new URL(this.toString())} after
      * first checking that this URI is absolute. </p>
      *
      * @return  A URL constructed from this URI
@@ -1102,14 +1095,14 @@
      * Returns the scheme component of this URI.
      *
      * <p> The scheme component of a URI, if defined, only contains characters
-     * in the <i>alphanum</i> category and in the string <tt>"-.+"</tt>.  A
+     * in the <i>alphanum</i> category and in the string {@code "-.+"}.  A
      * scheme always starts with an <i>alpha</i> character. <p>
      *
      * The scheme component of a URI cannot contain escaped octets, hence this
      * method does not perform any decoding.
      *
      * @return  The scheme component of this URI,
-     *          or <tt>null</tt> if the scheme is undefined
+     *          or {@code null} if the scheme is undefined
      */
     public String getScheme() {
         return scheme;
@@ -1120,7 +1113,7 @@
      *
      * <p> A URI is absolute if, and only if, it has a scheme component. </p>
      *
-     * @return  <tt>true</tt> if, and only if, this URI is absolute
+     * @return  {@code true} if, and only if, this URI is absolute
      */
     public boolean isAbsolute() {
         return scheme != null;
@@ -1134,7 +1127,7 @@
      * An opaque URI has a scheme, a scheme-specific part, and possibly
      * a fragment; all other components are undefined. </p>
      *
-     * @return  <tt>true</tt> if, and only if, this URI is opaque
+     * @return  {@code true} if, and only if, this URI is opaque
      */
     public boolean isOpaque() {
         return path == null;
@@ -1148,7 +1141,7 @@
      * characters. </p>
      *
      * @return  The raw scheme-specific part of this URI
-     *          (never <tt>null</tt>)
+     *          (never {@code null})
      */
     public String getRawSchemeSpecificPart() {
         defineSchemeSpecificPart();
@@ -1164,7 +1157,7 @@
      * href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded scheme-specific part of this URI
-     *          (never <tt>null</tt>)
+     *          (never {@code null})
      */
     public String getSchemeSpecificPart() {
         if (decodedSchemeSpecificPart == null)
@@ -1176,14 +1169,14 @@
      * Returns the raw authority component of this URI.
      *
      * <p> The authority component of a URI, if defined, only contains the
-     * commercial-at character (<tt>'@'</tt>) and characters in the
+     * commercial-at character ({@code '@'}) and characters in the
      * <i>unreserved</i>, <i>punct</i>, <i>escaped</i>, and <i>other</i>
      * categories.  If the authority is server-based then it is further
      * constrained to have valid user-information, host, and port
      * components. </p>
      *
      * @return  The raw authority component of this URI,
-     *          or <tt>null</tt> if the authority is undefined
+     *          or {@code null} if the authority is undefined
      */
     public String getRawAuthority() {
         return authority;
@@ -1197,7 +1190,7 @@
      * sequences of escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded authority component of this URI,
-     *          or <tt>null</tt> if the authority is undefined
+     *          or {@code null} if the authority is undefined
      */
     public String getAuthority() {
         if (decodedAuthority == null)
@@ -1213,7 +1206,7 @@
      * <i>other</i> categories. </p>
      *
      * @return  The raw user-information component of this URI,
-     *          or <tt>null</tt> if the user information is undefined
+     *          or {@code null} if the user information is undefined
      */
     public String getRawUserInfo() {
         return userInfo;
@@ -1227,7 +1220,7 @@
      * sequences of escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded user-information component of this URI,
-     *          or <tt>null</tt> if the user information is undefined
+     *          or {@code null} if the user information is undefined
      */
     public String getUserInfo() {
         if ((decodedUserInfo == null) && (userInfo != null))
@@ -1241,24 +1234,24 @@
      * <p> The host component of a URI, if defined, will have one of the
      * following forms: </p>
      *
-     * <ul type=disc>
+     * <ul>
      *
      *   <li><p> A domain name consisting of one or more <i>labels</i>
-     *   separated by period characters (<tt>'.'</tt>), optionally followed by
+     *   separated by period characters ({@code '.'}), optionally followed by
      *   a period character.  Each label consists of <i>alphanum</i> characters
-     *   as well as hyphen characters (<tt>'-'</tt>), though hyphens never
+     *   as well as hyphen characters ({@code '-'}), though hyphens never
      *   occur as the first or last characters in a label. The rightmost
      *   label of a domain name consisting of two or more labels, begins
      *   with an <i>alpha</i> character. </li>
      *
      *   <li><p> A dotted-quad IPv4 address of the form
-     *   <i>digit</i><tt>+.</tt><i>digit</i><tt>+.</tt><i>digit</i><tt>+.</tt><i>digit</i><tt>+</tt>,
+     *   <i>digit</i>{@code +.}<i>digit</i>{@code +.}<i>digit</i>{@code +.}<i>digit</i>{@code +},
      *   where no <i>digit</i> sequence is longer than three characters and no
      *   sequence has a value larger than 255. </p></li>
      *
-     *   <li><p> An IPv6 address enclosed in square brackets (<tt>'['</tt> and
-     *   <tt>']'</tt>) and consisting of hexadecimal digits, colon characters
-     *   (<tt>':'</tt>), and possibly an embedded IPv4 address.  The full
+     *   <li><p> An IPv6 address enclosed in square brackets ({@code '['} and
+     *   {@code ']'}) and consisting of hexadecimal digits, colon characters
+     *   ({@code ':'}), and possibly an embedded IPv4 address.  The full
      *   syntax of IPv6 addresses is specified in <a
      *   href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC&nbsp;2373: IPv6
      *   Addressing Architecture</i></a>.  </p></li>
@@ -1269,7 +1262,7 @@
      * method does not perform any decoding.
      *
      * @return  The host component of this URI,
-     *          or <tt>null</tt> if the host is undefined
+     *          or {@code null} if the host is undefined
      */
     public String getHost() {
         return host;
@@ -1282,7 +1275,7 @@
      * integer. </p>
      *
      * @return  The port component of this URI,
-     *          or <tt>-1</tt> if the port is undefined
+     *          or {@code -1} if the port is undefined
      */
     public int getPort() {
         return port;
@@ -1292,12 +1285,12 @@
      * Returns the raw path component of this URI.
      *
      * <p> The path component of a URI, if defined, only contains the slash
-     * character (<tt>'/'</tt>), the commercial-at character (<tt>'@'</tt>),
+     * character ({@code '/'}), the commercial-at character ({@code '@'}),
      * and characters in the <i>unreserved</i>, <i>punct</i>, <i>escaped</i>,
      * and <i>other</i> categories. </p>
      *
      * @return  The path component of this URI,
-     *          or <tt>null</tt> if the path is undefined
+     *          or {@code null} if the path is undefined
      */
     public String getRawPath() {
         return path;
@@ -1311,7 +1304,7 @@
      * escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded path component of this URI,
-     *          or <tt>null</tt> if the path is undefined
+     *          or {@code null} if the path is undefined
      */
     public String getPath() {
         if ((decodedPath == null) && (path != null))
@@ -1326,7 +1319,7 @@
      * characters. </p>
      *
      * @return  The raw query component of this URI,
-     *          or <tt>null</tt> if the query is undefined
+     *          or {@code null} if the query is undefined
      */
     public String getRawQuery() {
         return query;
@@ -1340,7 +1333,7 @@
      * escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded query component of this URI,
-     *          or <tt>null</tt> if the query is undefined
+     *          or {@code null} if the query is undefined
      */
     public String getQuery() {
         if ((decodedQuery == null) && (query != null))
@@ -1355,7 +1348,7 @@
      * characters. </p>
      *
      * @return  The raw fragment component of this URI,
-     *          or <tt>null</tt> if the fragment is undefined
+     *          or {@code null} if the fragment is undefined
      */
     public String getRawFragment() {
         return fragment;
@@ -1369,7 +1362,7 @@
      * sequences of escaped octets are <a href="#decode">decoded</a>.  </p>
      *
      * @return  The decoded fragment component of this URI,
-     *          or <tt>null</tt> if the fragment is undefined
+     *          or {@code null} if the fragment is undefined
      */
     public String getFragment() {
         if ((decodedFragment == null) && (fragment != null))
@@ -1384,7 +1377,7 @@
      * Tests this URI for equality with another object.
      *
      * <p> If the given object is not a URI then this method immediately
-     * returns <tt>false</tt>.
+     * returns {@code false}.
      *
      * <p> For two URIs to be considered equal requires that either both are
      * opaque or both are hierarchical.  Their schemes must either both be
@@ -1414,7 +1407,7 @@
      *
      * @param   ob   The object to which this object is to be compared
      *
-     * @return  <tt>true</tt> if, and only if, the given object is a URI that
+     * @return  {@code true} if, and only if, the given object is a URI that
      *          is identical to this URI
      */
     public boolean equals(Object ob) {
@@ -1495,7 +1488,7 @@
      *
      * <p> The ordering of URIs is defined as follows: </p>
      *
-     * <ul type=disc>
+     * <ul>
      *
      *   <li><p> Two URIs with different schemes are ordered according the
      *   ordering of their schemes, without regard to case. </p></li>
@@ -1513,7 +1506,7 @@
      *   <li><p> Two hierarchical URIs with identical schemes are ordered
      *   according to the ordering of their authority components: </p>
      *
-     *   <ul type=disc>
+     *   <ul>
      *
      *     <li><p> If both authority components are server-based then the URIs
      *     are ordered according to their user-information components; if these
@@ -1635,7 +1628,7 @@
     /**
      * Saves the content of this URI to the given serial stream.
      *
-     * <p> The only serializable field of a URI instance is its <tt>string</tt>
+     * <p> The only serializable field of a URI instance is its {@code string}
      * field.  That field is given a value, if it does not have one already,
      * and then the {@link java.io.ObjectOutputStream#defaultWriteObject()}
      * method of the given object-output stream is invoked. </p>
@@ -1654,7 +1647,7 @@
      * Reconstitutes a URI from the given serial stream.
      *
      * <p> The {@link java.io.ObjectInputStream#defaultReadObject()} method is
-     * invoked to read the value of the <tt>string</tt> field.  The result is
+     * invoked to read the value of the {@code string} field.  The result is
      * then parsed in the usual way.
      *
      * @param  is  The object-input stream from which this object
--- a/jdk/src/share/classes/java/net/URISyntaxException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URISyntaxException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,13 +50,13 @@
      * @param  input   The input string
      * @param  reason  A string explaining why the input could not be parsed
      * @param  index   The index at which the parse error occurred,
-     *                 or <tt>-1</tt> if the index is not known
+     *                 or {@code -1} if the index is not known
      *
      * @throws  NullPointerException
-     *          If either the input or reason strings are <tt>null</tt>
+     *          If either the input or reason strings are {@code null}
      *
      * @throws  IllegalArgumentException
-     *          If the error index is less than <tt>-1</tt>
+     *          If the error index is less than {@code -1}
      */
     public URISyntaxException(String input, String reason, int index) {
         super(reason);
@@ -70,13 +70,13 @@
 
     /**
      * Constructs an instance from the given input string and reason.  The
-     * resulting object will have an error index of <tt>-1</tt>.
+     * resulting object will have an error index of {@code -1}.
      *
      * @param  input   The input string
      * @param  reason  A string explaining why the input could not be parsed
      *
      * @throws  NullPointerException
-     *          If either the input or reason strings are <tt>null</tt>
+     *          If either the input or reason strings are {@code null}
      */
     public URISyntaxException(String input, String reason) {
         this(input, reason, -1);
@@ -102,7 +102,7 @@
 
     /**
      * Returns an index into the input string of the position at which the
-     * parse error occurred, or <tt>-1</tt> if this position is not known.
+     * parse error occurred, or {@code -1} if this position is not known.
      *
      * @return  The error index
      */
@@ -113,8 +113,8 @@
     /**
      * Returns a string describing the parse error.  The resulting string
      * consists of the reason string followed by a colon character
-     * (<tt>':'</tt>), a space, and the input string.  If the error index is
-     * defined then the string <tt>" at index "</tt> followed by the index, in
+     * ({@code ':'}), a space, and the input string.  If the error index is
+     * defined then the string {@code " at index "} followed by the index, in
      * decimal, is inserted after the reason string and before the colon
      * character.
      *
--- a/jdk/src/share/classes/java/net/URL.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URL.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 import sun.security.util.SecurityConstants;
 
 /**
- * Class <code>URL</code> represents a Uniform Resource
+ * Class {@code URL} represents a Uniform Resource
  * Locator, a pointer to a "resource" on the World
  * Wide Web. A resource can be something as simple as a file or a
  * directory, or it can be a reference to a more complicated object,
@@ -49,10 +49,10 @@
  * </pre></blockquote>
  * <p>
  * The URL above indicates that the protocol to use is
- * <code>http</code> (HyperText Transfer Protocol) and that the
+ * {@code http} (HyperText Transfer Protocol) and that the
  * information resides on a host machine named
- * <code>www.example.com</code>. The information on that host
- * machine is named <code>/docs/resource1.html</code>. The exact
+ * {@code www.example.com}. The information on that host
+ * machine is named {@code /docs/resource1.html}. The exact
  * meaning of this name on the host machine is both protocol
  * dependent and host dependent. The information normally resides in
  * a file, but it could be generated on the fly. This component of
@@ -62,13 +62,13 @@
  * port number to which the TCP connection is made on the remote host
  * machine. If the port is not specified, the default port for
  * the protocol is used instead. For example, the default port for
- * <code>http</code> is <code>80</code>. An alternative port could be
+ * {@code http} is {@code 80}. An alternative port could be
  * specified as:
  * <blockquote><pre>
  *     http://www.example.com:1080/docs/resource1.html
  * </pre></blockquote>
  * <p>
- * The syntax of <code>URL</code> is defined by  <a
+ * The syntax of {@code URL} is defined by  <a
  * href="http://www.ietf.org/rfc/rfc2396.txt"><i>RFC&nbsp;2396: Uniform
  * Resource Identifiers (URI): Generic Syntax</i></a>, amended by <a
  * href="http://www.ietf.org/rfc/rfc2732.txt"><i>RFC&nbsp;2732: Format for
@@ -86,7 +86,7 @@
  * This fragment is not technically part of the URL. Rather, it
  * indicates that after the specified resource is retrieved, the
  * application is specifically interested in that part of the
- * document that has the tag <code>chapter1</code> attached to it. The
+ * document that has the tag {@code chapter1} attached to it. The
  * meaning of a tag is resource specific.
  * <p>
  * An application can also specify a "relative URL",
@@ -170,8 +170,8 @@
     private int port = -1;
 
     /**
-     * The specified file name on that host. <code>file</code> is
-     * defined as <code>path[?query]</code>
+     * The specified file name on that host. {@code file} is
+     * defined as {@code path[?query]}
      * @serial
      */
     private String file;
@@ -220,42 +220,42 @@
     private int hashCode = -1;
 
     /**
-     * Creates a <code>URL</code> object from the specified
-     * <code>protocol</code>, <code>host</code>, <code>port</code>
-     * number, and <code>file</code>.<p>
+     * Creates a {@code URL} object from the specified
+     * {@code protocol}, {@code host}, {@code port}
+     * number, and {@code file}.<p>
      *
-     * <code>host</code> can be expressed as a host name or a literal
+     * {@code host} can be expressed as a host name or a literal
      * IP address. If IPv6 literal address is used, it should be
-     * enclosed in square brackets (<tt>'['</tt> and <tt>']'</tt>), as
+     * enclosed in square brackets ({@code '['} and {@code ']'}), as
      * specified by <a
      * href="http://www.ietf.org/rfc/rfc2732.txt">RFC&nbsp;2732</a>;
      * However, the literal IPv6 address format defined in <a
      * href="http://www.ietf.org/rfc/rfc2373.txt"><i>RFC&nbsp;2373: IP
      * Version 6 Addressing Architecture</i></a> is also accepted.<p>
      *
-     * Specifying a <code>port</code> number of <code>-1</code>
+     * Specifying a {@code port} number of {@code -1}
      * indicates that the URL should use the default port for the
      * protocol.<p>
      *
      * If this is the first URL object being created with the specified
      * protocol, a <i>stream protocol handler</i> object, an instance of
-     * class <code>URLStreamHandler</code>, is created for that protocol:
+     * class {@code URLStreamHandler}, is created for that protocol:
      * <ol>
      * <li>If the application has previously set up an instance of
-     *     <code>URLStreamHandlerFactory</code> as the stream handler factory,
-     *     then the <code>createURLStreamHandler</code> method of that instance
+     *     {@code URLStreamHandlerFactory} as the stream handler factory,
+     *     then the {@code createURLStreamHandler} method of that instance
      *     is called with the protocol string as an argument to create the
      *     stream protocol handler.
-     * <li>If no <code>URLStreamHandlerFactory</code> has yet been set up,
-     *     or if the factory's <code>createURLStreamHandler</code> method
-     *     returns <code>null</code>, then the constructor finds the
+     * <li>If no {@code URLStreamHandlerFactory} has yet been set up,
+     *     or if the factory's {@code createURLStreamHandler} method
+     *     returns {@code null}, then the constructor finds the
      *     value of the system property:
      *     <blockquote><pre>
      *         java.protocol.handler.pkgs
      *     </pre></blockquote>
-     *     If the value of that system property is not <code>null</code>,
+     *     If the value of that system property is not {@code null},
      *     it is interpreted as a list of packages separated by a vertical
-     *     slash character '<code>|</code>'. The constructor tries to load
+     *     slash character '{@code |}'. The constructor tries to load
      *     the class named:
      *     <blockquote><pre>
      *         &lt;<i>package</i>&gt;.&lt;<i>protocol</i>&gt;.Handler
@@ -263,7 +263,7 @@
      *     where &lt;<i>package</i>&gt; is replaced by the name of the package
      *     and &lt;<i>protocol</i>&gt; is replaced by the name of the protocol.
      *     If this class does not exist, or if the class exists but it is not
-     *     a subclass of <code>URLStreamHandler</code>, then the next package
+     *     a subclass of {@code URLStreamHandler}, then the next package
      *     in the list is tried.
      * <li>If the previous step fails to find a protocol handler, then the
      *     constructor tries to load from a system default package.
@@ -271,8 +271,8 @@
      *         &lt;<i>system default package</i>&gt;.&lt;<i>protocol</i>&gt;.Handler
      *     </pre></blockquote>
      *     If this class does not exist, or if the class exists but it is not a
-     *     subclass of <code>URLStreamHandler</code>, then a
-     *     <code>MalformedURLException</code> is thrown.
+     *     subclass of {@code URLStreamHandler}, then a
+     *     {@code MalformedURLException} is thrown.
      * </ol>
      *
      * <p>Protocol handlers for the following protocols are guaranteed
@@ -304,13 +304,13 @@
     }
 
     /**
-     * Creates a URL from the specified <code>protocol</code>
-     * name, <code>host</code> name, and <code>file</code> name. The
+     * Creates a URL from the specified {@code protocol}
+     * name, {@code host} name, and {@code file} name. The
      * default port for the specified protocol is used.
      * <p>
      * This method is equivalent to calling the four-argument
-     * constructor with the arguments being <code>protocol</code>,
-     * <code>host</code>, <code>-1</code>, and <code>file</code>.
+     * constructor with the arguments being {@code protocol},
+     * {@code host}, {@code -1}, and {@code file}.
      *
      * No validation of the inputs is performed by this constructor.
      *
@@ -327,21 +327,21 @@
     }
 
     /**
-     * Creates a <code>URL</code> object from the specified
-     * <code>protocol</code>, <code>host</code>, <code>port</code>
-     * number, <code>file</code>, and <code>handler</code>. Specifying
-     * a <code>port</code> number of <code>-1</code> indicates that
+     * Creates a {@code URL} object from the specified
+     * {@code protocol}, {@code host}, {@code port}
+     * number, {@code file}, and {@code handler}. Specifying
+     * a {@code port} number of {@code -1} indicates that
      * the URL should use the default port for the protocol. Specifying
-     * a <code>handler</code> of <code>null</code> indicates that the URL
+     * a {@code handler} of {@code null} indicates that the URL
      * should use a default stream handler for the protocol, as outlined
      * for:
      *     java.net.URL#URL(java.lang.String, java.lang.String, int,
      *                      java.lang.String)
      *
      * <p>If the handler is not null and there is a security manager,
-     * the security manager's <code>checkPermission</code>
+     * the security manager's {@code checkPermission}
      * method is called with a
-     * <code>NetPermission("specifyStreamHandler")</code> permission.
+     * {@code NetPermission("specifyStreamHandler")} permission.
      * This may result in a SecurityException.
      *
      * No validation of the inputs is performed by this constructor.
@@ -354,7 +354,7 @@
      * @exception  MalformedURLException  if an unknown protocol is specified.
      * @exception  SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow
+     *        {@code checkPermission} method doesn't allow
      *        specifying a stream handler explicitly.
      * @see        java.lang.System#getProperty(java.lang.String)
      * @see        java.net.URL#setURLStreamHandlerFactory(
@@ -417,15 +417,15 @@
     }
 
     /**
-     * Creates a <code>URL</code> object from the <code>String</code>
+     * Creates a {@code URL} object from the {@code String}
      * representation.
      * <p>
      * This constructor is equivalent to a call to the two-argument
-     * constructor with a <code>null</code> first argument.
+     * constructor with a {@code null} first argument.
      *
-     * @param      spec   the <code>String</code> to parse as a URL.
+     * @param      spec   the {@code String} to parse as a URL.
      * @exception  MalformedURLException  if no protocol is specified, or an
-     *               unknown protocol is found, or <tt>spec</tt> is <tt>null</tt>.
+     *               unknown protocol is found, or {@code spec} is {@code null}.
      * @see        java.net.URL#URL(java.net.URL, java.lang.String)
      */
     public URL(String spec) throws MalformedURLException {
@@ -470,9 +470,9 @@
      * For a more detailed description of URL parsing, refer to RFC2396.
      *
      * @param      context   the context in which to parse the specification.
-     * @param      spec      the <code>String</code> to parse as a URL.
+     * @param      spec      the {@code String} to parse as a URL.
      * @exception  MalformedURLException  if no protocol is specified, or an
-     *               unknown protocol is found, or <tt>spec</tt> is <tt>null</tt>.
+     *               unknown protocol is found, or {@code spec} is {@code null}.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
      *                  int, java.lang.String)
      * @see        java.net.URLStreamHandler
@@ -489,13 +489,13 @@
      * occurs as with the two argument constructor.
      *
      * @param      context   the context in which to parse the specification.
-     * @param      spec      the <code>String</code> to parse as a URL.
+     * @param      spec      the {@code String} to parse as a URL.
      * @param      handler   the stream handler for the URL.
      * @exception  MalformedURLException  if no protocol is specified, or an
-     *               unknown protocol is found, or <tt>spec</tt> is <tt>null</tt>.
+     *               unknown protocol is found, or {@code spec} is {@code null}.
      * @exception  SecurityException
      *        if a security manager exists and its
-     *        <code>checkPermission</code> method doesn't allow
+     *        {@code checkPermission} method doesn't allow
      *        specifying a stream handler.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
      *                  int, java.lang.String)
@@ -719,9 +719,9 @@
     }
 
     /**
-     * Gets the query part of this <code>URL</code>.
+     * Gets the query part of this {@code URL}.
      *
-     * @return  the query part of this <code>URL</code>,
+     * @return  the query part of this {@code URL},
      * or <CODE>null</CODE> if one does not exist
      * @since 1.3
      */
@@ -730,9 +730,9 @@
     }
 
     /**
-     * Gets the path part of this <code>URL</code>.
+     * Gets the path part of this {@code URL}.
      *
-     * @return  the path part of this <code>URL</code>, or an
+     * @return  the path part of this {@code URL}, or an
      * empty string if one does not exist
      * @since 1.3
      */
@@ -741,9 +741,9 @@
     }
 
     /**
-     * Gets the userInfo part of this <code>URL</code>.
+     * Gets the userInfo part of this {@code URL}.
      *
-     * @return  the userInfo part of this <code>URL</code>, or
+     * @return  the userInfo part of this {@code URL}, or
      * <CODE>null</CODE> if one does not exist
      * @since 1.3
      */
@@ -752,9 +752,9 @@
     }
 
     /**
-     * Gets the authority part of this <code>URL</code>.
+     * Gets the authority part of this {@code URL}.
      *
-     * @return  the authority part of this <code>URL</code>
+     * @return  the authority part of this {@code URL}
      * @since 1.3
      */
     public String getAuthority() {
@@ -762,7 +762,7 @@
     }
 
     /**
-     * Gets the port number of this <code>URL</code>.
+     * Gets the port number of this {@code URL}.
      *
      * @return  the port number, or -1 if the port is not set
      */
@@ -772,7 +772,7 @@
 
     /**
      * Gets the default port number of the protocol associated
-     * with this <code>URL</code>. If the URL scheme or the URLStreamHandler
+     * with this {@code URL}. If the URL scheme or the URLStreamHandler
      * for the URL do not define a default port number,
      * then -1 is returned.
      *
@@ -784,35 +784,35 @@
     }
 
     /**
-     * Gets the protocol name of this <code>URL</code>.
+     * Gets the protocol name of this {@code URL}.
      *
-     * @return  the protocol of this <code>URL</code>.
+     * @return  the protocol of this {@code URL}.
      */
     public String getProtocol() {
         return protocol;
     }
 
     /**
-     * Gets the host name of this <code>URL</code>, if applicable.
+     * Gets the host name of this {@code URL}, if applicable.
      * The format of the host conforms to RFC 2732, i.e. for a
      * literal IPv6 address, this method will return the IPv6 address
-     * enclosed in square brackets (<tt>'['</tt> and <tt>']'</tt>).
+     * enclosed in square brackets ({@code '['} and {@code ']'}).
      *
-     * @return  the host name of this <code>URL</code>.
+     * @return  the host name of this {@code URL}.
      */
     public String getHost() {
         return host;
     }
 
     /**
-     * Gets the file name of this <code>URL</code>.
+     * Gets the file name of this {@code URL}.
      * The returned file portion will be
      * the same as <CODE>getPath()</CODE>, plus the concatenation of
      * the value of <CODE>getQuery()</CODE>, if any. If there is
      * no query portion, this method and <CODE>getPath()</CODE> will
      * return identical results.
      *
-     * @return  the file name of this <code>URL</code>,
+     * @return  the file name of this {@code URL},
      * or an empty string if one does not exist
      */
     public String getFile() {
@@ -821,10 +821,10 @@
 
     /**
      * Gets the anchor (also known as the "reference") of this
-     * <code>URL</code>.
+     * {@code URL}.
      *
      * @return  the anchor (also known as the "reference") of this
-     *          <code>URL</code>, or <CODE>null</CODE> if one does not exist
+     *          {@code URL}, or <CODE>null</CODE> if one does not exist
      */
     public String getRef() {
         return ref;
@@ -834,7 +834,7 @@
      * Compares this URL for equality with another object.<p>
      *
      * If the given object is not a URL then this method immediately returns
-     * <code>false</code>.<p>
+     * {@code false}.<p>
      *
      * Two URL objects are equal if they have the same protocol, reference
      * equivalent hosts, have the same port number on the host, and the same
@@ -848,12 +848,12 @@
      * Since hosts comparison requires name resolution, this operation is a
      * blocking operation. <p>
      *
-     * Note: The defined behavior for <code>equals</code> is known to
+     * Note: The defined behavior for {@code equals} is known to
      * be inconsistent with virtual hosting in HTTP.
      *
      * @param   obj   the URL to compare against.
-     * @return  <code>true</code> if the objects are the same;
-     *          <code>false</code> otherwise.
+     * @return  {@code true} if the objects are the same;
+     *          {@code false} otherwise.
      */
     public boolean equals(Object obj) {
         if (!(obj instanceof URL))
@@ -869,7 +869,7 @@
      * The hash code is based upon all the URL components relevant for URL
      * comparison. As such, this operation is a blocking operation.<p>
      *
-     * @return  a hash code for this <code>URL</code>.
+     * @return  a hash code for this {@code URL}.
      */
     public synchronized int hashCode() {
         if (hashCode != -1)
@@ -882,21 +882,21 @@
     /**
      * Compares two URLs, excluding the fragment component.<p>
      *
-     * Returns <code>true</code> if this <code>URL</code> and the
-     * <code>other</code> argument are equal without taking the
+     * Returns {@code true} if this {@code URL} and the
+     * {@code other} argument are equal without taking the
      * fragment component into consideration.
      *
-     * @param   other   the <code>URL</code> to compare against.
-     * @return  <code>true</code> if they reference the same remote object;
-     *          <code>false</code> otherwise.
+     * @param   other   the {@code URL} to compare against.
+     * @return  {@code true} if they reference the same remote object;
+     *          {@code false} otherwise.
      */
     public boolean sameFile(URL other) {
         return handler.sameFile(this, other);
     }
 
     /**
-     * Constructs a string representation of this <code>URL</code>. The
-     * string is created by calling the <code>toExternalForm</code>
+     * Constructs a string representation of this {@code URL}. The
+     * string is created by calling the {@code toExternalForm}
      * method of the stream protocol handler for this object.
      *
      * @return  a string representation of this object.
@@ -909,8 +909,8 @@
     }
 
     /**
-     * Constructs a string representation of this <code>URL</code>. The
-     * string is created by calling the <code>toExternalForm</code>
+     * Constructs a string representation of this {@code URL}. The
+     * string is created by calling the {@code toExternalForm}
      * method of the stream protocol handler for this object.
      *
      * @return  a string representation of this object.
@@ -924,7 +924,7 @@
 
     /**
      * Returns a {@link java.net.URI} equivalent to this URL.
-     * This method functions in the same way as <code>new URI (this.toString())</code>.
+     * This method functions in the same way as {@code new URI (this.toString())}.
      * <p>Note, any URL instance that complies with RFC 2396 can be converted
      * to a URI. However, some URLs that are not strictly in compliance
      * can not be converted to a URI.
@@ -984,7 +984,7 @@
      * @param      proxy the Proxy through which this connection
      *             will be made. If direct connection is desired,
      *             Proxy.NO_PROXY should be specified.
-     * @return     a <code>URLConnection</code> to the URL.
+     * @return     a {@code URLConnection} to the URL.
      * @exception  IOException  if an I/O exception occurs.
      * @exception  SecurityException if a security manager is present
      *             and the caller doesn't have permission to connect
@@ -1022,8 +1022,8 @@
     }
 
     /**
-     * Opens a connection to this <code>URL</code> and returns an
-     * <code>InputStream</code> for reading from that connection. This
+     * Opens a connection to this {@code URL} and returns an
+     * {@code InputStream} for reading from that connection. This
      * method is a shorthand for:
      * <blockquote><pre>
      *     openConnection().getInputStream()
@@ -1077,22 +1077,22 @@
     static URLStreamHandlerFactory factory;
 
     /**
-     * Sets an application's <code>URLStreamHandlerFactory</code>.
+     * Sets an application's {@code URLStreamHandlerFactory}.
      * This method can be called at most once in a given Java Virtual
      * Machine.
      *
-     *<p> The <code>URLStreamHandlerFactory</code> instance is used to
+     *<p> The {@code URLStreamHandlerFactory} instance is used to
      *construct a stream protocol handler from a protocol name.
      *
      * <p> If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
      * @exception  Error  if the application has already set a factory.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't allow
+     *             {@code checkSetFactory} method doesn't allow
      *             the operation.
      * @see        java.net.URL#URL(java.lang.String, java.lang.String,
      *             int, java.lang.String)
--- a/jdk/src/share/classes/java/net/URLClassLoader.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URLClassLoader.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
 
     /**
      * Constructs a new URLClassLoader for the specified URLs using the
-     * default delegation parent <code>ClassLoader</code>. The URLs will
+     * default delegation parent {@code ClassLoader}. The URLs will
      * be searched in the order specified for classes and resources after
      * first searching in the parent class loader. Any URL that ends with
      * a '/' is assumed to refer to a directory. Otherwise, the URL is
@@ -125,13 +125,13 @@
      * as needed.
      *
      * <p>If there is a security manager, this method first
-     * calls the security manager's <code>checkCreateClassLoader</code> method
+     * calls the security manager's {@code checkCreateClassLoader} method
      * to ensure creation of a class loader is allowed.
      *
      * @param urls the URLs from which to load classes and resources
      *
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkCreateClassLoader</code> method doesn't allow
+     *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
      * @see SecurityManager#checkCreateClassLoader
      */
@@ -165,7 +165,7 @@
      * obtain protocol handlers when creating new jar URLs.
      *
      * <p>If there is a security manager, this method first
-     * calls the security manager's <code>checkCreateClassLoader</code> method
+     * calls the security manager's {@code checkCreateClassLoader} method
      * to ensure creation of a class loader is allowed.
      *
      * @param urls the URLs from which to load classes and resources
@@ -173,7 +173,7 @@
      * @param factory the URLStreamHandlerFactory to use when creating URLs
      *
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkCreateClassLoader</code> method doesn't allow
+     *             {@code checkCreateClassLoader} method doesn't allow
      *             creation of a class loader.
      * @see SecurityManager#checkCreateClassLoader
      */
@@ -217,7 +217,7 @@
      * @param  name
      *         The resource name
      *
-     * @return  An input stream for reading the resource, or <tt>null</tt>
+     * @return  An input stream for reading the resource, or {@code null}
      *          if the resource could not be found
      *
      * @since  1.7
@@ -273,7 +273,7 @@
     * as suppressed exceptions of the first one caught, which is then re-thrown.
     *
     * @throws SecurityException if a security manager is set, and it denies
-    *   {@link RuntimePermission}<tt>("closeClassLoader")</tt>
+    *   {@link RuntimePermission}{@code ("closeClassLoader")}
     *
     * @since 1.7
     */
@@ -316,7 +316,7 @@
      * Appends the specified URL to the list of URLs to search for
      * classes and resources.
      * <p>
-     * If the URL specified is <code>null</code> or is already in the
+     * If the URL specified is {@code null} or is already in the
      * list of URLs, or if this loader is closed, then invoking this
      * method has no effect.
      *
@@ -537,7 +537,7 @@
      * Finds the resource with the specified name on the URL search path.
      *
      * @param name the name of the resource
-     * @return a <code>URL</code> for the resource, or <code>null</code>
+     * @return a {@code URL} for the resource, or {@code null}
      * if the resource could not be found, or if the loader is closed.
      */
     public URL findResource(final String name) {
@@ -560,7 +560,7 @@
      *
      * @param name the resource name
      * @exception IOException if an I/O exception occurs
-     * @return an <code>Enumeration</code> of <code>URL</code>s
+     * @return an {@code Enumeration} of {@code URL}s
      *         If the loader is closed, the Enumeration will be empty.
      */
     public Enumeration<URL> findResources(final String name)
@@ -699,9 +699,9 @@
     /**
      * Creates a new instance of URLClassLoader for the specified
      * URLs and parent class loader. If a security manager is
-     * installed, the <code>loadClass</code> method of the URLClassLoader
+     * installed, the {@code loadClass} method of the URLClassLoader
      * returned by this method will invoke the
-     * <code>SecurityManager.checkPackageAccess</code> method before
+     * {@code SecurityManager.checkPackageAccess} method before
      * loading the class.
      *
      * @param urls the URLs to search for classes and resources
@@ -725,9 +725,9 @@
     /**
      * Creates a new instance of URLClassLoader for the specified
      * URLs and default parent class loader. If a security manager is
-     * installed, the <code>loadClass</code> method of the URLClassLoader
+     * installed, the {@code loadClass} method of the URLClassLoader
      * returned by this method will invoke the
-     * <code>SecurityManager.checkPackageAccess</code> before
+     * {@code SecurityManager.checkPackageAccess} before
      * loading the class.
      *
      * @param urls the URLs to search for classes and resources
--- a/jdk/src/share/classes/java/net/URLConnection.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URLConnection.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,15 +40,15 @@
 import sun.net.www.MessageHeader;
 
 /**
- * The abstract class <code>URLConnection</code> is the superclass
+ * The abstract class {@code URLConnection} is the superclass
  * of all classes that represent a communications link between the
  * application and a URL. Instances of this class can be used both to
  * read from and to write to the resource referenced by the URL. In
  * general, creating a connection to a URL is a multistep process:
  * <p>
  * <center><table border=2 summary="Describes the process of creating a connection to a URL: openConnection() and connect() over time.">
- * <tr><th><code>openConnection()</code></th>
- *     <th><code>connect()</code></th></tr>
+ * <tr><th>{@code openConnection()}</th>
+ *     <th>{@code connect()}</th></tr>
  * <tr><td>Manipulate parameters that affect the connection to the remote
  *         resource.</td>
  *     <td>Interact with the resource; query header fields and
@@ -59,78 +59,78 @@
  *
  * <ol>
  * <li>The connection object is created by invoking the
- *     <code>openConnection</code> method on a URL.
+ *     {@code openConnection} method on a URL.
  * <li>The setup parameters and general request properties are manipulated.
  * <li>The actual connection to the remote object is made, using the
- *    <code>connect</code> method.
+ *    {@code connect} method.
  * <li>The remote object becomes available. The header fields and the contents
  *     of the remote object can be accessed.
  * </ol>
  * <p>
  * The setup parameters are modified using the following methods:
  * <ul>
- *   <li><code>setAllowUserInteraction</code>
- *   <li><code>setDoInput</code>
- *   <li><code>setDoOutput</code>
- *   <li><code>setIfModifiedSince</code>
- *   <li><code>setUseCaches</code>
+ *   <li>{@code setAllowUserInteraction}
+ *   <li>{@code setDoInput}
+ *   <li>{@code setDoOutput}
+ *   <li>{@code setIfModifiedSince}
+ *   <li>{@code setUseCaches}
  * </ul>
  * <p>
  * and the general request properties are modified using the method:
  * <ul>
- *   <li><code>setRequestProperty</code>
+ *   <li>{@code setRequestProperty}
  * </ul>
  * <p>
- * Default values for the <code>AllowUserInteraction</code> and
- * <code>UseCaches</code> parameters can be set using the methods
- * <code>setDefaultAllowUserInteraction</code> and
- * <code>setDefaultUseCaches</code>.
+ * Default values for the {@code AllowUserInteraction} and
+ * {@code UseCaches} parameters can be set using the methods
+ * {@code setDefaultAllowUserInteraction} and
+ * {@code setDefaultUseCaches}.
  * <p>
- * Each of the above <code>set</code> methods has a corresponding
- * <code>get</code> method to retrieve the value of the parameter or
+ * Each of the above {@code set} methods has a corresponding
+ * {@code get} method to retrieve the value of the parameter or
  * general request property. The specific parameters and general
  * request properties that are applicable are protocol specific.
  * <p>
  * The following methods are used to access the header fields and
  * the contents after the connection is made to the remote object:
  * <ul>
- *   <li><code>getContent</code>
- *   <li><code>getHeaderField</code>
- *   <li><code>getInputStream</code>
- *   <li><code>getOutputStream</code>
+ *   <li>{@code getContent}
+ *   <li>{@code getHeaderField}
+ *   <li>{@code getInputStream}
+ *   <li>{@code getOutputStream}
  * </ul>
  * <p>
  * Certain header fields are accessed frequently. The methods:
  * <ul>
- *   <li><code>getContentEncoding</code>
- *   <li><code>getContentLength</code>
- *   <li><code>getContentType</code>
- *   <li><code>getDate</code>
- *   <li><code>getExpiration</code>
- *   <li><code>getLastModifed</code>
+ *   <li>{@code getContentEncoding}
+ *   <li>{@code getContentLength}
+ *   <li>{@code getContentType}
+ *   <li>{@code getDate}
+ *   <li>{@code getExpiration}
+ *   <li>{@code getLastModifed}
  * </ul>
  * <p>
  * provide convenient access to these fields. The
- * <code>getContentType</code> method is used by the
- * <code>getContent</code> method to determine the type of the remote
+ * {@code getContentType} method is used by the
+ * {@code getContent} method to determine the type of the remote
  * object; subclasses may find it convenient to override the
- * <code>getContentType</code> method.
+ * {@code getContentType} method.
  * <p>
  * In the common case, all of the pre-connection parameters and
  * general request properties can be ignored: the pre-connection
  * parameters and request properties default to sensible values. For
  * most clients of this interface, there are only two interesting
- * methods: <code>getInputStream</code> and <code>getContent</code>,
- * which are mirrored in the <code>URL</code> class by convenience methods.
+ * methods: {@code getInputStream} and {@code getContent},
+ * which are mirrored in the {@code URL} class by convenience methods.
  * <p>
  * More information on the request properties and header fields of
- * an <code>http</code> connection can be found at:
+ * an {@code http} connection can be found at:
  * <blockquote><pre>
  * <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a>
  * </pre></blockquote>
  *
- * Invoking the <tt>close()</tt> methods on the <tt>InputStream</tt> or <tt>OutputStream</tt> of an
- * <tt>URLConnection</tt> after a request may free network resources associated with this
+ * Invoking the {@code close()} methods on the {@code InputStream} or {@code OutputStream} of an
+ * {@code URLConnection} after a request may free network resources associated with this
  * instance, unless particular protocol specifications specify different behaviours
  * for it.
  *
@@ -164,10 +164,10 @@
      * which this connection is opened.
      * <p>
      * The value of this field can be accessed by the
-     * <code>getURL</code> method.
+     * {@code getURL} method.
      * <p>
      * The default value of this variable is the value of the URL
-     * argument in the <code>URLConnection</code> constructor.
+     * argument in the {@code URLConnection} constructor.
      *
      * @see     java.net.URLConnection#getURL()
      * @see     java.net.URLConnection#url
@@ -175,14 +175,14 @@
     protected URL url;
 
    /**
-     * This variable is set by the <code>setDoInput</code> method. Its
-     * value is returned by the <code>getDoInput</code> method.
+     * This variable is set by the {@code setDoInput} method. Its
+     * value is returned by the {@code getDoInput} method.
      * <p>
      * A URL connection can be used for input and/or output. Setting the
-     * <code>doInput</code> flag to <code>true</code> indicates that
+     * {@code doInput} flag to {@code true} indicates that
      * the application intends to read data from the URL connection.
      * <p>
-     * The default value of this field is <code>true</code>.
+     * The default value of this field is {@code true}.
      *
      * @see     java.net.URLConnection#getDoInput()
      * @see     java.net.URLConnection#setDoInput(boolean)
@@ -190,14 +190,14 @@
     protected boolean doInput = true;
 
    /**
-     * This variable is set by the <code>setDoOutput</code> method. Its
-     * value is returned by the <code>getDoOutput</code> method.
+     * This variable is set by the {@code setDoOutput} method. Its
+     * value is returned by the {@code getDoOutput} method.
      * <p>
      * A URL connection can be used for input and/or output. Setting the
-     * <code>doOutput</code> flag to <code>true</code> indicates
+     * {@code doOutput} flag to {@code true} indicates
      * that the application intends to write data to the URL connection.
      * <p>
-     * The default value of this field is <code>false</code>.
+     * The default value of this field is {@code false}.
      *
      * @see     java.net.URLConnection#getDoOutput()
      * @see     java.net.URLConnection#setDoOutput(boolean)
@@ -207,17 +207,17 @@
     private static boolean defaultAllowUserInteraction = false;
 
    /**
-     * If <code>true</code>, this <code>URL</code> is being examined in
+     * If {@code true}, this {@code URL} is being examined in
      * a context in which it makes sense to allow user interactions such
-     * as popping up an authentication dialog. If <code>false</code>,
+     * as popping up an authentication dialog. If {@code false},
      * then no user interaction is allowed.
      * <p>
      * The value of this field can be set by the
-     * <code>setAllowUserInteraction</code> method.
+     * {@code setAllowUserInteraction} method.
      * Its value is returned by the
-     * <code>getAllowUserInteraction</code> method.
+     * {@code getAllowUserInteraction} method.
      * Its default value is the value of the argument in the last invocation
-     * of the <code>setDefaultAllowUserInteraction</code> method.
+     * of the {@code setDefaultAllowUserInteraction} method.
      *
      * @see     java.net.URLConnection#getAllowUserInteraction()
      * @see     java.net.URLConnection#setAllowUserInteraction(boolean)
@@ -228,15 +228,15 @@
     private static boolean defaultUseCaches = true;
 
    /**
-     * If <code>true</code>, the protocol is allowed to use caching
-     * whenever it can. If <code>false</code>, the protocol must always
+     * If {@code true}, the protocol is allowed to use caching
+     * whenever it can. If {@code false}, the protocol must always
      * try to get a fresh copy of the object.
      * <p>
-     * This field is set by the <code>setUseCaches</code> method. Its
-     * value is returned by the <code>getUseCaches</code> method.
+     * This field is set by the {@code setUseCaches} method. Its
+     * value is returned by the {@code getUseCaches} method.
      * <p>
      * Its default value is the value given in the last invocation of the
-     * <code>setDefaultUseCaches</code> method.
+     * {@code setDefaultUseCaches} method.
      *
      * @see     java.net.URLConnection#setUseCaches(boolean)
      * @see     java.net.URLConnection#getUseCaches()
@@ -252,11 +252,11 @@
      * January 1, 1970, GMT. The object is fetched only if it has been
      * modified more recently than that time.
      * <p>
-     * This variable is set by the <code>setIfModifiedSince</code>
+     * This variable is set by the {@code setIfModifiedSince}
      * method. Its value is returned by the
-     * <code>getIfModifiedSince</code> method.
+     * {@code getIfModifiedSince} method.
      * <p>
-     * The default value of this field is <code>0</code>, indicating
+     * The default value of this field is {@code 0}, indicating
      * that the fetching must always occur.
      *
      * @see     java.net.URLConnection#getIfModifiedSince()
@@ -265,8 +265,8 @@
     protected long ifModifiedSince = 0;
 
    /**
-     * If <code>false</code>, this connection object has not created a
-     * communications link to the specified URL. If <code>true</code>,
+     * If {@code false}, this connection object has not created a
+     * communications link to the specified URL. If {@code true},
      * the communications link has been established.
      */
     protected boolean connected = false;
@@ -320,13 +320,13 @@
      * Sets the FileNameMap.
      * <p>
      * If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
      * @param map the FileNameMap to be set
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't allow the operation.
+     *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        SecurityManager#checkSetFactory
      * @see #getFileNameMap()
      * @since 1.2
@@ -341,9 +341,9 @@
      * Opens a communications link to the resource referenced by this
      * URL, if such a connection has not already been established.
      * <p>
-     * If the <code>connect</code> method is called when the connection
-     * has already been opened (indicated by the <code>connected</code>
-     * field having the value <code>true</code>), the call is ignored.
+     * If the {@code connect} method is called when the connection
+     * has already been opened (indicated by the {@code connected}
+     * field having the value {@code true}), the call is ignored.
      * <p>
      * URLConnection objects go through two phases: first they are
      * created, then they are connected.  After being created, and
@@ -375,7 +375,7 @@
      * the specified timeout. To see the connect timeout set, please
      * call getConnectTimeout().
      *
-     * @param timeout an <code>int</code> that specifies the connect
+     * @param timeout an {@code int} that specifies the connect
      *               timeout value in milliseconds
      * @throws IllegalArgumentException if the timeout parameter is negative
      *
@@ -396,7 +396,7 @@
      * 0 return implies that the option is disabled
      * (i.e., timeout of infinity).
      *
-     * @return an <code>int</code> that indicates the connect timeout
+     * @return an {@code int} that indicates the connect timeout
      *         value in milliseconds
      * @see #setConnectTimeout(int)
      * @see #connect()
@@ -418,7 +418,7 @@
      * specified timeout. To see the read timeout set, please call
      * getReadTimeout().
      *
-     * @param timeout an <code>int</code> that specifies the timeout
+     * @param timeout an {@code int} that specifies the timeout
      * value to be used in milliseconds
      * @throws IllegalArgumentException if the timeout parameter is negative
      *
@@ -437,7 +437,7 @@
      * Returns setting for read timeout. 0 return implies that the
      * option is disabled (i.e., timeout of infinity).
      *
-     * @return an <code>int</code> that indicates the read timeout
+     * @return an {@code int} that indicates the read timeout
      *         value in milliseconds
      *
      * @see #setReadTimeout(int)
@@ -459,10 +459,10 @@
     }
 
     /**
-     * Returns the value of this <code>URLConnection</code>'s <code>URL</code>
+     * Returns the value of this {@code URLConnection}'s {@code URL}
      * field.
      *
-     * @return  the value of this <code>URLConnection</code>'s <code>URL</code>
+     * @return  the value of this {@code URLConnection}'s {@code URL}
      *          field.
      * @see     java.net.URLConnection#url
      */
@@ -471,7 +471,7 @@
     }
 
     /**
-     * Returns the value of the <code>content-length</code> header field.
+     * Returns the value of the {@code content-length} header field.
      * <P>
      * <B>Note</B>: {@link #getContentLengthLong() getContentLengthLong()}
      * should be preferred over this method, since it returns a {@code long}
@@ -489,11 +489,11 @@
     }
 
     /**
-     * Returns the value of the <code>content-length</code> header field as a
+     * Returns the value of the {@code content-length} header field as a
      * long.
      *
      * @return  the content length of the resource that this connection's URL
-     *          references, or <code>-1</code> if the content length is
+     *          references, or {@code -1} if the content length is
      *          not known.
      * @since 7.0
      */
@@ -502,10 +502,10 @@
     }
 
     /**
-     * Returns the value of the <code>content-type</code> header field.
+     * Returns the value of the {@code content-type} header field.
      *
      * @return  the content type of the resource that the URL references,
-     *          or <code>null</code> if not known.
+     *          or {@code null} if not known.
      * @see     java.net.URLConnection#getHeaderField(java.lang.String)
      */
     public String getContentType() {
@@ -513,10 +513,10 @@
     }
 
     /**
-     * Returns the value of the <code>content-encoding</code> header field.
+     * Returns the value of the {@code content-encoding} header field.
      *
      * @return  the content encoding of the resource that the URL references,
-     *          or <code>null</code> if not known.
+     *          or {@code null} if not known.
      * @see     java.net.URLConnection#getHeaderField(java.lang.String)
      */
     public String getContentEncoding() {
@@ -524,7 +524,7 @@
     }
 
     /**
-     * Returns the value of the <code>expires</code> header field.
+     * Returns the value of the {@code expires} header field.
      *
      * @return  the expiration date of the resource that this URL references,
      *          or 0 if not known. The value is the number of milliseconds since
@@ -536,10 +536,10 @@
     }
 
     /**
-     * Returns the value of the <code>date</code> header field.
+     * Returns the value of the {@code date} header field.
      *
      * @return  the sending date of the resource that the URL references,
-     *          or <code>0</code> if not known. The value returned is the
+     *          or {@code 0} if not known. The value returned is the
      *          number of milliseconds since January 1, 1970 GMT.
      * @see     java.net.URLConnection#getHeaderField(java.lang.String)
      */
@@ -548,11 +548,11 @@
     }
 
     /**
-     * Returns the value of the <code>last-modified</code> header field.
+     * Returns the value of the {@code last-modified} header field.
      * The result is the number of milliseconds since January 1, 1970 GMT.
      *
      * @return  the date the resource referenced by this
-     *          <code>URLConnection</code> was last modified, or 0 if not known.
+     *          {@code URLConnection} was last modified, or 0 if not known.
      * @see     java.net.URLConnection#getHeaderField(java.lang.String)
      */
     public long getLastModified() {
@@ -567,7 +567,7 @@
      *
      *
      * @param   name   the name of a header field.
-     * @return  the value of the named header field, or <code>null</code>
+     * @return  the value of the named header field, or {@code null}
      *          if there is no such field in the header.
      */
     public String getHeaderField(String name) {
@@ -591,15 +591,15 @@
     /**
      * Returns the value of the named field parsed as a number.
      * <p>
-     * This form of <code>getHeaderField</code> exists because some
-     * connection types (e.g., <code>http-ng</code>) have pre-parsed
+     * This form of {@code getHeaderField} exists because some
+     * connection types (e.g., {@code http-ng}) have pre-parsed
      * headers. Classes for that connection type can override this method
      * and short-circuit the parsing.
      *
      * @param   name      the name of the header field.
      * @param   Default   the default value.
      * @return  the value of the named field, parsed as an integer. The
-     *          <code>Default</code> value is returned if the field is
+     *          {@code Default} value is returned if the field is
      *          missing or malformed.
      */
     public int getHeaderFieldInt(String name, int Default) {
@@ -613,15 +613,15 @@
     /**
      * Returns the value of the named field parsed as a number.
      * <p>
-     * This form of <code>getHeaderField</code> exists because some
-     * connection types (e.g., <code>http-ng</code>) have pre-parsed
+     * This form of {@code getHeaderField} exists because some
+     * connection types (e.g., {@code http-ng}) have pre-parsed
      * headers. Classes for that connection type can override this method
      * and short-circuit the parsing.
      *
      * @param   name      the name of the header field.
      * @param   Default   the default value.
      * @return  the value of the named field, parsed as a long. The
-     *          <code>Default</code> value is returned if the field is
+     *          {@code Default} value is returned if the field is
      *          missing or malformed.
      * @since 7.0
      */
@@ -638,15 +638,15 @@
      * The result is the number of milliseconds since January 1, 1970 GMT
      * represented by the named field.
      * <p>
-     * This form of <code>getHeaderField</code> exists because some
-     * connection types (e.g., <code>http-ng</code>) have pre-parsed
+     * This form of {@code getHeaderField} exists because some
+     * connection types (e.g., {@code http-ng}) have pre-parsed
      * headers. Classes for that connection type can override this method
      * and short-circuit the parsing.
      *
      * @param   name     the name of the header field.
      * @param   Default   a default value.
      * @return  the value of the field, parsed as a date. The value of the
-     *          <code>Default</code> argument is returned if the field is
+     *          {@code Default} argument is returned if the field is
      *          missing or malformed.
      */
     @SuppressWarnings("deprecation")
@@ -659,12 +659,12 @@
     }
 
     /**
-     * Returns the key for the <code>n</code><sup>th</sup> header field.
-     * It returns <code>null</code> if there are fewer than <code>n+1</code> fields.
+     * Returns the key for the {@code n}<sup>th</sup> header field.
+     * It returns {@code null} if there are fewer than {@code n+1} fields.
      *
      * @param   n   an index, where {@code n>=0}
-     * @return  the key for the <code>n</code><sup>th</sup> header field,
-     *          or <code>null</code> if there are fewer than <code>n+1</code>
+     * @return  the key for the {@code n}<sup>th</sup> header field,
+     *          or {@code null} if there are fewer than {@code n+1}
      *          fields.
      */
     public String getHeaderFieldKey(int n) {
@@ -672,17 +672,17 @@
     }
 
     /**
-     * Returns the value for the <code>n</code><sup>th</sup> header field.
-     * It returns <code>null</code> if there are fewer than
-     * <code>n+1</code>fields.
+     * Returns the value for the {@code n}<sup>th</sup> header field.
+     * It returns {@code null} if there are fewer than
+     * {@code n+1}fields.
      * <p>
      * This method can be used in conjunction with the
      * {@link #getHeaderFieldKey(int) getHeaderFieldKey} method to iterate through all
      * the headers in the message.
      *
      * @param   n   an index, where {@code n>=0}
-     * @return  the value of the <code>n</code><sup>th</sup> header field
-     *          or <code>null</code> if there are fewer than <code>n+1</code> fields
+     * @return  the value of the {@code n}<sup>th</sup> header field
+     *          or {@code null} if there are fewer than {@code n+1} fields
      * @see     java.net.URLConnection#getHeaderFieldKey(int)
      */
     public String getHeaderField(int n) {
@@ -693,35 +693,35 @@
      * Retrieves the contents of this URL connection.
      * <p>
      * This method first determines the content type of the object by
-     * calling the <code>getContentType</code> method. If this is
+     * calling the {@code getContentType} method. If this is
      * the first time that the application has seen that specific content
      * type, a content handler for that content type is created:
      * <ol>
      * <li>If the application has set up a content handler factory instance
-     *     using the <code>setContentHandlerFactory</code> method, the
-     *     <code>createContentHandler</code> method of that instance is called
+     *     using the {@code setContentHandlerFactory} method, the
+     *     {@code createContentHandler} method of that instance is called
      *     with the content type as an argument; the result is a content
      *     handler for that content type.
      * <li>If no content handler factory has yet been set up, or if the
-     *     factory's <code>createContentHandler</code> method returns
-     *     <code>null</code>, then the application loads the class named:
+     *     factory's {@code createContentHandler} method returns
+     *     {@code null}, then the application loads the class named:
      *     <blockquote><pre>
      *         sun.net.www.content.&lt;<i>contentType</i>&gt;
      *     </pre></blockquote>
      *     where &lt;<i>contentType</i>&gt; is formed by taking the
      *     content-type string, replacing all slash characters with a
-     *     <code>period</code> ('.'), and all other non-alphanumeric characters
-     *     with the underscore character '<code>_</code>'. The alphanumeric
+     *     {@code period} ('.'), and all other non-alphanumeric characters
+     *     with the underscore character '{@code _}'. The alphanumeric
      *     characters are specifically the 26 uppercase ASCII letters
-     *     '<code>A</code>' through '<code>Z</code>', the 26 lowercase ASCII
-     *     letters '<code>a</code>' through '<code>z</code>', and the 10 ASCII
-     *     digits '<code>0</code>' through '<code>9</code>'. If the specified
+     *     '{@code A}' through '{@code Z}', the 26 lowercase ASCII
+     *     letters '{@code a}' through '{@code z}', and the 10 ASCII
+     *     digits '{@code 0}' through '{@code 9}'. If the specified
      *     class does not exist, or is not a subclass of
-     *     <code>ContentHandler</code>, then an
-     *     <code>UnknownServiceException</code> is thrown.
+     *     {@code ContentHandler}, then an
+     *     {@code UnknownServiceException} is thrown.
      * </ol>
      *
-     * @return     the object fetched. The <code>instanceof</code> operator
+     * @return     the object fetched. The {@code instanceof} operator
      *               should be used to determine the specific kind of object
      *               returned.
      * @exception  IOException              if an I/O error occurs while
@@ -743,12 +743,12 @@
     /**
      * Retrieves the contents of this URL connection.
      *
-     * @param classes the <code>Class</code> array
+     * @param classes the {@code Class} array
      * indicating the requested types
      * @return     the object fetched that is the first match of the type
      *               specified in the classes array. null if none of
      *               the requested types are supported.
-     *               The <code>instanceof</code> operator should be used to
+     *               The {@code instanceof} operator should be used to
      *               determine the specific kind of object returned.
      * @exception  IOException              if an I/O error occurs while
      *               getting the content.
@@ -773,12 +773,12 @@
      * necessary to make the connection represented by this
      * object. This method returns null if no permission is
      * required to make the connection. By default, this method
-     * returns <code>java.security.AllPermission</code>. Subclasses
+     * returns {@code java.security.AllPermission}. Subclasses
      * should override this method and return the permission
      * that best represents the permission required to make a
-     * a connection to the URL. For example, a <code>URLConnection</code>
-     * representing a <code>file:</code> URL would return a
-     * <code>java.io.FilePermission</code> object.
+     * a connection to the URL. For example, a {@code URLConnection}
+     * representing a {@code file:} URL would return a
+     * {@code java.io.FilePermission} object.
      *
      * <p>The permission returned may dependent upon the state of the
      * connection. For example, the permission before connecting may be
@@ -844,17 +844,17 @@
     }
 
     /**
-     * Returns a <code>String</code> representation of this URL connection.
+     * Returns a {@code String} representation of this URL connection.
      *
-     * @return  a string representation of this <code>URLConnection</code>.
+     * @return  a string representation of this {@code URLConnection}.
      */
     public String toString() {
         return this.getClass().getName() + ":" + url;
     }
 
     /**
-     * Sets the value of the <code>doInput</code> field for this
-     * <code>URLConnection</code> to the specified value.
+     * Sets the value of the {@code doInput} field for this
+     * {@code URLConnection} to the specified value.
      * <p>
      * A URL connection can be used for input and/or output.  Set the DoInput
      * flag to true if you intend to use the URL connection for input,
@@ -872,11 +872,11 @@
     }
 
     /**
-     * Returns the value of this <code>URLConnection</code>'s
-     * <code>doInput</code> flag.
+     * Returns the value of this {@code URLConnection}'s
+     * {@code doInput} flag.
      *
-     * @return  the value of this <code>URLConnection</code>'s
-     *          <code>doInput</code> flag.
+     * @return  the value of this {@code URLConnection}'s
+     *          {@code doInput} flag.
      * @see     #setDoInput(boolean)
      */
     public boolean getDoInput() {
@@ -884,8 +884,8 @@
     }
 
     /**
-     * Sets the value of the <code>doOutput</code> field for this
-     * <code>URLConnection</code> to the specified value.
+     * Sets the value of the {@code doOutput} field for this
+     * {@code URLConnection} to the specified value.
      * <p>
      * A URL connection can be used for input and/or output.  Set the DoOutput
      * flag to true if you intend to use the URL connection for output,
@@ -902,11 +902,11 @@
     }
 
     /**
-     * Returns the value of this <code>URLConnection</code>'s
-     * <code>doOutput</code> flag.
+     * Returns the value of this {@code URLConnection}'s
+     * {@code doOutput} flag.
      *
-     * @return  the value of this <code>URLConnection</code>'s
-     *          <code>doOutput</code> flag.
+     * @return  the value of this {@code URLConnection}'s
+     *          {@code doOutput} flag.
      * @see     #setDoOutput(boolean)
      */
     public boolean getDoOutput() {
@@ -914,8 +914,8 @@
     }
 
     /**
-     * Set the value of the <code>allowUserInteraction</code> field of
-     * this <code>URLConnection</code>.
+     * Set the value of the {@code allowUserInteraction} field of
+     * this {@code URLConnection}.
      *
      * @param   allowuserinteraction   the new value.
      * @throws IllegalStateException if already connected
@@ -928,10 +928,10 @@
     }
 
     /**
-     * Returns the value of the <code>allowUserInteraction</code> field for
+     * Returns the value of the {@code allowUserInteraction} field for
      * this object.
      *
-     * @return  the value of the <code>allowUserInteraction</code> field for
+     * @return  the value of the {@code allowUserInteraction} field for
      *          this object.
      * @see     #setAllowUserInteraction(boolean)
      */
@@ -941,8 +941,8 @@
 
     /**
      * Sets the default value of the
-     * <code>allowUserInteraction</code> field for all future
-     * <code>URLConnection</code> objects to the specified value.
+     * {@code allowUserInteraction} field for all future
+     * {@code URLConnection} objects to the specified value.
      *
      * @param   defaultallowuserinteraction   the new value.
      * @see     #getDefaultAllowUserInteraction()
@@ -952,14 +952,14 @@
     }
 
     /**
-     * Returns the default value of the <code>allowUserInteraction</code>
+     * Returns the default value of the {@code allowUserInteraction}
      * field.
      * <p>
      * Ths default is "sticky", being a part of the static state of all
      * URLConnections.  This flag applies to the next, and all following
      * URLConnections that are created.
      *
-     * @return  the default value of the <code>allowUserInteraction</code>
+     * @return  the default value of the {@code allowUserInteraction}
      *          field.
      * @see     #setDefaultAllowUserInteraction(boolean)
      */
@@ -968,8 +968,8 @@
     }
 
     /**
-     * Sets the value of the <code>useCaches</code> field of this
-     * <code>URLConnection</code> to the specified value.
+     * Sets the value of the {@code useCaches} field of this
+     * {@code URLConnection} to the specified value.
      * <p>
      * Some protocols do caching of documents.  Occasionally, it is important
      * to be able to "tunnel through" and ignore the caches (e.g., the
@@ -979,7 +979,7 @@
      *  The default value comes from DefaultUseCaches, which defaults to
      * true.
      *
-     * @param usecaches a <code>boolean</code> indicating whether
+     * @param usecaches a {@code boolean} indicating whether
      * or not to allow caching
      * @throws IllegalStateException if already connected
      * @see #getUseCaches()
@@ -991,11 +991,11 @@
     }
 
     /**
-     * Returns the value of this <code>URLConnection</code>'s
-     * <code>useCaches</code> field.
+     * Returns the value of this {@code URLConnection}'s
+     * {@code useCaches} field.
      *
-     * @return  the value of this <code>URLConnection</code>'s
-     *          <code>useCaches</code> field.
+     * @return  the value of this {@code URLConnection}'s
+     *          {@code useCaches} field.
      * @see #setUseCaches(boolean)
      */
     public boolean getUseCaches() {
@@ -1003,8 +1003,8 @@
     }
 
     /**
-     * Sets the value of the <code>ifModifiedSince</code> field of
-     * this <code>URLConnection</code> to the specified value.
+     * Sets the value of the {@code ifModifiedSince} field of
+     * this {@code URLConnection} to the specified value.
      *
      * @param   ifmodifiedsince   the new value.
      * @throws IllegalStateException if already connected
@@ -1017,9 +1017,9 @@
     }
 
     /**
-     * Returns the value of this object's <code>ifModifiedSince</code> field.
+     * Returns the value of this object's {@code ifModifiedSince} field.
      *
-     * @return  the value of this object's <code>ifModifiedSince</code> field.
+     * @return  the value of this object's {@code ifModifiedSince} field.
      * @see #setIfModifiedSince(long)
      */
     public long getIfModifiedSince() {
@@ -1027,15 +1027,15 @@
     }
 
    /**
-     * Returns the default value of a <code>URLConnection</code>'s
-     * <code>useCaches</code> flag.
+     * Returns the default value of a {@code URLConnection}'s
+     * {@code useCaches} flag.
      * <p>
      * Ths default is "sticky", being a part of the static state of all
      * URLConnections.  This flag applies to the next, and all following
      * URLConnections that are created.
      *
-     * @return  the default value of a <code>URLConnection</code>'s
-     *          <code>useCaches</code> flag.
+     * @return  the default value of a {@code URLConnection}'s
+     *          {@code useCaches} flag.
      * @see     #setDefaultUseCaches(boolean)
      */
     public boolean getDefaultUseCaches() {
@@ -1043,7 +1043,7 @@
     }
 
    /**
-     * Sets the default value of the <code>useCaches</code> field to the
+     * Sets the default value of the {@code useCaches} field to the
      * specified value.
      *
      * @param   defaultusecaches   the new value.
@@ -1063,7 +1063,7 @@
      * properties to be appended into a single property.
      *
      * @param   key     the keyword by which the request is known
-     *                  (e.g., "<code>Accept</code>").
+     *                  (e.g., "{@code Accept}").
      * @param   value   the value associated with it.
      * @throws IllegalStateException if already connected
      * @throws NullPointerException if key is <CODE>null</CODE>
@@ -1087,7 +1087,7 @@
      * existing values associated with the same key.
      *
      * @param   key     the keyword by which the request is known
-     *                  (e.g., "<code>Accept</code>").
+     *                  (e.g., "{@code Accept}").
      * @param   value  the value associated with it.
      * @throws IllegalStateException if already connected
      * @throws NullPointerException if key is null
@@ -1151,11 +1151,11 @@
 
     /**
      * Sets the default value of a general request property. When a
-     * <code>URLConnection</code> is created, it is initialized with
+     * {@code URLConnection} is created, it is initialized with
      * these properties.
      *
      * @param   key     the keyword by which the request is known
-     *                  (e.g., "<code>Accept</code>").
+     *                  (e.g., "{@code Accept}").
      * @param   value   the value associated with the key.
      *
      * @see java.net.URLConnection#setRequestProperty(java.lang.String,java.lang.String)
@@ -1197,21 +1197,21 @@
     static ContentHandlerFactory factory;
 
     /**
-     * Sets the <code>ContentHandlerFactory</code> of an
+     * Sets the {@code ContentHandlerFactory} of an
      * application. It can be called at most once by an application.
      * <p>
-     * The <code>ContentHandlerFactory</code> instance is used to
+     * The {@code ContentHandlerFactory} instance is used to
      * construct a content handler from a content type
      * <p>
      * If there is a security manager, this method first calls
-     * the security manager's <code>checkSetFactory</code> method
+     * the security manager's {@code checkSetFactory} method
      * to ensure the operation is allowed.
      * This could result in a SecurityException.
      *
      * @param      fac   the desired factory.
      * @exception  Error  if the factory has already been defined.
      * @exception  SecurityException  if a security manager exists and its
-     *             <code>checkSetFactory</code> method doesn't allow the operation.
+     *             {@code checkSetFactory} method doesn't allow the operation.
      * @see        java.net.ContentHandlerFactory
      * @see        java.net.URLConnection#getContent()
      * @see        SecurityManager#checkSetFactory
@@ -1374,7 +1374,7 @@
      * Tries to determine the content type of an object, based
      * on the specified "file" component of a URL.
      * This is a convenience method that can be used by
-     * subclasses that override the <code>getContentType</code> method.
+     * subclasses that override the {@code getContentType} method.
      *
      * @param   fname   a filename.
      * @return  a guess as to what the content type of the object is,
@@ -1389,16 +1389,16 @@
      * Tries to determine the type of an input stream based on the
      * characters at the beginning of the input stream. This method can
      * be used by subclasses that override the
-     * <code>getContentType</code> method.
+     * {@code getContentType} method.
      * <p>
      * Ideally, this routine would not be needed. But many
-     * <code>http</code> servers return the incorrect content type; in
+     * {@code http} servers return the incorrect content type; in
      * addition, there are many nonstandard extensions. Direct inspection
      * of the bytes to determine the content type is often more accurate
-     * than believing the content type claimed by the <code>http</code> server.
+     * than believing the content type claimed by the {@code http} server.
      *
      * @param      is   an input stream that supports marks.
-     * @return     a guess at the content type, or <code>null</code> if none
+     * @return     a guess at the content type, or {@code null} if none
      *             can be determined.
      * @exception  IOException  if an I/O error occurs while reading the
      *               input stream.
--- a/jdk/src/share/classes/java/net/URLDecoder.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URLDecoder.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,27 +34,27 @@
  * <p>
  * The conversion process is the reverse of that used by the URLEncoder class. It is assumed
  * that all characters in the encoded string are one of the following:
- * &quot;<code>a</code>&quot; through &quot;<code>z</code>&quot;,
- * &quot;<code>A</code>&quot; through &quot;<code>Z</code>&quot;,
- * &quot;<code>0</code>&quot; through &quot;<code>9</code>&quot;, and
- * &quot;<code>-</code>&quot;, &quot;<code>_</code>&quot;,
- * &quot;<code>.</code>&quot;, and &quot;<code>*</code>&quot;. The
- * character &quot;<code>%</code>&quot; is allowed but is interpreted
+ * &quot;{@code a}&quot; through &quot;{@code z}&quot;,
+ * &quot;{@code A}&quot; through &quot;{@code Z}&quot;,
+ * &quot;{@code 0}&quot; through &quot;{@code 9}&quot;, and
+ * &quot;{@code -}&quot;, &quot;{@code _}&quot;,
+ * &quot;{@code .}&quot;, and &quot;{@code *}&quot;. The
+ * character &quot;{@code %}&quot; is allowed but is interpreted
  * as the start of a special escaped sequence.
  * <p>
  * The following rules are applied in the conversion:
  * <p>
  * <ul>
- * <li>The alphanumeric characters &quot;<code>a</code>&quot; through
- *     &quot;<code>z</code>&quot;, &quot;<code>A</code>&quot; through
- *     &quot;<code>Z</code>&quot; and &quot;<code>0</code>&quot;
- *     through &quot;<code>9</code>&quot; remain the same.
- * <li>The special characters &quot;<code>.</code>&quot;,
- *     &quot;<code>-</code>&quot;, &quot;<code>*</code>&quot;, and
- *     &quot;<code>_</code>&quot; remain the same.
- * <li>The plus sign &quot;<code>+</code>&quot; is converted into a
- *     space character &quot;<code>&nbsp;</code>&quot; .
- * <li>A sequence of the form "<code>%<i>xy</i></code>" will be
+ * <li>The alphanumeric characters &quot;{@code a}&quot; through
+ *     &quot;{@code z}&quot;, &quot;{@code A}&quot; through
+ *     &quot;{@code Z}&quot; and &quot;{@code 0}&quot;
+ *     through &quot;{@code 9}&quot; remain the same.
+ * <li>The special characters &quot;{@code .}&quot;,
+ *     &quot;{@code -}&quot;, &quot;{@code *}&quot;, and
+ *     &quot;{@code _}&quot; remain the same.
+ * <li>The plus sign &quot;{@code +}&quot; is converted into a
+ *     space character &quot; &nbsp; &quot; .
+ * <li>A sequence of the form "<i>{@code %xy}</i>" will be
  *     treated as representing a byte where <i>xy</i> is the two-digit
  *     hexadecimal representation of the 8 bits. Then, all substrings
  *     that contain one or more of these byte sequences consecutively
@@ -66,7 +66,7 @@
  * <p>
  * There are two possible ways in which this decoder could deal with
  * illegal strings.  It could either leave illegal characters alone or
- * it could throw an <tt>{@link java.lang.IllegalArgumentException}</tt>.
+ * it could throw an {@link java.lang.IllegalArgumentException}.
  * Which approach the decoder takes is left to the
  * implementation.
  *
@@ -81,15 +81,15 @@
     static String dfltEncName = URLEncoder.dfltEncName;
 
     /**
-     * Decodes a <code>x-www-form-urlencoded</code> string.
+     * Decodes a {@code x-www-form-urlencoded} string.
      * The platform's default encoding is used to determine what characters
      * are represented by any consecutive sequences of the form
-     * "<code>%<i>xy</i></code>".
-     * @param s the <code>String</code> to decode
+     * "<i>{@code %xy}</i>".
+     * @param s the {@code String} to decode
      * @deprecated The resulting string may vary depending on the platform's
      *          default encoding. Instead, use the decode(String,String) method
      *          to specify the encoding.
-     * @return the newly decoded <code>String</code>
+     * @return the newly decoded {@code String}
      */
     @Deprecated
     public static String decode(String s) {
@@ -106,11 +106,11 @@
     }
 
     /**
-     * Decodes a <code>application/x-www-form-urlencoded</code> string using a specific
+     * Decodes a {@code application/x-www-form-urlencoded} string using a specific
      * encoding scheme.
      * The supplied encoding is used to determine
      * what characters are represented by any consecutive sequences of the
-     * form "<code>%<i>xy</i></code>".
+     * form "<i>{@code %xy}</i>".
      * <p>
      * <em><strong>Note:</strong> The <a href=
      * "http://www.w3.org/TR/html40/appendix/notes.html#non-ascii-chars">
@@ -118,11 +118,11 @@
      * UTF-8 should be used. Not doing so may introduce
      * incompatibilites.</em>
      *
-     * @param s the <code>String</code> to decode
+     * @param s the {@code String} to decode
      * @param enc   The name of a supported
      *    <a href="../lang/package-summary.html#charenc">character
      *    encoding</a>.
-     * @return the newly decoded <code>String</code>
+     * @return the newly decoded {@code String}
      * @exception  UnsupportedEncodingException
      *             If character encoding needs to be consulted, but
      *             named character encoding is not supported
--- a/jdk/src/share/classes/java/net/URLEncoder.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URLEncoder.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,19 +51,19 @@
  *
  * <p>
  * <ul>
- * <li>The alphanumeric characters &quot;<code>a</code>&quot; through
- *     &quot;<code>z</code>&quot;, &quot;<code>A</code>&quot; through
- *     &quot;<code>Z</code>&quot; and &quot;<code>0</code>&quot;
- *     through &quot;<code>9</code>&quot; remain the same.
- * <li>The special characters &quot;<code>.</code>&quot;,
- *     &quot;<code>-</code>&quot;, &quot;<code>*</code>&quot;, and
- *     &quot;<code>_</code>&quot; remain the same.
- * <li>The space character &quot;<code>&nbsp;</code>&quot; is
- *     converted into a plus sign &quot;<code>+</code>&quot;.
+ * <li>The alphanumeric characters &quot;{@code a}&quot; through
+ *     &quot;{@code z}&quot;, &quot;{@code A}&quot; through
+ *     &quot;{@code Z}&quot; and &quot;{@code 0}&quot;
+ *     through &quot;{@code 9}&quot; remain the same.
+ * <li>The special characters &quot;{@code .}&quot;,
+ *     &quot;{@code -}&quot;, &quot;{@code *}&quot;, and
+ *     &quot;{@code _}&quot; remain the same.
+ * <li>The space character &quot; &nbsp; &quot; is
+ *     converted into a plus sign &quot;{@code +}&quot;.
  * <li>All other characters are unsafe and are first converted into
  *     one or more bytes using some encoding scheme. Then each byte is
  *     represented by the 3-character string
- *     &quot;<code>%<i>xy</i></code>&quot;, where <i>xy</i> is the
+ *     &quot;<i>{@code %xy}</i>&quot;, where <i>xy</i> is the
  *     two-digit hexadecimal representation of the byte.
  *     The recommended encoding scheme to use is UTF-8. However,
  *     for compatibility reasons, if an encoding is not specified,
@@ -152,15 +152,15 @@
     private URLEncoder() { }
 
     /**
-     * Translates a string into <code>x-www-form-urlencoded</code>
+     * Translates a string into {@code x-www-form-urlencoded}
      * format. This method uses the platform's default encoding
      * as the encoding scheme to obtain the bytes for unsafe characters.
      *
-     * @param   s   <code>String</code> to be translated.
+     * @param   s   {@code String} to be translated.
      * @deprecated The resulting string may vary depending on the platform's
      *             default encoding. Instead, use the encode(String,String)
      *             method to specify the encoding.
-     * @return  the translated <code>String</code>.
+     * @return  the translated {@code String}.
      */
     @Deprecated
     public static String encode(String s) {
@@ -177,7 +177,7 @@
     }
 
     /**
-     * Translates a string into <code>application/x-www-form-urlencoded</code>
+     * Translates a string into {@code application/x-www-form-urlencoded}
      * format using a specific encoding scheme. This method uses the
      * supplied encoding scheme to obtain the bytes for unsafe
      * characters.
@@ -188,11 +188,11 @@
      * UTF-8 should be used. Not doing so may introduce
      * incompatibilites.</em>
      *
-     * @param   s   <code>String</code> to be translated.
+     * @param   s   {@code String} to be translated.
      * @param   enc   The name of a supported
      *    <a href="../lang/package-summary.html#charenc">character
      *    encoding</a>.
-     * @return  the translated <code>String</code>.
+     * @return  the translated {@code String}.
      * @exception  UnsupportedEncodingException
      *             If the named encoding is not supported
      * @see URLDecoder#decode(java.lang.String, java.lang.String)
--- a/jdk/src/share/classes/java/net/URLStreamHandler.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URLStreamHandler.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,15 +34,15 @@
 import sun.net.www.ParseUtil;
 
 /**
- * The abstract class <code>URLStreamHandler</code> is the common
+ * The abstract class {@code URLStreamHandler} is the common
  * superclass for all stream protocol handlers. A stream protocol
  * handler knows how to make a connection for a particular protocol
- * type, such as <code>http</code> or <code>https</code>.
+ * type, such as {@code http} or {@code https}.
  * <p>
- * In most cases, an instance of a <code>URLStreamHandler</code>
+ * In most cases, an instance of a {@code URLStreamHandler}
  * subclass is not created directly by an application. Rather, the
  * first time a protocol name is encountered when constructing a
- * <code>URL</code>, the appropriate stream protocol handler is
+ * {@code URL}, the appropriate stream protocol handler is
  * automatically loaded.
  *
  * @author  James Gosling
@@ -52,7 +52,7 @@
 public abstract class URLStreamHandler {
     /**
      * Opens a connection to the object referenced by the
-     * <code>URL</code> argument.
+     * {@code URL} argument.
      * This method should be overridden by a subclass.
      *
      * <p>If for the handler's protocol (such as HTTP or JAR), there
@@ -64,7 +64,7 @@
      * JarURLConnection will be returned.
      *
      * @param      u   the URL that this connects to.
-     * @return     a <code>URLConnection</code> object for the <code>URL</code>.
+     * @return     a {@code URLConnection} object for the {@code URL}.
      * @exception  IOException  if an I/O error occurs while opening the
      *               connection.
      */
@@ -83,7 +83,7 @@
      * @param      p   the proxy through which the connection will be made.
      *                 If direct connection is desired, Proxy.NO_PROXY
      *                 should be specified.
-     * @return     a <code>URLConnection</code> object for the <code>URL</code>.
+     * @return     a {@code URLConnection} object for the {@code URL}.
      * @exception  IOException  if an I/O error occurs while opening the
      *               connection.
      * @exception  IllegalArgumentException if either u or p is null,
@@ -97,28 +97,28 @@
     }
 
     /**
-     * Parses the string representation of a <code>URL</code> into a
-     * <code>URL</code> object.
+     * Parses the string representation of a {@code URL} into a
+     * {@code URL} object.
      * <p>
      * If there is any inherited context, then it has already been
-     * copied into the <code>URL</code> argument.
+     * copied into the {@code URL} argument.
      * <p>
-     * The <code>parseURL</code> method of <code>URLStreamHandler</code>
+     * The {@code parseURL} method of {@code URLStreamHandler}
      * parses the string representation as if it were an
-     * <code>http</code> specification. Most URL protocol families have a
+     * {@code http} specification. Most URL protocol families have a
      * similar parsing. A stream protocol handler for a protocol that has
      * a different syntax must override this routine.
      *
-     * @param   u       the <code>URL</code> to receive the result of parsing
+     * @param   u       the {@code URL} to receive the result of parsing
      *                  the spec.
-     * @param   spec    the <code>String</code> representing the URL that
+     * @param   spec    the {@code String} representing the URL that
      *                  must be parsed.
      * @param   start   the character index at which to begin parsing. This is
-     *                  just past the '<code>:</code>' (if there is one) that
+     *                  just past the '{@code :}' (if there is one) that
      *                  specifies the determination of the protocol name.
      * @param   limit   the character position to stop parsing at. This is the
      *                  end of the string or the position of the
-     *                  "<code>#</code>" character, if present. All information
+     *                  "{@code #}" character, if present. All information
      *                  after the sharp sign indicates an anchor.
      */
     protected void parseURL(URL u, String spec, int start, int limit) {
@@ -307,7 +307,7 @@
     /**
      * Returns the default port for a URL parsed by this handler. This method
      * is meant to be overidden by handlers with default port numbers.
-     * @return the default port for a <code>URL</code> parsed by this handler.
+     * @return the default port for a {@code URL} parsed by this handler.
      * @since 1.3
      */
     protected int getDefaultPort() {
@@ -321,7 +321,7 @@
      * guaranteed by the fact that it is only called by java.net.URL class.
      * @param u1 a URL object
      * @param u2 a URL object
-     * @return <tt>true</tt> if the two urls are
+     * @return {@code true} if the two urls are
      * considered equal, ie. they refer to the same
      * fragment in the same file.
      * @since 1.3
@@ -338,7 +338,7 @@
      * other protocols that have different requirements for hashCode
      * calculation.
      * @param u a URL object
-     * @return an <tt>int</tt> suitable for hash table indexing
+     * @return an {@code int} suitable for hash table indexing
      * @since 1.3
      */
     protected int hashCode(URL u) {
@@ -420,7 +420,7 @@
      * will result in a null return.
      *
      * @param u a URL object
-     * @return an <code>InetAddress</code> representing the host
+     * @return an {@code InetAddress} representing the host
      * IP address.
      * @since 1.3
      */
@@ -447,8 +447,8 @@
      * Compares the host components of two URLs.
      * @param u1 the URL of the first host to compare
      * @param u2 the URL of the second host to compare
-     * @return  <tt>true</tt> if and only if they
-     * are equal, <tt>false</tt> otherwise.
+     * @return  {@code true} if and only if they
+     * are equal, {@code false} otherwise.
      * @since 1.3
      */
     protected boolean hostsEqual(URL u1, URL u2) {
@@ -465,11 +465,11 @@
     }
 
     /**
-     * Converts a <code>URL</code> of a specific protocol to a
-     * <code>String</code>.
+     * Converts a {@code URL} of a specific protocol to a
+     * {@code String}.
      *
      * @param   u   the URL.
-     * @return  a string representation of the <code>URL</code> argument.
+     * @return  a string representation of the {@code URL} argument.
      */
     protected String toExternalForm(URL u) {
 
@@ -508,7 +508,7 @@
     }
 
     /**
-     * Sets the fields of the <code>URL</code> argument to the indicated values.
+     * Sets the fields of the {@code URL} argument to the indicated values.
      * Only classes derived from URLStreamHandler are able
      * to use this method to set the values of the URL fields.
      *
@@ -538,7 +538,7 @@
     }
 
     /**
-     * Sets the fields of the <code>URL</code> argument to the indicated values.
+     * Sets the fields of the {@code URL} argument to the indicated values.
      * Only classes derived from URLStreamHandler are able
      * to use this method to set the values of the URL fields.
      *
--- a/jdk/src/share/classes/java/net/URLStreamHandlerFactory.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/URLStreamHandlerFactory.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,11 @@
 package java.net;
 
 /**
- * This interface defines a factory for <code>URL</code> stream
+ * This interface defines a factory for {@code URL} stream
  * protocol handlers.
  * <p>
- * It is used by the <code>URL</code> class to create a
- * <code>URLStreamHandler</code> for a specific protocol.
+ * It is used by the {@code URL} class to create a
+ * {@code URLStreamHandler} for a specific protocol.
  *
  * @author  Arthur van Hoff
  * @see     java.net.URL
@@ -39,12 +39,12 @@
  */
 public interface URLStreamHandlerFactory {
     /**
-     * Creates a new <code>URLStreamHandler</code> instance with the specified
+     * Creates a new {@code URLStreamHandler} instance with the specified
      * protocol.
      *
-     * @param   protocol   the protocol ("<code>ftp</code>",
-     *                     "<code>http</code>", "<code>nntp</code>", etc.).
-     * @return  a <code>URLStreamHandler</code> for the specific protocol.
+     * @param   protocol   the protocol ("{@code ftp}",
+     *                     "{@code http}", "{@code nntp}", etc.).
+     * @return  a {@code URLStreamHandler} for the specific protocol.
      * @see     java.net.URLStreamHandler
      */
     URLStreamHandler createURLStreamHandler(String protocol);
--- a/jdk/src/share/classes/java/net/UnknownHostException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/UnknownHostException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
     private static final long serialVersionUID = -4639126076052875403L;
 
     /**
-     * Constructs a new <code>UnknownHostException</code> with the
+     * Constructs a new {@code UnknownHostException} with the
      * specified detail message.
      *
      * @param   host   the detail message.
@@ -48,7 +48,7 @@
     }
 
     /**
-     * Constructs a new <code>UnknownHostException</code> with no detail
+     * Constructs a new {@code UnknownHostException} with no detail
      * message.
      */
     public UnknownHostException() {
--- a/jdk/src/share/classes/java/net/UnknownServiceException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/net/UnknownServiceException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,14 +40,14 @@
     private static final long serialVersionUID = -4169033248853639508L;
 
     /**
-     * Constructs a new <code>UnknownServiceException</code> with no
+     * Constructs a new {@code UnknownServiceException} with no
      * detail message.
      */
     public UnknownServiceException() {
     }
 
     /**
-     * Constructs a new <code>UnknownServiceException</code> with the
+     * Constructs a new {@code UnknownServiceException} with the
      * specified detail message.
      *
      * @param   msg   the detail message.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/java/net/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides the classes for implementing networking applications.
+ *
+ * <p> The java.net package can be roughly divided in two sections:</p>
+ * <ul>
+ *     <li><p><i>A Low Level API</i>, which deals with the
+ *               following abstractions:</p>
+ *     <ul>
+ *       <li><p><i>Addresses</i>, which are networking identifiers,
+ *              like IP addresses.</p></li>
+ *       <li><p><i>Sockets</i>, which are basic bidirectional data communication
+ *              mechanisms.</p></li>
+ *       <li><p><i>Interfaces</i>, which describe network interfaces. </p></li>
+ *     </ul></li>
+ *     <li> <p><i>A High Level API</i>, which deals with the following
+ *          abstractions:</p>
+ *     <ul>
+ *       <li><p><i>URIs</i>, which represent
+ *               Universal Resource Identifiers.</p></li>
+ *       <li><p><i>URLs</i>, which represent
+ *               Universal Resource Locators.</p></li>
+ *       <li><p><i>Connections</i>, which represents connections to the resource
+ *               pointed to by <i>URLs</i>.</p></li>
+ *       </ul></li>
+ * </ul>
+ * <h2>Addresses</h2>
+ * <p>Addresses are used throughout the java.net APIs as either host
+ *    identifiers, or socket endpoint identifiers.</p>
+ * <p>The {@link java.net.InetAddress} class is the abstraction representing an
+ *    IP (Internet Protocol) address.  It has two subclasses:
+ * <ul>
+ *       <li>{@link java.net.Inet4Address} for IPv4 addresses.</li>
+ *       <li>{@link java.net.Inet6Address} for IPv6 addresses.</li>
+ * </ul>
+ * <p>But, in most cases, there is no need to deal directly with the subclasses,
+ *    as the InetAddress abstraction should cover most of the needed
+ *    functionality.</p>
+ * <h3><b>About IPv6</b></h3>
+ * <p>Not all systems have support for the IPv6 protocol, and while the Java
+ *    networking stack will attempt to detect it and use it transparently when
+ *    available, it is also possible to disable its use with a system property.
+ *    In the case where IPv6 is not available, or explicitly disabled,
+ *    Inet6Address are not valid arguments for most networking operations any
+ *    more. While methods like {@link java.net.InetAddress#getByName} are
+ *    guaranteed not to return an Inet6Address when looking up host names, it
+ *    is possible, by passing literals, to create such an object. In which
+ *    case, most methods, when called with an Inet6Address will throw an
+ *    Exception.</p>
+ * <h2>Sockets</h2>
+ * <p>Sockets are means to establish a communication link between machines over
+ *    the network. The java.net package provides 4 kinds of Sockets:</p>
+ * <ul>
+ *       <li>{@link java.net.Socket} is a TCP client API, and will typically
+ *            be used to {@linkplain java.net.Socket#connect(SocketAddress)
+ *            connect} to a remote host.</li>
+ *       <li>{@link java.net.ServerSocket} is a TCP server API, and will
+ *            typically {@linkplain java.net.ServerSocket#accept accept}
+ *            connections from client sockets.</li>
+ *       <li>{@link java.net.DatagramSocket} is a UDP endpoint API and is used
+ *            to {@linkplain java.net.DatagramSocket#send send} and
+ *            {@linkplain java.net.DatagramSocket#receive receive}
+ *            {@linkplain java.net.DatagramPacket datagram packets}.</li>
+ *       <li>{@link java.net.MulticastSocket} is a subclass of
+ *            {@code DatagramSocket} used when dealing with multicast
+ *            groups.</li>
+ * </ul>
+ * <p>Sending and receiving with TCP sockets is done through InputStreams and
+ *    OutputStreams which can be obtained via the
+ *    {@link java.net.Socket#getInputStream} and
+ *    {@link java.net.Socket#getOutputStream} methods.</p>
+ * <h2>Interfaces</h2>
+ * <p>The {@link java.net.NetworkInterface} class provides APIs to browse and
+ *    query all the networking interfaces (e.g. ethernet connection or PPP
+ *    endpoint) of the local machine. It is through that class that you can
+ *    check if any of the local interfaces is configured to support IPv6.</p>
+ * <p>Note, all conforming implementations must support at least one
+ *    {@code NetworkInterface} object, which must either be connected to a
+ *    network, or be a "loopback" interface that can only communicate with
+ *    entities on the same machine.</p>
+ *
+ * <h2>High level API</h2>
+ * <p>A number of classes in the java.net package do provide for a much higher
+ *    level of abstraction and allow for easy access to resources on the
+ *    network. The classes are:
+ * <ul>
+ *       <li>{@link java.net.URI} is the class representing a
+ *            Universal Resource Identifier, as specified in RFC 2396.
+ *            As the name indicates, this is just an Identifier and doesn't
+ *            provide directly the means to access the resource.</li>
+ *       <li>{@link java.net.URL} is the class representing a
+ *            Universal Resource Locator, which is both an older concept for
+ *            URIs and a means to access the resources.</li>
+ *       <li>{@link java.net.URLConnection} is created from a URL and is the
+ *            communication link used to access the resource pointed by the
+ *            URL. This abstract class will delegate most of the work to the
+ *            underlying protocol handlers like http or https.</li>
+ *       <li>{@link java.net.HttpURLConnection} is a subclass of URLConnection
+ *            and provides some additional functionalities specific to the
+ *            HTTP protocol.</li>
+ * </ul>
+ * <p>The recommended usage is to use {@link java.net.URI} to identify
+ *    resources, then convert it into a {@link java.net.URL} when it is time to
+ *    access the resource. From that URL, you can either get the
+ *    {@link java.net.URLConnection} for fine control, or get directly the
+ *    InputStream.<p>
+ * <p>Here is an example:</p>
+ * <p><pre>
+ * URI uri = new URI("http://java.sun.com/");
+ * URL url = uri.toURL();
+ * InputStream in = url.openStream();
+ * </pre>
+ * <h2>Protocol Handlers</h2>
+ * As mentioned, URL and URLConnection rely on protocol handlers which must be
+ * present, otherwise an Exception is thrown. This is the major difference with
+ * URIs which only identify resources, and therefore don't need to have access
+ * to the protocol handler. So, while it is possible to create an URI with any
+ * kind of protocol scheme (e.g. {@code myproto://myhost.mydomain/resource/}),
+ * a similar URL will try to instantiate the handler for the specified protocol;
+ * if it doesn't exist an exception will be thrown.
+ * <p>By default the protocol handlers are loaded dynamically from the default
+ *    location. It is, however, possible to add to the search path by setting
+ *    the {@code java.protocol.handler.pkgs} system property. For instance if
+ *    it is set to {@code myapp.protocols}, then the URL code will try, in the
+ *    case of http, first to load {@code myapp.protocols.http.Handler}, then,
+ *    if this fails, {@code http.Handler} from the default location.<p>
+ * <p>Note that the Handler class <b>has to</b> be a subclass of the abstract
+ *    class {@link java.net.URLStreamHandler}.</p>
+ * <h2>Additional Specification</h2>
+ * <ul>
+ *       <li><a href="doc-files/net-properties.html">
+ *            Networking System Properties</a></li>
+ * </ul>
+ *
+ * @since JDK1.0
+ */
+package java.net;
--- a/jdk/src/share/classes/java/net/package.html	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-<!--
- Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
--->
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<body bgcolor="white">
-
-Provides the classes for implementing networking applications.
-
-<p> The java.net package can be roughly divided in two sections:</p>
-<ul>
-    <li> <p><i>A Low Level API</i>, which deals with the following abstractions:</p>
-    <ul>
-      <li><p><i>Addresses</i>, which are networking identifiers, like IP addresses.</p></li>
-      <li><p><i>Sockets</i>, which are basic bidirectional data communication mechanisms.</p></li>
-      <li><p><i>Interfaces</i>, which describe network interfaces. </p></li>
-    </ul></li>
-    <li> <p><i>A High Level API</i>, which deals with the following abstractions:</p>
-    <ul>
-      <li><p><i>URIs</i>, which represent Universal Resource Identifiers.</p></li>
-      <li><p><i>URLs</i>, which represent Universal Resource Locators.</p></li>
-      <li><p><i>Connections</i>, which represents connections to the resource pointed to by <i>URLs</i>.</p></li>
-      </ul></li>
-</ul>
-<h2>Addresses</h2>
-<p>Addresses are used throughout the java.net APIs as either host identifiers, or socket endpoint identifiers.</p>
-<p>The {@link java.net.InetAddress} class is the abstraction representing an IP (Internet Protocol) address.  It has two subclasses:
-<ul>
-      <li>{@link java.net.Inet4Address} for IPv4 addresses.</li>
-      <li>{@link java.net.Inet6Address} for IPv6 addresses.</li>
-</ul>
-<p>But, in most cases, there is no need to deal directly with the subclasses, as the InetAddress abstraction should cover most of the needed functionality.</p>
-<h3><b>About IPv6</b></h3>
-<p>Not all systems have support for the IPv6 protocol, and while the Java networking stack will attempt to detect it and use it transparently when available, it is also possible to disable its use with a system property. In the case where IPv6 is not available, or explicitly disabled, Inet6Address are not valid arguments for most networking operations any more. While methods like {@link java.net.InetAddress#getByName} are guaranteed not to return an Inet6Address when looking up host names, it is possible, by passing literals, to create such an object. In which case, most methods, when called with an Inet6Address will throw an Exception.</p>
-<h2>Sockets</h2>
-<p>Sockets are means to establish a communication link between machines over the network. The java.net package provides 4 kinds of Sockets:</p>
-<ul>
-      <li>{@link java.net.Socket} is a TCP client API, and will typically be used to {@linkplain java.net.Socket#connect(SocketAddress) connect} to a remote host.</li>
-      <li>{@link java.net.ServerSocket} is a TCP server API, and will typically {@linkplain java.net.ServerSocket#accept accept} connections from client sockets.</li>
-      <li>{@link java.net.DatagramSocket} is a UDP endpoint API and is used to {@linkplain java.net.DatagramSocket#send send} and {@linkplain java.net.DatagramSocket#receive receive} {@linkplain java.net.DatagramPacket datagram packets}.</li>
-      <li>{@link java.net.MulticastSocket} is a subclass of {@code DatagramSocket} used when dealing with multicast groups.</li>
-</ul>
-<p>Sending and receiving with TCP sockets is done through InputStreams and OutputStreams which can be obtained via the {@link java.net.Socket#getInputStream} and {@link java.net.Socket#getOutputStream} methods.</p>
-<h2>Interfaces</h2>
-<p>The {@link java.net.NetworkInterface} class provides APIs to browse and query all the networking interfaces (e.g. ethernet connection or PPP endpoint) of the local machine. It is through that class that you can check if any of the local interfaces is configured to support IPv6.</p>
-<p>Note, all conforming implementations must support at least one {@code NetworkInterface} object, which must either be connected to a network, or be a "loopback" interface that can only communicate with entities on the same machine.</p>
-
-<h2>High level API</h2>
-<p>A number of classes in the java.net package do provide for a much higher level of abstraction and allow for easy access to resources on the network. The classes are:
-<ul>
-      <li>{@link java.net.URI} is the class representing a Universal Resource Identifier, as specified in RFC 2396. As the name indicates, this is just an Identifier and doesn't provide directly the means to access the resource.</li>
-      <li>{@link java.net.URL} is the class representing a Universal Resource Locator, which is both an older concept for URIs and a means to access the resources.</li>
-      <li>{@link java.net.URLConnection} is created from a URL and is the communication link used to access the resource pointed by the URL. This abstract class will delegate most of the work to the underlying protocol handlers like http or https.</li>
-      <li>{@link java.net.HttpURLConnection} is a subclass of URLConnection and provides some additional functionalities specific to the HTTP protocol.</li>
-</ul>
-<p>The recommended usage is to use {@link java.net.URI} to identify resources, then convert it into a {@link java.net.URL} when it is time to access the resource. From that URL, you can either get the {@link java.net.URLConnection} for fine control, or get directly the InputStream.<p>
-<p>Here is an example:</p>
-<p><code>
-URI uri = new URI("http://java.sun.com/");<br>
-URL url = uri.toURL();<br>
-InputStream in = url.openStream();
-</code></p>
-<h2>Protocol Handlers</h2>
-As mentioned, URL and URLConnection rely on protocol handlers which must be present, otherwise an Exception is thrown. This is the major difference with URIs which only identify resources, and therefore don't need to have access to the protocol handler. So, while it is possible to create an URI with any kind of protocol scheme (e.g. <code>myproto://myhost.mydomain/resource/</code>), a similar URL will try to instantiate the handler for the specified protocol; if it doesn't exist an exception will be thrown.</p>
-<p>By default the protocol handlers are loaded dynamically from the default location. It is, however, possible to add to the search path by setting the <code>java.protocol.handler.pkgs</code> system property. For instance if it is set to <code>myapp.protocols</code>, then the URL code will try, in the case of http, first to load <code>myapp.protocols.http.Handler</code>, then, if this fails, <code>http.Handler</code> from the default location.<p>
-<p>Note that the Handler class <b>has to</b> be a subclass of the abstract class {@link java.net.URLStreamHandler}.</p>
-<h2>Additional Specification</h2>
-<ul>
-      <li><a href="doc-files/net-properties.html">Networking System Properties</a></li>
-</ul>
-<!--
-<h2>Package Specification</h2>
-
-##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
-<ul>
-  <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
-</ul>
-
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-  <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
-
--->
-
-@since JDK1.0
-</body>
-</html>
--- a/jdk/src/share/classes/java/nio/channels/package-info.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/channels/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@
  * <a name="channels"></a>
  *
  * <blockquote><table cellspacing=1 cellpadding=0 summary="Lists channels and their descriptions">
- * <tr><th><p align="left">Channels</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">Channels</th><th align="left">Description</th></tr>
  * <tr><td valign=top><tt><i>{@link java.nio.channels.Channel}</i></tt></td>
  *     <td>A nexus for I/O operations</td></tr>
  * <tr><td valign=top><tt>&nbsp;&nbsp;<i>{@link java.nio.channels.ReadableByteChannel}</i></tt></td>
@@ -110,7 +110,7 @@
  * write them to a given writable byte channel.
  *
  * <blockquote><table cellspacing=1 cellpadding=0 summary="Lists file channels and their descriptions">
- * <tr><th><p align="left">File channels</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">File channels</th><th align="left">Description</th></tr>
  * <tr><td valign=top><tt>{@link java.nio.channels.FileChannel}</tt></td>
  *     <td>Reads, writes, maps, and manipulates files</td></tr>
  * <tr><td valign=top><tt>{@link java.nio.channels.FileLock}</tt></td>
@@ -138,7 +138,7 @@
  *
  * <a name="multiplex"></a>
  * <blockquote><table cellspacing=1 cellpadding=0 summary="Lists multiplexed, non-blocking channels and their descriptions">
- * <tr><th><p align="left">Multiplexed, non-blocking I/O</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">Multiplexed, non-blocking I/O</th><th align="left"><p>Description</th></tr>
  * <tr><td valign=top><tt>{@link java.nio.channels.SelectableChannel}</tt></td>
  *     <td>A channel that can be multiplexed</td></tr>
  * <tr><td valign=top><tt>&nbsp;&nbsp;{@link java.nio.channels.DatagramChannel}</tt></td>
@@ -225,7 +225,7 @@
  * <a name="async"></a>
  *
  * <blockquote><table cellspacing=1 cellpadding=0 summary="Lists asynchronous channels and their descriptions">
- * <tr><th><p align="left">Asynchronous I/O</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">Asynchronous I/O</th><th align="left">Description</th></tr>
  * <tr><td valign=top><tt>{@link java.nio.channels.AsynchronousFileChannel}</tt></td>
  *     <td>An asynchronous channel for reading, writing, and manipulating a file</td></tr>
  * <tr><td valign=top><tt>{@link java.nio.channels.AsynchronousSocketChannel}</tt></td>
--- a/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/charset/Charset-X-Coder.java.template	Tue Aug 06 16:54:56 2013 -0700
@@ -41,7 +41,7 @@
  * An engine that can transform a sequence of $itypesPhrase$ into a sequence of
  * $otypesPhrase$.
  *
- * <a name="steps">
+ * <a name="steps"></a>
  *
  * <p> The input $itype$ sequence is provided in a $itype$ buffer or a series
  * of such buffers.  The output $otype$ sequence is written to a $otype$ buffer
@@ -76,22 +76,22 @@
  * examine this object and fill the input buffer, flush the output buffer, or
  * attempt to recover from $a$ $coding$ error, as appropriate, and try again.
  *
- * <a name="ce">
+ * <a name="ce"></a>
  *
  * <p> There are two general types of $coding$ errors.  If the input $itype$
  * sequence is $notLegal$ then the input is considered <i>malformed</i>.  If
  * the input $itype$ sequence is legal but cannot be mapped to a valid
  * $outSequence$ then an <i>unmappable character</i> has been encountered.
  *
- * <a name="cae">
+ * <a name="cae"></a>
  *
  * <p> How $a$ $coding$ error is handled depends upon the action requested for
  * that type of error, which is described by an instance of the {@link
- * CodingErrorAction} class.  The possible error actions are to {@link
- * CodingErrorAction#IGNORE </code>ignore<code>} the erroneous input, {@link
- * CodingErrorAction#REPORT </code>report<code>} the error to the invoker via
- * the returned {@link CoderResult} object, or {@link CodingErrorAction#REPLACE
- * </code>replace<code>} the erroneous input with the current value of the
+ * CodingErrorAction} class.  The possible error actions are to {@linkplain
+ * CodingErrorAction#IGNORE ignore} the erroneous input, {@linkplain
+ * CodingErrorAction#REPORT report} the error to the invoker via
+ * the returned {@link CoderResult} object, or {@linkplain CodingErrorAction#REPLACE
+ * replace} the erroneous input with the current value of the
  * replacement $replTypeName$.  The replacement
  *
 #if[encoder]
@@ -106,7 +106,7 @@
  * replaceWith} method.
  *
  * <p> The default action for malformed-input and unmappable-character errors
- * is to {@link CodingErrorAction#REPORT </code>report<code>} them.  The
+ * is to {@linkplain CodingErrorAction#REPORT report} them.  The
  * malformed-input error action may be changed via the {@link
  * #onMalformedInput(CodingErrorAction) onMalformedInput} method; the
  * unmappable-character action may be changed via the {@link
@@ -177,7 +177,7 @@
      * @param  replacement
      *         The initial replacement; must not be <tt>null</tt>, must have
      *         non-zero length, must not be longer than max$ItypesPerOtype$,
-     *         and must be {@link #isLegalReplacement </code>legal<code>}
+     *         and must be {@linkplain #isLegalReplacement legal}
      *
      * @throws  IllegalArgumentException
      *          If the preconditions on the parameters do not hold
@@ -276,7 +276,7 @@
      *         The new replacement; must not be <tt>null</tt>, must have
      *         non-zero length, must not be longer than the value returned by
      *         the {@link #max$ItypesPerOtype$() max$ItypesPerOtype$} method, and
-     *         must be {@link #isLegalReplacement </code>legal<code>}
+     *         must be {@link #isLegalReplacement legal}
 #end[encoder]
      *
      * @return  This $coder$
@@ -495,24 +495,24 @@
      *   typically done by draining any $code$d $otype$s from the output
      *   buffer.  </p></li>
      *
-     *   <li><p> A {@link CoderResult#malformedForLength
-     *   </code>malformed-input<code>} result indicates that a malformed-input
+     *   <li><p> A {@linkplain CoderResult#malformedForLength
+     *   malformed-input} result indicates that a malformed-input
      *   error has been detected.  The malformed $itype$s begin at the input
      *   buffer's (possibly incremented) position; the number of malformed
      *   $itype$s may be determined by invoking the result object's {@link
      *   CoderResult#length() length} method.  This case applies only if the
-     *   {@link #onMalformedInput </code>malformed action<code>} of this $coder$
+     *   {@linkplain #onMalformedInput malformed action} of this $coder$
      *   is {@link CodingErrorAction#REPORT}; otherwise the malformed input
      *   will be ignored or replaced, as requested.  </p></li>
      *
-     *   <li><p> An {@link CoderResult#unmappableForLength
-     *   </code>unmappable-character<code>} result indicates that an
+     *   <li><p> An {@linkplain CoderResult#unmappableForLength
+     *   unmappable-character} result indicates that an
      *   unmappable-character error has been detected.  The $itype$s that
      *   $code$ the unmappable character begin at the input buffer's (possibly
      *   incremented) position; the number of such $itype$s may be determined
      *   by invoking the result object's {@link CoderResult#length() length}
-     *   method.  This case applies only if the {@link #onUnmappableCharacter
-     *   </code>unmappable action<code>} of this $coder$ is {@link
+     *   method.  This case applies only if the {@linkplain #onUnmappableCharacter
+     *   unmappable action} of this $coder$ is {@link
      *   CodingErrorAction#REPORT}; otherwise the unmappable character will be
      *   ignored or replaced, as requested.  </p></li>
      *
--- a/jdk/src/share/classes/java/nio/charset/Charset.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/charset/Charset.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,7 +65,7 @@
  * concurrent threads.
  *
  *
- * <a name="names"><a name="charenc">
+ * <a name="names"></a><a name="charenc"></a>
  * <h2>Charset names</h2>
  *
  * <p> Charsets are named by strings composed of the following characters:
@@ -111,21 +111,17 @@
  * The aliases of a charset are returned by the {@link #aliases() aliases}
  * method.
  *
- * <a name="hn">
- *
- * <p> Some charsets have an <i>historical name</i> that is defined for
- * compatibility with previous versions of the Java platform.  A charset's
+ * <p><a name="hn">Some charsets have an <i>historical name</i> that is defined for
+ * compatibility with previous versions of the Java platform.</a>  A charset's
  * historical name is either its canonical name or one of its aliases.  The
  * historical name is returned by the <tt>getEncoding()</tt> methods of the
  * {@link java.io.InputStreamReader#getEncoding InputStreamReader} and {@link
  * java.io.OutputStreamWriter#getEncoding OutputStreamWriter} classes.
  *
- * <a name="iana">
- *
- * <p> If a charset listed in the <a
+ * <p><a name="iana">If a charset listed in the <a
  * href="http://www.iana.org/assignments/character-sets"><i>IANA Charset
  * Registry</i></a> is supported by an implementation of the Java platform then
- * its canonical name must be the name listed in the registry.  Many charsets
+ * its canonical name must be the name listed in the registry.</a>  Many charsets
  * are given more than one name in the registry, in which case the registry
  * identifies one of the names as <i>MIME-preferred</i>.  If a charset has more
  * than one registry name then its canonical name must be the MIME-preferred
@@ -142,15 +138,15 @@
  *
  * <h2>Standard charsets</h2>
  *
- * <a name="standard">
+ *
  *
- * <p> Every implementation of the Java platform is required to support the
- * following standard charsets.  Consult the release documentation for your
+ * <p><a name="standard">Every implementation of the Java platform is required to support the
+ * following standard charsets.</a>  Consult the release documentation for your
  * implementation to see if any other charsets are supported.  The behavior
  * of such optional charsets may differ between implementations.
  *
  * <blockquote><table width="80%" summary="Description of standard charsets">
- * <tr><th><p align="left">Charset</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">Charset</th><th align="left">Description</th></tr>
  * <tr><td valign=top><tt>US-ASCII</tt></td>
  *     <td>Seven-bit ASCII, a.k.a. <tt>ISO646-US</tt>,
  *         a.k.a. the Basic Latin block of the Unicode character set</td></tr>
--- a/jdk/src/share/classes/java/nio/charset/MalformedInputException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/charset/MalformedInputException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,14 +42,27 @@
 
     private int inputLength;
 
+    /**
+     * Constructs an {@code MalformedInputException} with the given
+     * length.
+     * @param inputLength the length of the input
+     */
     public MalformedInputException(int inputLength) {
         this.inputLength = inputLength;
     }
 
+    /**
+     * Returns the length of the input.
+     * @return the length of the input
+     */
     public int getInputLength() {
         return inputLength;
     }
 
+    /**
+     * Returns the message.
+     * @return the message
+     */
     public String getMessage() {
         return "Input length = " + inputLength;
     }
--- a/jdk/src/share/classes/java/nio/charset/UnmappableCharacterException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/charset/UnmappableCharacterException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,14 +42,27 @@
 
     private int inputLength;
 
+    /**
+     * Constructs an {@code UnmappableCharacterException} with the
+     * given length.
+     * @param inputLength the length of the input
+     */
     public UnmappableCharacterException(int inputLength) {
         this.inputLength = inputLength;
     }
 
+    /**
+     * Returns the length of the input.
+     * @return the length of the input
+     */
     public int getInputLength() {
         return inputLength;
     }
 
+    /**
+     * Returns the message.
+     * @return the message
+     */
     public String getMessage() {
         return "Input length = " + inputLength;
     }
--- a/jdk/src/share/classes/java/nio/file/attribute/package-info.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/file/attribute/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * Interfaces and classes providing access to file and file system attributes.
  *
  * <blockquote><table cellspacing=1 cellpadding=0 summary="Attribute views">
- * <tr><th><p align="left">Attribute views</p></th><th><p align="left">Description</p></th></tr>
+ * <tr><th align="left">Attribute views</th><th align="left">Description</th></tr>
  * <tr><td valign=top><tt><i>{@link java.nio.file.attribute.AttributeView}</i></tt></td>
  *     <td>Can read or update non-opaque values associated with objects in a file system</td></tr>
  * <tr><td valign=top><tt>&nbsp;&nbsp;<i>{@link java.nio.file.attribute.FileAttributeView}</i></tt></td>
@@ -38,7 +38,7 @@
  *     <td>Can read or update POSIX defined file attributes</td></tr>
  * <tr><td valign=top><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>{@link java.nio.file.attribute.DosFileAttributeView}&nbsp;&nbsp;</i></tt></td>
  *     <td>Can read or update FAT file attributes</td></tr>
- * <tr><td valign=top><tt>&nbsp;&nbsp;&nbsp;&nbsp<i>{@link java.nio.file.attribute.FileOwnerAttributeView}&nbsp;&nbsp;</i></tt></td>
+ * <tr><td valign=top><tt>&nbsp;&nbsp;&nbsp;&nbsp;<i>{@link java.nio.file.attribute.FileOwnerAttributeView}&nbsp;&nbsp;</i></tt></td>
  *     <td>Can read or update the owner of a file</td></tr>
  * <tr><td valign=top><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>{@link java.nio.file.attribute.AclFileAttributeView}&nbsp;&nbsp;</i></tt></td>
  *     <td>Can read or update Access Control Lists</td></tr>
@@ -86,14 +86,14 @@
  *
  * <ul>
  *
- *   <p><li> The {@link java.nio.file.attribute.UserPrincipal} and
+ *   <li> The {@link java.nio.file.attribute.UserPrincipal} and
  *   {@link java.nio.file.attribute.GroupPrincipal} interfaces represent an
  *   identity or group identity. </li>
  *
- *   <p><li> The {@link java.nio.file.attribute.UserPrincipalLookupService}
+ *   <li> The {@link java.nio.file.attribute.UserPrincipalLookupService}
  *   interface defines methods to lookup user or group principals. </li>
  *
- *   <p><li> The {@link java.nio.file.attribute.FileAttribute} interface
+ *   <li> The {@link java.nio.file.attribute.FileAttribute} interface
  *   represents the value of an attribute for cases where the attribute value is
  *   required to be set atomically when creating an object in the file system. </li>
  *
--- a/jdk/src/share/classes/java/nio/file/package-info.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/nio/file/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,8 +33,8 @@
  * package is used by service provider implementors wishing to extend the
  * platform default provider, or to construct other provider implementations. </p>
  *
- * <a name="links"><h3>Symbolic Links</h3></a>
- * Many operating systems and file systems support for <em>symbolic links</em>.
+ * <h3><a name="links">Symbolic Links</a></h3>
+ * <p> Many operating systems and file systems support for <em>symbolic links</em>.
  * A symbolic link is a special file that serves as a reference to another file.
  * For the most part, symbolic links are transparent to applications and
  * operations on symbolic links are automatically redirected to the <em>target</em>
@@ -45,8 +45,8 @@
  * that are semantically close but support for these other types of links is
  * not included in this package. </p>
  *
- * <a name="interop"><h3>Interoperability</h3></a>
- * The {@link java.io.File} class defines the {@link java.io.File#toPath
+ * <h3><a name="interop">Interoperability</a></h3>
+ * <p> The {@link java.io.File} class defines the {@link java.io.File#toPath
  * toPath} method to construct a {@link java.nio.file.Path} by converting
  * the abstract path represented by the {@code java.io.File} object. The resulting
  * {@code Path} can be used to operate on the same file as the {@code File}
@@ -55,7 +55,7 @@
  * and {@code java.io.File} objects. </p>
  *
  * <h3>Visibility</h3>
- * The view of the files and file system provided by classes in this package are
+ * <p> The view of the files and file system provided by classes in this package are
  * guaranteed to be consistent with other views provided by other instances in the
  * same Java virtual machine.  The view may or may not, however, be consistent with
  * the view of the file system as seen by other concurrently running programs due
@@ -65,8 +65,8 @@
  * or on some other machine.  The exact nature of any such inconsistencies are
  * system-dependent and are therefore unspecified. </p>
  *
- * <a name="integrity"><h3>Synchronized I/O File Integrity</h3></a>
- * The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link
+ * <h3><a name="integrity">Synchronized I/O File Integrity</a></h3>
+ * <p> The {@link java.nio.file.StandardOpenOption#SYNC SYNC} and {@link
  * java.nio.file.StandardOpenOption#DSYNC DSYNC} options are used when opening a file
  * to require that updates to the file are written synchronously to the underlying
  * storage device. In the case of the default provider, and the file resides on
@@ -83,7 +83,7 @@
  * specific. </p>
  *
  * <h3>General Exceptions</h3>
- * Unless otherwise noted, passing a {@code null} argument to a constructor
+ * <p> Unless otherwise noted, passing a {@code null} argument to a constructor
  * or method of any class or interface in this package will cause a {@link
  * java.lang.NullPointerException NullPointerException} to be thrown. Additionally,
  * invoking a method with a collection containing a {@code null} element will
--- a/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/security/cert/PKIXRevocationChecker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,21 +50,26 @@
  * status of certificates with OCSP and CRLs. By default, OCSP is the
  * preferred mechanism for checking revocation status, with CRLs as the
  * fallback mechanism. However, this preference can be switched to CRLs with
- * the {@link Option#PREFER_CRLS PREFER_CRLS} option.
+ * the {@link Option#PREFER_CRLS PREFER_CRLS} option. In addition, the fallback
+ * mechanism can be disabled with the {@link Option#NO_FALLBACK NO_FALLBACK}
+ * option.
  *
  * <p>A {@code PKIXRevocationChecker} is obtained by calling the
  * {@link CertPathValidator#getRevocationChecker getRevocationChecker} method
  * of a PKIX {@code CertPathValidator}. Additional parameters and options
- * specific to revocation can be set (by calling {@link #setOCSPResponder}
- * method for instance). The {@code PKIXRevocationChecker} is added to
- * a {@code PKIXParameters} object using the
- * {@link PKIXParameters#addCertPathChecker addCertPathChecker}
+ * specific to revocation can be set (by calling the
+ * {@link #setOcspResponder setOcspResponder} method for instance). The
+ * {@code PKIXRevocationChecker} is added to a {@code PKIXParameters} object
+ * using the {@link PKIXParameters#addCertPathChecker addCertPathChecker}
  * or {@link PKIXParameters#setCertPathCheckers setCertPathCheckers} method,
  * and then the {@code PKIXParameters} is passed along with the {@code CertPath}
  * to be validated to the {@link CertPathValidator#validate validate} method
  * of a PKIX {@code CertPathValidator}. When supplying a revocation checker in
  * this manner, it will be used to check revocation irrespective of the setting
  * of the {@link PKIXParameters#isRevocationEnabled RevocationEnabled} flag.
+ * Similarly, a {@code PKIXRevocationChecker} may be added to a
+ * {@code PKIXBuilderParameters} object for use with a PKIX
+ * {@code CertPathBuilder}.
  *
  * <p>Note that when a {@code PKIXRevocationChecker} is added to
  * {@code PKIXParameters}, it clones the {@code PKIXRevocationChecker};
@@ -83,6 +88,13 @@
  * need not synchronize.
  *
  * @since 1.8
+ *
+ * @see <a href="http://www.ietf.org/rfc/rfc2560.txt"><i>RFC&nbsp;2560: X.509
+ * Internet Public Key Infrastructure Online Certificate Status Protocol -
+ * OCSP</i></a>, <br><a
+ * href="http://www.ietf.org/rfc/rfc5280.txt"><i>RFC&nbsp;5280: Internet X.509
+ * Public Key Infrastructure Certificate and Certificate Revocation List (CRL)
+ * Profile</i></a>
  */
 public abstract class PKIXRevocationChecker extends PKIXCertPathChecker {
     private URI ocspResponder;
@@ -101,7 +113,7 @@
      *
      * @param uri the responder URI
      */
-    public void setOCSPResponder(URI uri) {
+    public void setOcspResponder(URI uri) {
         this.ocspResponder = uri;
     }
 
@@ -114,7 +126,7 @@
      *
      * @return the responder URI, or {@code null} if not set
      */
-    public URI getOCSPResponder() {
+    public URI getOcspResponder() {
         return ocspResponder;
     }
 
@@ -126,7 +138,7 @@
      *
      * @param cert the responder's certificate
      */
-    public void setOCSPResponderCert(X509Certificate cert) {
+    public void setOcspResponderCert(X509Certificate cert) {
         this.ocspResponderCert = cert;
     }
 
@@ -140,7 +152,7 @@
      *
      * @return the responder's certificate, or {@code null} if not set
      */
-    public X509Certificate getOCSPResponderCert() {
+    public X509Certificate getOcspResponderCert() {
         return ocspResponderCert;
     }
 
@@ -151,7 +163,7 @@
      * @param extensions a list of extensions. The list is copied to protect
      *        against subsequent modification.
      */
-    public void setOCSPExtensions(List<Extension> extensions)
+    public void setOcspExtensions(List<Extension> extensions)
     {
         this.ocspExtensions = (extensions == null)
                               ? Collections.<Extension>emptyList()
@@ -161,10 +173,10 @@
     /**
      * Gets the optional OCSP request extensions.
      *
-     * @return an unmodifiable list of extensions. Returns an empty list if no
+     * @return an unmodifiable list of extensions. The list is empty if no
      *         extensions have been specified.
      */
-    public List<Extension> getOCSPExtensions() {
+    public List<Extension> getOcspExtensions() {
         return Collections.unmodifiableList(ocspExtensions);
     }
 
@@ -177,7 +189,7 @@
      *        DER-encoded OCSP response for that certificate. A deep copy of
      *        the map is performed to protect against subsequent modification.
      */
-    public void setOCSPResponses(Map<X509Certificate, byte[]> responses)
+    public void setOcspResponses(Map<X509Certificate, byte[]> responses)
     {
         if (responses == null) {
             this.ocspResponses = Collections.<X509Certificate, byte[]>emptyMap();
@@ -200,7 +212,7 @@
      *        the map is returned to protect against subsequent modification.
      *        Returns an empty map if no responses have been specified.
      */
-    public Map<X509Certificate, byte[]> getOCSPResponses() {
+    public Map<X509Certificate, byte[]> getOcspResponses() {
         Map<X509Certificate, byte[]> copy = new HashMap<>(ocspResponses.size());
         for (Map.Entry<X509Certificate, byte[]> e : ocspResponses.entrySet()) {
             copy.put(e.getKey(), e.getValue().clone());
@@ -223,15 +235,31 @@
     /**
      * Gets the revocation options.
      *
-     * @return an unmodifiable set of revocation options, or an empty set if
-     *         none are specified
+     * @return an unmodifiable set of revocation options. The set is empty if
+     *         no options have been specified.
      */
     public Set<Option> getOptions() {
         return Collections.unmodifiableSet(options);
     }
 
+    /**
+     * Returns a list containing the exceptions that are ignored by the
+     * revocation checker when the {@link Option#SOFT_FAIL SOFT_FAIL} option
+     * is set. The list is cleared each time {@link #init init} is called.
+     * The list is ordered in ascending order according to the certificate
+     * index returned by {@link CertPathValidatorException#getIndex getIndex}
+     * method of each entry.
+     * <p>
+     * An implementation of {@code PKIXRevocationChecker} is responsible for
+     * adding the ignored exceptions to the list.
+     *
+     * @return an unmodifiable list containing the ignored exceptions. The list
+     *         is empty if no exceptions have been ignored.
+     */
+    public abstract List<CertPathValidatorException> getSoftFailExceptions();
+
     @Override
-    public Object clone() {
+    public PKIXRevocationChecker clone() {
         PKIXRevocationChecker copy = (PKIXRevocationChecker)super.clone();
         copy.ocspExtensions = new ArrayList<>(ocspExtensions);
         copy.ocspResponses = new HashMap<>(ocspResponses);
@@ -262,9 +290,26 @@
          */
         PREFER_CRLS,
         /**
-         * Ignore network failures. The default behavior is to consider it a
-         * failure if the revocation status of a certificate cannot be obtained
-         * due to a network error. This option applies to both OCSP and CRLs.
+         * Disable the fallback mechanism.
+         */
+        NO_FALLBACK,
+        /**
+         * Allow revocation check to succeed if the revocation status cannot be
+         * determined for one of the following reasons:
+         * <p><ul>
+         *  <li>The CRL or OCSP response cannot be obtained because of a
+         *      network error.
+         *  <li>The OCSP responder returns one of the following errors
+         *      specified in section 2.3 of RFC 2560: internalError, tryLater,
+         *      or unauthorized.
+         * </ul><br>
+         * Note that these conditions apply to both OCSP and CRLs, and unless
+         * the {@code NO_FALLBACK} option is set, the revocation check is
+         * allowed to succeed only if both mechanisms fail under one of the
+         * conditions as stated above.
+         * Exceptions that cause the network errors are ignored but can be
+         * later retrieved by calling the
+         * {@link #getSoftFailExceptions getSoftFailExceptions} method.
          */
         SOFT_FAIL
     }
--- a/jdk/src/share/classes/java/text/Annotation.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/Annotation.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,8 @@
     /**
      * Constructs an annotation record with the given value, which
      * may be null.
-     * @param value The value of the attribute
+     *
+     * @param value the value of the attribute
      */
     public Annotation(Object value) {
         this.value = value;
@@ -67,6 +68,8 @@
 
     /**
      * Returns the value of the attribute, which may be null.
+     *
+     * @return the value of the attribute
      */
     public Object getValue() {
         return value;
@@ -74,6 +77,8 @@
 
     /**
      * Returns the String representation of this Annotation.
+     *
+     * @return the {@code String} representation of this {@code Annotation}
      */
     public String toString() {
         return getClass().getName() + "[value=" + value + "]";
--- a/jdk/src/share/classes/java/text/AttributedCharacterIterator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/AttributedCharacterIterator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -101,6 +101,8 @@
 
         /**
          * Constructs an {@code Attribute} with the given name.
+         *
+         * @param name the name of {@code Attribute}
          */
         protected Attribute(String name) {
             this.name = name;
@@ -111,7 +113,7 @@
 
         /**
          * Compares two objects for equality. This version only returns true
-         * for <code>x.equals(y)</code> if <code>x</code> and <code>y</code> refer
+         * for {@code x.equals(y)} if {@code x} and {@code y} refer
          * to the same object, and guarantees this for all subclasses.
          */
         public final boolean equals(Object obj) {
@@ -137,6 +139,8 @@
 
         /**
          * Returns the name of the attribute.
+         *
+         * @return the name of {@code Attribute}
          */
         protected String getName() {
             return name;
@@ -144,6 +148,10 @@
 
         /**
          * Resolves instances being deserialized to the predefined constants.
+         *
+         * @return the resolved {@code Attribute} object
+         * @throws InvalidObjectException if the object to resolve is not
+         *                                an instance of {@code Attribute}
          */
         protected Object readResolve() throws InvalidObjectException {
             if (this.getClass() != Attribute.class) {
@@ -171,6 +179,7 @@
          * it is often necessary to store the reading (pronunciation) along with the
          * written form.
          * <p>Values are instances of {@link Annotation} holding instances of {@link String}.
+         *
          * @see Annotation
          * @see java.lang.String
          */
@@ -196,18 +205,26 @@
      * <p>Any contiguous text segments having the same attributes (the
      * same set of attribute/value pairs) are treated as separate runs
      * if the attributes have been given to those text segments separately.
+     *
+     * @return the index of the first character of the run
      */
     public int getRunStart();
 
     /**
      * Returns the index of the first character of the run
      * with respect to the given {@code attribute} containing the current character.
+     *
+     * @param attribute the desired attribute.
+     * @return the index of the first character of the run
      */
     public int getRunStart(Attribute attribute);
 
     /**
      * Returns the index of the first character of the run
      * with respect to the given {@code attributes} containing the current character.
+     *
+     * @param attributes a set of the desired attributes.
+     * @return the index of the first character of the run
      */
     public int getRunStart(Set<? extends Attribute> attributes);
 
@@ -218,30 +235,43 @@
      * <p>Any contiguous text segments having the same attributes (the
      * same set of attribute/value pairs) are treated as separate runs
      * if the attributes have been given to those text segments separately.
+     *
+     * @return the index of the first character following the run
      */
     public int getRunLimit();
 
     /**
      * Returns the index of the first character following the run
      * with respect to the given {@code attribute} containing the current character.
+     *
+     * @param attribute the desired attribute
+     * @return the index of the first character following the run
      */
     public int getRunLimit(Attribute attribute);
 
     /**
      * Returns the index of the first character following the run
      * with respect to the given {@code attributes} containing the current character.
+     *
+     * @param attributes a set of the desired attributes
+     * @return the index of the first character following the run
      */
     public int getRunLimit(Set<? extends Attribute> attributes);
 
     /**
      * Returns a map with the attributes defined on the current
      * character.
+     *
+     * @return a map with the attributes defined on the current character
      */
     public Map<Attribute,Object> getAttributes();
 
     /**
      * Returns the value of the named {@code attribute} for the current character.
      * Returns {@code null} if the {@code attribute} is not defined.
+     *
+     * @param attribute the desired attribute
+     * @return the value of the named {@code attribute} or {@code null}
      */
     public Object getAttribute(Attribute attribute);
 
@@ -249,6 +279,8 @@
      * Returns the keys of all attributes defined on the
      * iterator's text range. The set is empty if no
      * attributes are defined.
+     *
+     * @return the keys of all attributes
      */
     public Set<Attribute> getAllAttributeKeys();
 };
--- a/jdk/src/share/classes/java/text/Bidi.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/Bidi.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -176,8 +176,10 @@
      * Create a Bidi object representing the bidi information on a line of text within
      * the paragraph represented by the current Bidi.  This call is not required if the
      * entire paragraph fits on one line.
+     *
      * @param lineStart the offset from the start of the paragraph to the start of the line.
      * @param lineLimit the offset from the start of the paragraph to the limit of the line.
+     * @return a {@code Bidi} object
      */
     public Bidi createLineBidi(int lineStart, int lineLimit) {
         AttributedString astr = new AttributedString("");
@@ -189,6 +191,7 @@
     /**
      * Return true if the line is not left-to-right or right-to-left.  This means it either has mixed runs of left-to-right
      * and right-to-left text, or the base direction differs from the direction of the only run of text.
+     *
      * @return true if the line is not left-to-right or right-to-left.
      */
     public boolean isMixed() {
@@ -197,6 +200,7 @@
 
     /**
      * Return true if the line is all left-to-right text and the base direction is left-to-right.
+     *
      * @return true if the line is all left-to-right text and the base direction is left-to-right
      */
     public boolean isLeftToRight() {
@@ -236,8 +240,10 @@
     }
 
     /**
-     * Return the resolved level of the character at offset.  If offset is <0 or >=
-     * the length of the line, return the base direction level.
+     * Return the resolved level of the character at offset.  If offset is
+     * {@literal <} 0 or &ge; the length of the line, return the base direction
+     * level.
+     *
      * @param offset the index of the character for which to return the level
      * @return the resolved level of the character at offset
      */
--- a/jdk/src/share/classes/java/text/BreakIterator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/BreakIterator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -191,7 +191,7 @@
  *
  * Find the next word:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * public static int nextWordStartAfter(int pos, String text) {
  *     BreakIterator wb = BreakIterator.getWordInstance();
  *     wb.setText(text);
@@ -207,7 +207,7 @@
  *     }
  *     return BreakIterator.DONE;
  * }
- * </pre>
+ * }</pre>
  * (The iterator returned by BreakIterator.getWordInstance() is unique in that
  * the break positions it returns don't represent both the start and end of the
  * thing being iterated over.  That is, a sentence-break iterator returns breaks
--- a/jdk/src/share/classes/java/text/ChoiceFormat.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/ChoiceFormat.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,7 @@
  * specifies a half-open interval up to the next item:
  * <blockquote>
  * <pre>
- * X matches j if and only if limit[j] &lt;= X &lt; limit[j+1]
+ * X matches j if and only if limit[j] &le; X &lt; limit[j+1]
  * </pre>
  * </blockquote>
  * If there is no match, then either the first or last index is used, depending
@@ -85,21 +85,21 @@
  * <p>
  * Here is a simple example that shows formatting and parsing:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * double[] limits = {1,2,3,4,5,6,7};
  * String[] dayOfWeekNames = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
  * ChoiceFormat form = new ChoiceFormat(limits, dayOfWeekNames);
  * ParsePosition status = new ParsePosition(0);
- * for (double i = 0.0; i &lt;= 8.0; ++i) {
+ * for (double i = 0.0; i <= 8.0; ++i) {
  *     status.setIndex(0);
- *     System.out.println(i + " -&gt; " + form.format(i) + " -&gt; "
+ *     System.out.println(i + " -> " + form.format(i) + " -> "
  *                              + form.parse(form.format(i),status));
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * Here is a more complex example, with a pattern format:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * double[] filelimits = {0,1,2};
  * String[] filepart = {"are no files","is one file","are {2} files"};
  * ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
@@ -107,20 +107,20 @@
  * MessageFormat pattform = new MessageFormat("There {0} on {1}");
  * pattform.setFormats(testFormats);
  * Object[] testArgs = {null, "ADisk", null};
- * for (int i = 0; i &lt; 4; ++i) {
+ * for (int i = 0; i < 4; ++i) {
  *     testArgs[0] = new Integer(i);
  *     testArgs[2] = testArgs[0];
  *     System.out.println(pattform.format(testArgs));
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * <p>
  * Specifying a pattern for ChoiceFormat objects is fairly straightforward.
  * For example:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * ChoiceFormat fmt = new ChoiceFormat(
- *      "-1#is negative| 0#is zero or fraction | 1#is one |1.0&lt;is 1+ |2#is two |2&lt;is more than 2.");
+ *      "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+ |2#is two |2<is more than 2.");
  * System.out.println("Formatter Pattern : " + fmt.toPattern());
  *
  * System.out.println("Format with -INF : " + fmt.format(Double.NEGATIVE_INFINITY));
@@ -133,25 +133,25 @@
  * System.out.println("Format with 2.1 : " + fmt.format(2.1));
  * System.out.println("Format with NaN : " + fmt.format(Double.NaN));
  * System.out.println("Format with +INF : " + fmt.format(Double.POSITIVE_INFINITY));
- * </pre>
+ * }</pre>
  * </blockquote>
  * And the output result would be like the following:
  * <blockquote>
- * <pre>
- *   Format with -INF : is negative
- *   Format with -1.0 : is negative
- *   Format with 0 : is zero or fraction
- *   Format with 0.9 : is zero or fraction
- *   Format with 1.0 : is one
- *   Format with 1.5 : is 1+
- *   Format with 2 : is two
- *   Format with 2.1 : is more than 2.
- *   Format with NaN : is negative
- *   Format with +INF : is more than 2.
- * </pre>
+ * <pre>{@code
+ * Format with -INF : is negative
+ * Format with -1.0 : is negative
+ * Format with 0 : is zero or fraction
+ * Format with 0.9 : is zero or fraction
+ * Format with 1.0 : is one
+ * Format with 1.5 : is 1+
+ * Format with 2 : is two
+ * Format with 2.1 : is more than 2.
+ * Format with NaN : is negative
+ * Format with +INF : is more than 2.
+ * }</pre>
  * </blockquote>
  *
- * <h4><a name="synchronization">Synchronization</a></h4>
+ * <h3><a name="synchronization">Synchronization</a></h3>
  *
  * <p>
  * Choice formats are not synchronized.
@@ -255,6 +255,8 @@
 
     /**
      * Gets the pattern.
+     *
+     * @return the pattern string
      */
     public String toPattern() {
         StringBuffer result = new StringBuffer();
@@ -305,6 +307,8 @@
 
     /**
      * Constructs with limits and corresponding formats based on the pattern.
+     *
+     * @param newPattern the new pattern string
      * @see #applyPattern
      */
     public ChoiceFormat(String newPattern)  {
@@ -313,6 +317,9 @@
 
     /**
      * Constructs with the limits and the corresponding formats.
+     *
+     * @param limits limits in ascending order
+     * @param formats corresponding format strings
      * @see #setChoices
      */
     public ChoiceFormat(double[] limits, String[] formats) {
@@ -322,9 +329,9 @@
     /**
      * Set the choices to be used in formatting.
      * @param limits contains the top value that you want
-     * parsed with that format,and should be in ascending sorted order. When
+     * parsed with that format, and should be in ascending sorted order. When
      * formatting X, the choice will be the i, where
-     * limit[i] &lt;= X &lt; limit[i+1].
+     * limit[i] &le; X {@literal <} limit[i+1].
      * If the limit array is not in ascending order, the results of formatting
      * will be incorrect.
      * @param formats are the formats you want to use for each limit.
@@ -434,9 +441,12 @@
     }
 
     /**
-     * Finds the least double greater than d.
-     * If NaN, returns same value.
+     * Finds the least double greater than {@code d}.
+     * If {@code NaN}, returns same value.
      * <p>Used to make half-open intervals.
+     *
+     * @param d the reference value
+     * @return the least double value greather than {@code d}
      * @see #previousDouble
      */
     public static final double nextDouble (double d) {
@@ -444,8 +454,11 @@
     }
 
     /**
-     * Finds the greatest double less than d.
-     * If NaN, returns same value.
+     * Finds the greatest double less than {@code d}.
+     * If {@code NaN}, returns same value.
+     *
+     * @param d the reference value
+     * @return the greatest double value less than {@code d}
      * @see #nextDouble
      */
     public static final double previousDouble (double d) {
@@ -553,15 +566,21 @@
     static final long POSITIVEINFINITY    = 0x7FF0000000000000L;
 
     /**
-     * Finds the least double greater than d (if positive == true),
-     * or the greatest double less than d (if positive == false).
-     * If NaN, returns same value.
+     * Finds the least double greater than {@code d} (if {@code positive} is
+     * {@code true}), or the greatest double less than {@code d} (if
+     * {@code positive} is {@code false}).
+     * If {@code NaN}, returns same value.
      *
      * Does not affect floating-point flags,
      * provided these member functions do not:
      *          Double.longBitsToDouble(long)
      *          Double.doubleToLongBits(double)
      *          Double.isNaN(double)
+     *
+     * @param d        the reference value
+     * @param positive {@code true} if the least double is desired;
+     *                 {@code false} otherwise
+     * @return the least or greater double value
      */
     public static double nextDouble (double d, boolean positive) {
 
--- a/jdk/src/share/classes/java/text/CollationElementIterator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/CollationElementIterator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,14 +54,14 @@
  * For example, consider the following in Spanish:
  * <blockquote>
  * <pre>
- * "ca" -> the first key is key('c') and second key is key('a').
- * "cha" -> the first key is key('ch') and second key is key('a').
+ * "ca" &rarr; the first key is key('c') and second key is key('a').
+ * "cha" &rarr; the first key is key('ch') and second key is key('a').
  * </pre>
  * </blockquote>
  * And in German,
  * <blockquote>
  * <pre>
- * "\u00e4b"-> the first key is key('a'), the second key is key('e'), and
+ * "\u00e4b" &rarr; the first key is key('a'), the second key is key('e'), and
  * the third key is key('b').
  * </pre>
  * </blockquote>
@@ -177,6 +177,8 @@
      * means that when you change direction while iterating (i.e., call next() and
      * then call previous(), or call previous() and then call next()), you'll get
      * back the same element twice.</p>
+     *
+     * @return the next collation element
      */
     public int next()
     {
@@ -272,6 +274,8 @@
      * updates the pointer.  This means that when you change direction while
      * iterating (i.e., call next() and then call previous(), or call previous()
      * and then call next()), you'll get back the same element twice.</p>
+     *
+     * @return the previous collation element
      * @since 1.2
      */
     public int previous()
--- a/jdk/src/share/classes/java/text/CollationKey.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/CollationKey.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,28 +68,28 @@
  * The following example shows how <code>CollationKey</code>s might be used
  * to sort a list of <code>String</code>s.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * // Create an array of CollationKeys for the Strings to be sorted.
  * Collator myCollator = Collator.getInstance();
  * CollationKey[] keys = new CollationKey[3];
  * keys[0] = myCollator.getCollationKey("Tom");
  * keys[1] = myCollator.getCollationKey("Dick");
  * keys[2] = myCollator.getCollationKey("Harry");
- * sort( keys );
- * <br>
+ * sort(keys);
+ *
  * //...
- * <br>
+ *
  * // Inside body of sort routine, compare keys this way
- * if( keys[i].compareTo( keys[j] ) > 0 )
+ * if (keys[i].compareTo(keys[j]) > 0)
  *    // swap keys[i] and keys[j]
- * <br>
+ *
  * //...
- * <br>
+ *
  * // Finally, when we've returned from sort.
- * System.out.println( keys[0].getSourceString() );
- * System.out.println( keys[1].getSourceString() );
- * System.out.println( keys[2].getSourceString() );
- * </pre>
+ * System.out.println(keys[0].getSourceString());
+ * System.out.println(keys[1].getSourceString());
+ * System.out.println(keys[2].getSourceString());
+ * }</pre>
  * </blockquote>
  *
  * @see          Collator
@@ -112,6 +112,8 @@
 
     /**
      * Returns the String that this CollationKey represents.
+     *
+     * @return the source string of this CollationKey
      */
     public String getSourceString() {
         return source;
@@ -123,6 +125,8 @@
      * could be legitimately compared, then one could compare the byte arrays
      * for each of those keys to obtain the same result.  Byte arrays are
      * organized most significant byte first.
+     *
+     * @return a byte array representation of the CollationKey
      */
     abstract public byte[] toByteArray();
 
@@ -130,8 +134,8 @@
   /**
    * CollationKey constructor.
    *
-   * @param source - the source string.
-   * @exception NullPointerException if <code>source</code> is null.
+   * @param source the source string
+   * @exception NullPointerException if {@code source} is null
    * @since 1.6
    */
     protected CollationKey(String source) {
--- a/jdk/src/share/classes/java/text/DateFormat.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/DateFormat.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@
  * {@code DateFormat} is an abstract class for date/time formatting subclasses which
  * formats and parses dates or time in a language-independent manner.
  * The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for
- * formatting (i.e., date -> text), parsing (text -> date), and
+ * formatting (i.e., date &rarr; text), parsing (text &rarr; date), and
  * normalization.  The date is represented as a <code>Date</code> object or
  * as the milliseconds since January 1, 1970, 00:00:00 GMT.
  *
@@ -73,28 +73,36 @@
  *
  * <p>To format a date for the current Locale, use one of the
  * static factory methods:
- * <pre>
- *  myString = DateFormat.getDateInstance().format(myDate);
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * myString = DateFormat.getDateInstance().format(myDate);
+ * }</pre>
+ * </blockquote>
  * <p>If you are formatting multiple dates, it is
  * more efficient to get the format and use it multiple times so that
  * the system doesn't have to fetch the information about the local
  * language and country conventions multiple times.
- * <pre>
- *  DateFormat df = DateFormat.getDateInstance();
- *  for (int i = 0; i < myDate.length; ++i) {
- *    output.println(df.format(myDate[i]) + "; ");
- *  }
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * DateFormat df = DateFormat.getDateInstance();
+ * for (int i = 0; i < myDate.length; ++i) {
+ *     output.println(df.format(myDate[i]) + "; ");
+ * }
+ * }</pre>
+ * </blockquote>
  * <p>To format a date for a different Locale, specify it in the
  * call to {@link #getDateInstance(int, Locale) getDateInstance()}.
- * <pre>
- *  DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
+ * }</pre>
+ * </blockquote>
  * <p>You can use a DateFormat to parse also.
- * <pre>
- *  myDate = df.parse(myString);
- * </pre>
+ * <blockquote>
+ * <pre>{@code
+ * myDate = df.parse(myString);
+ * }</pre>
+ * </blockquote>
  * <p>Use {@code getDateInstance} to get the normal date format for that country.
  * There are other static factory methods available.
  * Use {@code getTimeInstance} to get the time format for that country.
@@ -125,7 +133,7 @@
  * on the screen.
  * </ul>
  *
- * <h4><a name="synchronization">Synchronization</a></h4>
+ * <h3><a name="synchronization">Synchronization</a></h3>
  *
  * <p>
  * Date formats are not synchronized.
@@ -581,6 +589,8 @@
     /**
      * Get a default date/time formatter that uses the SHORT style for both the
      * date and the time.
+     *
+     * @return a date/time formatter
      */
     public final static DateFormat getInstance() {
         return getDateTimeInstance(SHORT, SHORT);
@@ -653,9 +663,9 @@
     /**
      * Sets the time zone for the calendar of this {@code DateFormat} object.
      * This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().setTimeZone(zone)
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().setTimeZone(zone)
+     * }</pre></blockquote>
      *
      * <p>The {@code TimeZone} set by this method is overwritten by a
      * {@link #setCalendar(java.util.Calendar) setCalendar} call.
@@ -673,9 +683,9 @@
     /**
      * Gets the time zone.
      * This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().getTimeZone()
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().getTimeZone()
+     * }</pre></blockquote>
      *
      * @return the time zone associated with the calendar of DateFormat.
      */
@@ -691,9 +701,9 @@
      * inputs must match this object's format.
      *
      * <p>This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().setLenient(lenient)
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().setLenient(lenient)
+     * }</pre></blockquote>
      *
      * <p>This leniency value is overwritten by a call to {@link
      * #setCalendar(java.util.Calendar) setCalendar()}.
@@ -709,9 +719,9 @@
     /**
      * Tell whether date/time parsing is to be lenient.
      * This method is equivalent to the following call.
-     * <blockquote><pre>
-     *  getCalendar().isLenient()
-     * </pre></blockquote>
+     * <blockquote><pre>{@code
+     * getCalendar().isLenient()
+     * }</pre></blockquote>
      *
      * @return {@code true} if the {@link #calendar} is lenient;
      *         {@code false} otherwise.
--- a/jdk/src/share/classes/java/text/DateFormatSymbols.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/DateFormatSymbols.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -135,6 +135,7 @@
      * implementations. For full locale coverage, use the
      * {@link #getInstance(Locale) getInstance} method.
      *
+     * @param locale the desired locale
      * @see #getInstance(Locale)
      * @exception  java.util.MissingResourceException
      *             if the resources for the specified locale cannot be
--- a/jdk/src/share/classes/java/text/DecimalFormat.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/DecimalFormat.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
  * the <code>NumberFormat</code> factory methods, the pattern and symbols are
  * read from localized <code>ResourceBundle</code>s.
  *
- * <h4>Patterns</h4>
+ * <h3>Patterns</h3>
  *
  * <code>DecimalFormat</code> patterns have the following syntax:
  * <blockquote><pre>
@@ -174,7 +174,7 @@
  * <blockquote>
  * <table border=0 cellspacing=3 cellpadding=0 summary="Chart showing symbol,
  *  location, localized, and meaning.">
- *     <tr bgcolor="#ccccff">
+ *     <tr style="background-color: rgb(204, 204, 255);">
  *          <th align=left>Symbol
  *          <th align=left>Location
  *          <th align=left>Localized?
@@ -184,7 +184,7 @@
  *          <td>Number
  *          <td>Yes
  *          <td>Digit
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>#</code>
  *          <td>Number
  *          <td>Yes
@@ -194,7 +194,7 @@
  *          <td>Number
  *          <td>Yes
  *          <td>Decimal separator or monetary decimal separator
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>-</code>
  *          <td>Number
  *          <td>Yes
@@ -204,7 +204,7 @@
  *          <td>Number
  *          <td>Yes
  *          <td>Grouping separator
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>E</code>
  *          <td>Number
  *          <td>Yes
@@ -215,7 +215,7 @@
  *          <td>Subpattern boundary
  *          <td>Yes
  *          <td>Separates positive and negative subpatterns
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>%</code>
  *          <td>Prefix or suffix
  *          <td>Yes
@@ -225,7 +225,7 @@
  *          <td>Prefix or suffix
  *          <td>Yes
  *          <td>Multiply by 1000 and show as per mille value
- *     <tr valign=top bgcolor="#eeeeff">
+ *     <tr style="vertical-align: top; background-color: rgb(238, 238, 255);">
  *          <td><code>&#164;</code> (<code>&#92;u00A4</code>)
  *          <td>Prefix or suffix
  *          <td>No
@@ -248,7 +248,8 @@
  *
  * <p>Numbers in scientific notation are expressed as the product of a mantissa
  * and a power of ten, for example, 1234 can be expressed as 1.234 x 10^3.  The
- * mantissa is often in the range 1.0 <= x < 10.0, but it need not be.
+ * mantissa is often in the range 1.0 &le; x {@literal <} 10.0, but it need not
+ * be.
  * <code>DecimalFormat</code> can be instructed to format and parse scientific
  * notation <em>only via a pattern</em>; there is currently no factory method
  * that creates a scientific notation format.  In a pattern, the exponent
@@ -336,13 +337,13 @@
  *
  * <h4>Example</h4>
  *
- * <blockquote><pre>
+ * <blockquote><pre>{@code
  * <strong>// Print out a number using the localized number, integer, currency,
  * // and percent format for each locale</strong>
  * Locale[] locales = NumberFormat.getAvailableLocales();
  * double myNumber = -1234.56;
  * NumberFormat form;
- * for (int j=0; j<4; ++j) {
+ * for (int j = 0; j < 4; ++j) {
  *     System.out.println("FORMAT");
  *     for (int i = 0; i < locales.length; ++i) {
  *         if (locales[i].getCountry().length() == 0) {
@@ -368,7 +369,7 @@
  *         } catch (ParseException e) {}
  *     }
  * }
- * </pre></blockquote>
+ * }</pre></blockquote>
  *
  * @see          <a href="http://java.sun.com/docs/books/tutorial/i18n/format/decimalFormat.html">Java Tutorial</a>
  * @see          NumberFormat
@@ -421,7 +422,7 @@
      * return the most appropriate sub-class of NumberFormat for a given
      * locale.
      *
-     * @param pattern A non-localized pattern string.
+     * @param pattern a non-localized pattern string.
      * @exception NullPointerException if <code>pattern</code> is null
      * @exception IllegalArgumentException if the given pattern is invalid.
      * @see java.text.NumberFormat#getInstance
@@ -2382,6 +2383,8 @@
     /**
      * Get the positive prefix.
      * <P>Examples: +123, $123, sFr123
+     *
+     * @return the positive prefix
      */
     public String getPositivePrefix () {
         return positivePrefix;
@@ -2390,6 +2393,8 @@
     /**
      * Set the positive prefix.
      * <P>Examples: +123, $123, sFr123
+     *
+     * @param newValue the new positive prefix
      */
     public void setPositivePrefix (String newValue) {
         positivePrefix = newValue;
@@ -2420,6 +2425,8 @@
     /**
      * Get the negative prefix.
      * <P>Examples: -123, ($123) (with negative suffix), sFr-123
+     *
+     * @return the negative prefix
      */
     public String getNegativePrefix () {
         return negativePrefix;
@@ -2428,6 +2435,8 @@
     /**
      * Set the negative prefix.
      * <P>Examples: -123, ($123) (with negative suffix), sFr-123
+     *
+     * @param newValue the new negative prefix
      */
     public void setNegativePrefix (String newValue) {
         negativePrefix = newValue;
@@ -2457,6 +2466,8 @@
     /**
      * Get the positive suffix.
      * <P>Example: 123%
+     *
+     * @return the positive suffix
      */
     public String getPositiveSuffix () {
         return positiveSuffix;
@@ -2465,6 +2476,8 @@
     /**
      * Set the positive suffix.
      * <P>Example: 123%
+     *
+     * @param newValue the new positive suffix
      */
     public void setPositiveSuffix (String newValue) {
         positiveSuffix = newValue;
@@ -2494,6 +2507,8 @@
     /**
      * Get the negative suffix.
      * <P>Examples: -123%, ($123) (with positive suffixes)
+     *
+     * @return the negative suffix
      */
     public String getNegativeSuffix () {
         return negativeSuffix;
@@ -2502,6 +2517,8 @@
     /**
      * Set the negative suffix.
      * <P>Examples: 123%
+     *
+     * @param newValue the new negative suffix
      */
     public void setNegativeSuffix (String newValue) {
         negativeSuffix = newValue;
@@ -2532,6 +2549,7 @@
      * Gets the multiplier for use in percent, per mille, and similar
      * formats.
      *
+     * @return the multiplier
      * @see #setMultiplier(int)
      */
     public int getMultiplier () {
@@ -2549,6 +2567,7 @@
      * <P>Example: with multiplier 100, 1.23 is formatted as "123", and
      * "123" is parsed into 1.23.
      *
+     * @param newValue the new multiplier
      * @see #getMultiplier
      */
     public void setMultiplier (int newValue) {
@@ -2571,6 +2590,8 @@
      * Return the grouping size. Grouping size is the number of digits between
      * grouping separators in the integer portion of a number.  For example,
      * in the number "123,456.78", the grouping size is 3.
+     *
+     * @return the grouping size
      * @see #setGroupingSize
      * @see java.text.NumberFormat#isGroupingUsed
      * @see java.text.DecimalFormatSymbols#getGroupingSeparator
@@ -2585,6 +2606,8 @@
      * in the number "123,456.78", the grouping size is 3.
      * <br>
      * The value passed in is converted to a byte, which may lose information.
+     *
+     * @param newValue the new grouping size
      * @see #getGroupingSize
      * @see java.text.NumberFormat#setGroupingUsed
      * @see java.text.DecimalFormatSymbols#setGroupingSeparator
@@ -2597,7 +2620,10 @@
     /**
      * Allows you to get the behavior of the decimal separator with integers.
      * (The decimal separator will always appear with decimals.)
-     * <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
+     * <P>Example: Decimal ON: 12345 &rarr; 12345.; OFF: 12345 &rarr; 12345
+     *
+     * @return {@code true} if the decimal separator is always shown;
+     *         {@code false} otherwise
      */
     public boolean isDecimalSeparatorAlwaysShown() {
         return decimalSeparatorAlwaysShown;
@@ -2606,7 +2632,10 @@
     /**
      * Allows you to set the behavior of the decimal separator with integers.
      * (The decimal separator will always appear with decimals.)
-     * <P>Example: Decimal ON: 12345 -> 12345.; OFF: 12345 -> 12345
+     * <P>Example: Decimal ON: 12345 &rarr; 12345.; OFF: 12345 &rarr; 12345
+     *
+     * @param newValue {@code true} if the decimal separator is always shown;
+     *                 {@code false} otherwise
      */
     public void setDecimalSeparatorAlwaysShown(boolean newValue) {
         decimalSeparatorAlwaysShown = newValue;
@@ -2616,6 +2645,9 @@
     /**
      * Returns whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
      * method returns <code>BigDecimal</code>. The default value is false.
+     *
+     * @return {@code true} if the parse method returns BigDecimal;
+     *         {@code false} otherwise
      * @see #setParseBigDecimal
      * @since 1.5
      */
@@ -2626,6 +2658,9 @@
     /**
      * Sets whether the {@link #parse(java.lang.String, java.text.ParsePosition)}
      * method returns <code>BigDecimal</code>.
+     *
+     * @param newValue {@code true} if the parse method returns BigDecimal;
+     *                 {@code false} otherwise
      * @see #isParseBigDecimal
      * @since 1.5
      */
@@ -2712,6 +2747,8 @@
     /**
      * Synthesizes a pattern string that represents the current state
      * of this Format object.
+     *
+     * @return a pattern string
      * @see #applyPattern
      */
     public String toPattern() {
@@ -2721,6 +2758,8 @@
     /**
      * Synthesizes a localized pattern string that represents the current
      * state of this Format object.
+     *
+     * @return a localized pattern string
      * @see #applyPattern
      */
     public String toLocalizedPattern() {
@@ -3049,7 +3088,7 @@
      * by this routine, since that is the typical end-user desire;
      * use setMaximumInteger if you want to set a real value.
      * For negative numbers, use a second pattern, separated by a semicolon
-     * <P>Example <code>"#,#00.0#"</code> -> 1,234.56
+     * <P>Example <code>"#,#00.0#"</code> &rarr; 1,234.56
      * <P>This means a minimum of 2 integer digits, 1 fraction digit, and
      * a maximum of 2 fraction digits.
      * <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
@@ -3057,6 +3096,7 @@
      * <p>In negative patterns, the minimum and maximum counts are ignored;
      * these are presumed to be set in the positive pattern.
      *
+     * @param pattern a new pattern
      * @exception NullPointerException if <code>pattern</code> is null
      * @exception IllegalArgumentException if the given pattern is invalid.
      */
@@ -3075,7 +3115,7 @@
      * by this routine, since that is the typical end-user desire;
      * use setMaximumInteger if you want to set a real value.
      * For negative numbers, use a second pattern, separated by a semicolon
-     * <P>Example <code>"#,#00.0#"</code> -> 1,234.56
+     * <P>Example <code>"#,#00.0#"</code> &rarr; 1,234.56
      * <P>This means a minimum of 2 integer digits, 1 fraction digit, and
      * a maximum of 2 fraction digits.
      * <p>Example: <code>"#,#00.0#;(#,#00.0#)"</code> for negatives in
@@ -3083,6 +3123,7 @@
      * <p>In negative patterns, the minimum and maximum counts are ignored;
      * these are presumed to be set in the positive pattern.
      *
+     * @param pattern a new pattern
      * @exception NullPointerException if <code>pattern</code> is null
      * @exception IllegalArgumentException if the given pattern is invalid.
      */
--- a/jdk/src/share/classes/java/text/DecimalFormatSymbols.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/DecimalFormatSymbols.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,7 @@
      * This may return a {@code NumberFormat} instance with the Thai numbering system,
      * instead of the Latin numbering system.
      *
+     * @param locale the desired locale
      * @exception NullPointerException if <code>locale</code> is null
      */
     public DecimalFormatSymbols( Locale locale ) {
@@ -122,7 +123,7 @@
      * implementations.  It must contain at least a <code>Locale</code>
      * instance equal to {@link java.util.Locale#US Locale.US}.
      *
-     * @return An array of locales for which localized
+     * @return an array of locales for which localized
      *         <code>DecimalFormatSymbols</code> instances are available.
      * @since 1.6
      */
@@ -166,6 +167,7 @@
      * </pre>
      * This may return a {@code NumberFormat} instance with the Thai numbering system,
      * instead of the Latin numbering system.
+     *
      * @param locale the desired locale.
      * @return a <code>DecimalFormatSymbols</code> instance.
      * @exception NullPointerException if <code>locale</code> is null
@@ -185,6 +187,8 @@
 
     /**
      * Gets the character used for zero. Different for Arabic, etc.
+     *
+     * @return the character used for zero
      */
     public char getZeroDigit() {
         return zeroDigit;
@@ -192,6 +196,8 @@
 
     /**
      * Sets the character used for zero. Different for Arabic, etc.
+     *
+     * @param zeroDigit the character used for zero
      */
     public void setZeroDigit(char zeroDigit) {
         this.zeroDigit = zeroDigit;
@@ -199,6 +205,8 @@
 
     /**
      * Gets the character used for thousands separator. Different for French, etc.
+     *
+     * @return the grouping separator
      */
     public char getGroupingSeparator() {
         return groupingSeparator;
@@ -206,6 +214,8 @@
 
     /**
      * Sets the character used for thousands separator. Different for French, etc.
+     *
+     * @param groupingSeparator the grouping separator
      */
     public void setGroupingSeparator(char groupingSeparator) {
         this.groupingSeparator = groupingSeparator;
@@ -213,6 +223,8 @@
 
     /**
      * Gets the character used for decimal sign. Different for French, etc.
+     *
+     * @return the character used for decimal sign
      */
     public char getDecimalSeparator() {
         return decimalSeparator;
@@ -220,6 +232,8 @@
 
     /**
      * Sets the character used for decimal sign. Different for French, etc.
+     *
+     * @param decimalSeparator the character used for decimal sign
      */
     public void setDecimalSeparator(char decimalSeparator) {
         this.decimalSeparator = decimalSeparator;
@@ -227,6 +241,8 @@
 
     /**
      * Gets the character used for per mille sign. Different for Arabic, etc.
+     *
+     * @return the character used for per mille sign
      */
     public char getPerMill() {
         return perMill;
@@ -234,6 +250,8 @@
 
     /**
      * Sets the character used for per mille sign. Different for Arabic, etc.
+     *
+     * @param perMill the character used for per mille sign
      */
     public void setPerMill(char perMill) {
         this.perMill = perMill;
@@ -241,6 +259,8 @@
 
     /**
      * Gets the character used for percent sign. Different for Arabic, etc.
+     *
+     * @return the character used for percent sign
      */
     public char getPercent() {
         return percent;
@@ -248,6 +268,8 @@
 
     /**
      * Sets the character used for percent sign. Different for Arabic, etc.
+     *
+     * @param percent the character used for percent sign
      */
     public void setPercent(char percent) {
         this.percent = percent;
@@ -255,6 +277,8 @@
 
     /**
      * Gets the character used for a digit in a pattern.
+     *
+     * @return the character used for a digit in a pattern
      */
     public char getDigit() {
         return digit;
@@ -262,6 +286,8 @@
 
     /**
      * Sets the character used for a digit in a pattern.
+     *
+     * @param digit the character used for a digit in a pattern
      */
     public void setDigit(char digit) {
         this.digit = digit;
@@ -270,6 +296,8 @@
     /**
      * Gets the character used to separate positive and negative subpatterns
      * in a pattern.
+     *
+     * @return the pattern separator
      */
     public char getPatternSeparator() {
         return patternSeparator;
@@ -278,6 +306,8 @@
     /**
      * Sets the character used to separate positive and negative subpatterns
      * in a pattern.
+     *
+     * @param patternSeparator the pattern separator
      */
     public void setPatternSeparator(char patternSeparator) {
         this.patternSeparator = patternSeparator;
@@ -286,6 +316,8 @@
     /**
      * Gets the string used to represent infinity. Almost always left
      * unchanged.
+     *
+     * @return the string representing infinity
      */
     public String getInfinity() {
         return infinity;
@@ -294,6 +326,8 @@
     /**
      * Sets the string used to represent infinity. Almost always left
      * unchanged.
+     *
+     * @param infinity the string representing infinity
      */
     public void setInfinity(String infinity) {
         this.infinity = infinity;
@@ -302,6 +336,8 @@
     /**
      * Gets the string used to represent "not a number". Almost always left
      * unchanged.
+     *
+     * @return the string representing "not a number"
      */
     public String getNaN() {
         return NaN;
@@ -310,6 +346,8 @@
     /**
      * Sets the string used to represent "not a number". Almost always left
      * unchanged.
+     *
+     * @param NaN the string representing "not a number"
      */
     public void setNaN(String NaN) {
         this.NaN = NaN;
@@ -319,6 +357,8 @@
      * Gets the character used to represent minus sign. If no explicit
      * negative format is specified, one is formed by prefixing
      * minusSign to the positive format.
+     *
+     * @return the character representing minus sign
      */
     public char getMinusSign() {
         return minusSign;
@@ -328,6 +368,8 @@
      * Sets the character used to represent minus sign. If no explicit
      * negative format is specified, one is formed by prefixing
      * minusSign to the positive format.
+     *
+     * @param minusSign the character representing minus sign
      */
     public void setMinusSign(char minusSign) {
         this.minusSign = minusSign;
@@ -336,6 +378,8 @@
     /**
      * Returns the currency symbol for the currency of these
      * DecimalFormatSymbols in their locale.
+     *
+     * @return the currency symbol
      * @since 1.2
      */
     public String getCurrencySymbol()
@@ -346,6 +390,8 @@
     /**
      * Sets the currency symbol for the currency of these
      * DecimalFormatSymbols in their locale.
+     *
+     * @param currency the currency symbol
      * @since 1.2
      */
     public void setCurrencySymbol(String currency)
@@ -356,6 +402,8 @@
     /**
      * Returns the ISO 4217 currency code of the currency of these
      * DecimalFormatSymbols.
+     *
+     * @return the currency code
      * @since 1.2
      */
     public String getInternationalCurrencySymbol()
@@ -374,6 +422,7 @@
      * then the currency attribute is set to null and the currency symbol
      * attribute is not modified.
      *
+     * @param currencyCode the currency code
      * @see #setCurrency
      * @see #setCurrencySymbol
      * @since 1.2
@@ -427,6 +476,8 @@
 
     /**
      * Returns the monetary decimal separator.
+     *
+     * @return the monetary decimal separator
      * @since 1.2
      */
     public char getMonetaryDecimalSeparator()
@@ -436,6 +487,8 @@
 
     /**
      * Sets the monetary decimal separator.
+     *
+     * @param sep the monetary decimal separator
      * @since 1.2
      */
     public void setMonetaryDecimalSeparator(char sep)
--- a/jdk/src/share/classes/java/text/FieldPosition.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/FieldPosition.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,6 +100,7 @@
      * identified by constants, whose names typically end with _FIELD,
      * in the various subclasses of Format.
      *
+     * @param field the field identifier
      * @see java.text.NumberFormat#INTEGER_FIELD
      * @see java.text.NumberFormat#FRACTION_FIELD
      * @see java.text.DateFormat#YEAR_FIELD
@@ -157,6 +158,8 @@
 
     /**
      * Retrieves the field identifier.
+     *
+     * @return the field identifier
      */
     public int getField() {
         return field;
@@ -164,6 +167,8 @@
 
     /**
      * Retrieves the index of the first character in the requested field.
+     *
+     * @return the begin index
      */
     public int getBeginIndex() {
         return beginIndex;
@@ -172,6 +177,8 @@
     /**
      * Retrieves the index of the character following the last character in the
      * requested field.
+     *
+     * @return the end index
      */
     public int getEndIndex() {
         return endIndex;
@@ -179,6 +186,8 @@
 
     /**
      * Sets the begin index.  For use by subclasses of Format.
+     *
+     * @param bi the begin index
      * @since 1.2
      */
     public void setBeginIndex(int bi) {
@@ -187,6 +196,8 @@
 
     /**
      * Sets the end index.  For use by subclasses of Format.
+     *
+     * @param ei the end index
      * @since 1.2
      */
     public void setEndIndex(int ei) {
--- a/jdk/src/share/classes/java/text/Format.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/Format.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,7 @@
  * no separator in between, and in this case the <code>parseObject</code> could
  * not tell which digits belong to which number.
  *
- * <h4>Subclassing</h4>
+ * <h3>Subclassing</h3>
  *
  * <p>
  * The Java Platform provides three specialized subclasses of <code>Format</code>--
--- a/jdk/src/share/classes/java/text/MessageFormat.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/MessageFormat.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,7 +68,7 @@
  * behavior is defined by the pattern that you provide as well as the
  * subformats used for inserted arguments.
  *
- * <h4><a name="patterns">Patterns and Their Interpretation</a></h4>
+ * <h3><a name="patterns">Patterns and Their Interpretation</a></h3>
  *
  * <code>MessageFormat</code> uses patterns of the following form:
  * <blockquote><pre>
@@ -287,10 +287,10 @@
  * You can create the <code>ChoiceFormat</code> programmatically, as in the
  * above example, or by using a pattern. See {@link ChoiceFormat}
  * for more information.
- * <blockquote><pre>
+ * <blockquote><pre>{@code
  * form.applyPattern(
- *    "There {0,choice,0#are no files|1#is one file|1&lt;are {0,number,integer} files}.");
- * </pre></blockquote>
+ *    "There {0,choice,0#are no files|1#is one file|1<are {0,number,integer} files}.");
+ * }</pre></blockquote>
  *
  * <p>
  * <strong>Note:</strong> As we see above, the string produced
@@ -778,7 +778,7 @@
      *    <tr>
      *       <td><code>instanceof ChoiceFormat</code>
      *       <td><i>any</i>
-     *       <td><code>subformat.format(argument).indexOf('{') >= 0 ?<br>
+     *       <td><code>subformat.format(argument).indexOf('{') &gt;= 0 ?<br>
      *           (new MessageFormat(subformat.format(argument), getLocale())).format(argument) :
      *           subformat.format(argument)</code>
      *    <tr>
@@ -811,6 +811,8 @@
      * @param result where text is appended.
      * @param pos On input: an alignment field, if desired.
      *            On output: the offsets of the alignment field.
+     * @return the string buffer passed in as {@code result}, with formatted
+     * text appended
      * @exception IllegalArgumentException if an argument in the
      *            <code>arguments</code> array is not of the type
      *            expected by the format element(s) that use it.
@@ -828,6 +830,9 @@
      *     <code>(new {@link #MessageFormat(String) MessageFormat}(pattern)).{@link #format(java.lang.Object[], java.lang.StringBuffer, java.text.FieldPosition) format}(arguments, new StringBuffer(), null).toString()</code>
      * </blockquote>
      *
+     * @param pattern   the pattern string
+     * @param arguments object(s) to format
+     * @return the formatted string
      * @exception IllegalArgumentException if the pattern is invalid,
      *            or if an argument in the <code>arguments</code> array
      *            is not of the type expected by the format element(s)
@@ -940,6 +945,10 @@
      * is comparing against the pattern "AAD {0} BBB", the error index is
      * 0. When an error occurs, the call to this method will return null.
      * If the source is null, return an empty array.
+     *
+     * @param source the string to parse
+     * @param pos    the parse position
+     * @return an array of parsed objects
      */
     public Object[] parse(String source, ParsePosition pos) {
         if (source == null) {
--- a/jdk/src/share/classes/java/text/Normalizer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/Normalizer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,14 +55,12 @@
  *
  * <p><pre>
  *      U+00C1    LATIN CAPITAL LETTER A WITH ACUTE</pre>
- * </p>
  *
  * or as two separate characters (the "decomposed" form):
  *
  * <p><pre>
  *      U+0041    LATIN CAPITAL LETTER A
  *      U+0301    COMBINING ACUTE ACCENT</pre>
- * </p>
  *
  * To a user of your program, however, both of these sequences should be
  * treated as the same "user-level" character "A with acute accent".  When you
@@ -78,13 +76,11 @@
  *      U+0066    LATIN SMALL LETTER F
  *      U+0066    LATIN SMALL LETTER F
  *      U+0069    LATIN SMALL LETTER I</pre>
- * </p>
  *
  * or as the single character
  *
  * <p><pre>
  *      U+FB03    LATIN SMALL LIGATURE FFI</pre>
- * </p>
  *
  * The ffi ligature is not a distinct semantic character, and strictly speaking
  * it shouldn't be in Unicode at all, but it was included for compatibility
--- a/jdk/src/share/classes/java/text/NumberFormat.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/NumberFormat.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -73,34 +73,34 @@
  * To format a number for the current Locale, use one of the factory
  * class methods:
  * <blockquote>
- * <pre>
- *  myString = NumberFormat.getInstance().format(myNumber);
- * </pre>
+ * <pre>{@code
+ * myString = NumberFormat.getInstance().format(myNumber);
+ * }</pre>
  * </blockquote>
  * If you are formatting multiple numbers, it is
  * more efficient to get the format and use it multiple times so that
  * the system doesn't have to fetch the information about the local
  * language and country conventions multiple times.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * NumberFormat nf = NumberFormat.getInstance();
  * for (int i = 0; i < myNumber.length; ++i) {
  *     output.println(nf.format(myNumber[i]) + "; ");
  * }
- * </pre>
+ * }</pre>
  * </blockquote>
  * To format a number for a different Locale, specify it in the
  * call to <code>getInstance</code>.
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * NumberFormat nf = NumberFormat.getInstance(Locale.FRENCH);
- * </pre>
+ * }</pre>
  * </blockquote>
  * You can also use a <code>NumberFormat</code> to parse numbers:
  * <blockquote>
- * <pre>
+ * <pre>{@code
  * myNumber = nf.parse(myString);
- * </pre>
+ * }</pre>
  * </blockquote>
  * Use <code>getInstance</code> or <code>getNumberInstance</code> to get the
  * normal number format. Use <code>getIntegerInstance</code> to get an
@@ -125,8 +125,8 @@
  * the detailed description for each these control methods,
  * <p>
  * setParseIntegerOnly : only affects parsing, e.g.
- * if true,  "3456.78" -> 3456 (and leaves the parse position just after index 6)
- * if false, "3456.78" -> 3456.78 (and leaves the parse position just after index 8)
+ * if true,  "3456.78" &rarr; 3456 (and leaves the parse position just after index 6)
+ * if false, "3456.78" &rarr; 3456.78 (and leaves the parse position just after index 8)
  * This is independent of formatting.  If you want to not show a decimal point
  * where there might be no digits after the decimal point, use
  * setDecimalSeparatorAlwaysShown.
@@ -134,8 +134,8 @@
  * setDecimalSeparatorAlwaysShown : only affects formatting, and only where
  * there might be no digits after the decimal point, such as with a pattern
  * like "#,##0.##", e.g.,
- * if true,  3456.00 -> "3,456."
- * if false, 3456.00 -> "3456"
+ * if true,  3456.00 &rarr; "3,456."
+ * if false, 3456.00 &rarr; "3456"
  * This is independent of parsing.  If you want parsing to stop at the decimal
  * point, use setParseIntegerOnly.
  *
@@ -166,7 +166,7 @@
  *      numbers: "(12)" for -12.
  * </ol>
  *
- * <h4><a name="synchronization">Synchronization</a></h4>
+ * <h3><a name="synchronization">Synchronization</a></h3>
  *
  * <p>
  * Number formats are generally not synchronized.
@@ -280,6 +280,9 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number the double number to format
+     * @return the formatted String
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -302,6 +305,9 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number the long number to format
+     * @return the formatted String
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -313,6 +319,12 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number     the double number to format
+     * @param toAppendTo the StringBuffer to which the formatted text is to be
+     *                   appended
+     * @param pos        the field position
+     * @return the formatted StringBuffer
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -323,6 +335,12 @@
 
    /**
      * Specialization of format.
+     *
+     * @param number     the long number to format
+     * @param toAppendTo the StringBuffer to which the formatted text is to be
+     *                   appended
+     * @param pos        the field position
+     * @return the formatted StringBuffer
      * @exception        ArithmeticException if rounding is needed with rounding
      *                   mode being set to RoundingMode.UNNECESSARY
      * @see java.text.Format#format
@@ -339,6 +357,10 @@
      * after the 1).
      * Does not throw an exception; if no object can be parsed, index is
      * unchanged!
+     *
+     * @param source the String to parse
+     * @param parsePosition the parse position
+     * @return the parsed value
      * @see java.text.NumberFormat#isParseIntegerOnly
      * @see java.text.Format#parseObject
      */
@@ -373,6 +395,9 @@
      * would stop at the "." character.  Of course, the exact format accepted
      * by the parse operation is locale dependant and determined by sub-classes
      * of NumberFormat.
+     *
+     * @return {@code true} if numbers should be parsed as integers only;
+     *         {@code false} otherwise
      */
     public boolean isParseIntegerOnly() {
         return parseIntegerOnly;
@@ -380,6 +405,9 @@
 
     /**
      * Sets whether or not numbers should be parsed as integers only.
+     *
+     * @param value {@code true} if numbers should be parsed as integers only;
+     *              {@code false} otherwise
      * @see #isParseIntegerOnly
      */
     public void setParseIntegerOnly(boolean value) {
@@ -393,6 +421,9 @@
      * {@link java.util.Locale.Category#FORMAT FORMAT} locale.
      * This is the same as calling
      * {@link #getNumberInstance() getNumberInstance()}.
+     *
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      */
     public final static NumberFormat getInstance() {
         return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE);
@@ -402,6 +433,10 @@
      * Returns a general-purpose number format for the specified locale.
      * This is the same as calling
      * {@link #getNumberInstance(java.util.Locale) getNumberInstance(inLocale)}.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      */
     public static NumberFormat getInstance(Locale inLocale) {
         return getInstance(inLocale, NUMBERSTYLE);
@@ -413,6 +448,9 @@
      * <p>This is equivalent to calling
      * {@link #getNumberInstance(Locale)
      *     getNumberInstance(Locale.getDefault(Locale.Category.FORMAT))}.
+     *
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      * @see java.util.Locale#getDefault(java.util.Locale.Category)
      * @see java.util.Locale.Category#FORMAT
      */
@@ -422,6 +460,10 @@
 
     /**
      * Returns a general-purpose number format for the specified locale.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for general-purpose number
+     * formatting
      */
     public static NumberFormat getNumberInstance(Locale inLocale) {
         return getInstance(inLocale, NUMBERSTYLE);
@@ -457,6 +499,7 @@
      * and to parse only the integer part of an input string (see {@link
      * #isParseIntegerOnly isParseIntegerOnly}).
      *
+     * @param inLocale the desired locale
      * @see #getRoundingMode()
      * @return a number format for integer values
      * @since 1.4
@@ -472,6 +515,7 @@
      * {@link #getCurrencyInstance(Locale)
      *     getCurrencyInstance(Locale.getDefault(Locale.Category.FORMAT))}.
      *
+     * @return the {@code NumberFormat} instance for currency formatting
      * @see java.util.Locale#getDefault(java.util.Locale.Category)
      * @see java.util.Locale.Category#FORMAT
      */
@@ -481,6 +525,9 @@
 
     /**
      * Returns a currency format for the specified locale.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for currency formatting
      */
     public static NumberFormat getCurrencyInstance(Locale inLocale) {
         return getInstance(inLocale, CURRENCYSTYLE);
@@ -493,6 +540,7 @@
      * {@link #getPercentInstance(Locale)
      *     getPercentInstance(Locale.getDefault(Locale.Category.FORMAT))}.
      *
+     * @return the {@code NumberFormat} instance for percentage formatting
      * @see java.util.Locale#getDefault(java.util.Locale.Category)
      * @see java.util.Locale.Category#FORMAT
      */
@@ -502,6 +550,9 @@
 
     /**
      * Returns a percentage format for the specified locale.
+     *
+     * @param inLocale the desired locale
+     * @return the {@code NumberFormat} instance for percentage formatting
      */
     public static NumberFormat getPercentInstance(Locale inLocale) {
         return getInstance(inLocale, PERCENTSTYLE);
@@ -516,6 +567,8 @@
 
     /**
      * Returns a scientific format for the specified locale.
+     *
+     * @param inLocale the desired locale
      */
     /*public*/ static NumberFormat getScientificInstance(Locale inLocale) {
         return getInstance(inLocale, SCIENTIFICSTYLE);
@@ -586,6 +639,9 @@
      * English locale, with grouping on, the number 1234567 might be formatted
      * as "1,234,567". The grouping separator as well as the size of each group
      * is locale dependant and is determined by sub-classes of NumberFormat.
+     *
+     * @return {@code true} if grouping is used;
+     *         {@code false} otherwise
      * @see #setGroupingUsed
      */
     public boolean isGroupingUsed() {
@@ -594,6 +650,9 @@
 
     /**
      * Set whether or not grouping will be used in this format.
+     *
+     * @param newValue {@code true} if grouping is used;
+     *                 {@code false} otherwise
      * @see #isGroupingUsed
      */
     public void setGroupingUsed(boolean newValue) {
@@ -603,6 +662,8 @@
     /**
      * Returns the maximum number of digits allowed in the integer portion of a
      * number.
+     *
+     * @return the maximum number of digits
      * @see #setMaximumIntegerDigits
      */
     public int getMaximumIntegerDigits() {
@@ -611,10 +672,11 @@
 
     /**
      * Sets the maximum number of digits allowed in the integer portion of a
-     * number. maximumIntegerDigits must be >= minimumIntegerDigits.  If the
+     * number. maximumIntegerDigits must be &ge; minimumIntegerDigits.  If the
      * new value for maximumIntegerDigits is less than the current value
      * of minimumIntegerDigits, then minimumIntegerDigits will also be set to
      * the new value.
+     *
      * @param newValue the maximum number of integer digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -630,6 +692,8 @@
     /**
      * Returns the minimum number of digits allowed in the integer portion of a
      * number.
+     *
+     * @return the minimum number of digits
      * @see #setMinimumIntegerDigits
      */
     public int getMinimumIntegerDigits() {
@@ -638,10 +702,11 @@
 
     /**
      * Sets the minimum number of digits allowed in the integer portion of a
-     * number. minimumIntegerDigits must be <= maximumIntegerDigits.  If the
+     * number. minimumIntegerDigits must be &le; maximumIntegerDigits.  If the
      * new value for minimumIntegerDigits exceeds the current value
      * of maximumIntegerDigits, then maximumIntegerDigits will also be set to
      * the new value
+     *
      * @param newValue the minimum number of integer digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -657,6 +722,8 @@
     /**
      * Returns the maximum number of digits allowed in the fraction portion of a
      * number.
+     *
+     * @return the maximum number of digits.
      * @see #setMaximumFractionDigits
      */
     public int getMaximumFractionDigits() {
@@ -665,10 +732,11 @@
 
     /**
      * Sets the maximum number of digits allowed in the fraction portion of a
-     * number. maximumFractionDigits must be >= minimumFractionDigits.  If the
+     * number. maximumFractionDigits must be &ge; minimumFractionDigits.  If the
      * new value for maximumFractionDigits is less than the current value
      * of minimumFractionDigits, then minimumFractionDigits will also be set to
      * the new value.
+     *
      * @param newValue the maximum number of fraction digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
@@ -684,6 +752,8 @@
     /**
      * Returns the minimum number of digits allowed in the fraction portion of a
      * number.
+     *
+     * @return the minimum number of digits
      * @see #setMinimumFractionDigits
      */
     public int getMinimumFractionDigits() {
@@ -692,10 +762,11 @@
 
     /**
      * Sets the minimum number of digits allowed in the fraction portion of a
-     * number. minimumFractionDigits must be <= maximumFractionDigits.  If the
+     * number. minimumFractionDigits must be &le; maximumFractionDigits.  If the
      * new value for minimumFractionDigits exceeds the current value
      * of maximumFractionDigits, then maximumIntegerDigits will also be set to
      * the new value
+     *
      * @param newValue the minimum number of fraction digits to be shown; if
      * less than zero, then zero is used. The concrete subclass may enforce an
      * upper limit to this value appropriate to the numeric type being formatted.
--- a/jdk/src/share/classes/java/text/ParseException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/ParseException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,6 +55,7 @@
      * Constructs a ParseException with the specified detail message and
      * offset.
      * A detail message is a String that describes this particular exception.
+     *
      * @param s the detail message
      * @param errorOffset the position where the error is found while parsing.
      */
@@ -65,6 +66,8 @@
 
     /**
      * Returns the position where the error was found.
+     *
+     * @return the position where the error was found
      */
     public int getErrorOffset () {
         return errorOffset;
--- a/jdk/src/share/classes/java/text/ParsePosition.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/ParsePosition.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,8 @@
      * Retrieve the current parse position.  On input to a parse method, this
      * is the index of the character at which parsing will begin; on output, it
      * is the index of the character following the last character parsed.
+     *
+     * @return the current parse position
      */
     public int getIndex() {
         return index;
@@ -76,6 +78,8 @@
 
     /**
      * Set the current parse position.
+     *
+     * @param index the current parse position
      */
     public void setIndex(int index) {
         this.index = index;
@@ -83,6 +87,8 @@
 
     /**
      * Create a new ParsePosition with the given initial index.
+     *
+     * @param index initial index
      */
     public ParsePosition(int index) {
         this.index = index;
@@ -91,6 +97,8 @@
      * Set the index at which a parse error occurred.  Formatters
      * should set this before returning an error code from their
      * parseObject method.  The default value is -1 if this is not set.
+     *
+     * @param ei the index at which an error occurred
      * @since 1.2
      */
     public void setErrorIndex(int ei)
@@ -101,12 +109,15 @@
     /**
      * Retrieve the index at which an error occurred, or -1 if the
      * error index has not been set.
+     *
+     * @return the index at which an error occurred
      * @since 1.2
      */
     public int getErrorIndex()
     {
         return errorIndex;
     }
+
     /**
      * Overrides equals
      */
--- a/jdk/src/share/classes/java/text/RuleBasedCollator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/RuleBasedCollator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -68,17 +68,17 @@
  *    &lt;reset&gt; &lt;text-argument&gt;
  * </pre>
  * The definitions of the rule elements is as follows:
- * <UL Type=disc>
+ * <UL>
  *    <LI><strong>Text-Argument</strong>: A text-argument is any sequence of
  *        characters, excluding special characters (that is, common
  *        whitespace characters [0009-000D, 0020] and rule syntax characters
  *        [0021-002F, 003A-0040, 005B-0060, 007B-007E]). If those
  *        characters are desired, you can put them in single quotes
- *        (e.g. ampersand => '&'). Note that unquoted white space characters
+ *        (e.g. ampersand =&gt; '&amp;'). Note that unquoted white space characters
  *        are ignored; e.g. <code>b c</code> is treated as <code>bc</code>.
  *    <LI><strong>Modifier</strong>: There are currently two modifiers that
  *        turn on special collation rules.
- *        <UL Type=square>
+ *        <UL>
  *            <LI>'@' : Turns on backwards sorting of accents (secondary
  *                      differences), as in French.
  *            <LI>'!' : Turns on Thai/Lao vowel-consonant swapping.  If this
@@ -91,7 +91,7 @@
  *        </UL>
  *        <p>'@' : Indicates that accents are sorted backwards, as in French.
  *    <LI><strong>Relation</strong>: The relations are the following:
- *        <UL Type=square>
+ *        <UL>
  *            <LI>'&lt;' : Greater, as a letter difference (primary)
  *            <LI>';' : Greater, as an accent difference (secondary)
  *            <LI>',' : Greater, as a case difference (tertiary)
@@ -100,7 +100,7 @@
  *    <LI><strong>Reset</strong>: There is a single reset
  *        which is used primarily for contractions and expansions, but which
  *        can also be used to add a modification at the end of a set of rules.
- *        <p>'&' : Indicates that the next rule follows the position to where
+ *        <p>'&amp;' : Indicates that the next rule follows the position to where
  *            the reset text-argument would be sorted.
  * </UL>
  *
@@ -166,7 +166,7 @@
  * <p><strong>Errors</strong>
  * <p>
  * The following are errors:
- * <UL Type=disc>
+ * <UL>
  *     <LI>A text-argument contains unquoted punctuation symbols
  *        (e.g. "a &lt; b-c &lt; d").
  *     <LI>A relation or reset character not followed by a text-argument
@@ -206,8 +206,8 @@
  * String Norwegian = "&lt; a, A &lt; b, B &lt; c, C &lt; d, D &lt; e, E &lt; f, F &lt; g, G &lt; h, H &lt; i, I" +
  *                    "&lt; j, J &lt; k, K &lt; l, L &lt; m, M &lt; n, N &lt; o, O &lt; p, P &lt; q, Q &lt; r, R" +
  *                    "&lt; s, S &lt; t, T &lt; u, U &lt; v, V &lt; w, W &lt; x, X &lt; y, Y &lt; z, Z" +
- *                    "&lt; &#92;u00E6, &#92;u00C6" +     // Latin letter ae & AE
- *                    "&lt; &#92;u00F8, &#92;u00D8" +     // Latin letter o & O with stroke
+ *                    "&lt; &#92;u00E6, &#92;u00C6" +     // Latin letter ae &amp; AE
+ *                    "&lt; &#92;u00F8, &#92;u00D8" +     // Latin letter o &amp; O with stroke
  *                    "&lt; &#92;u00E5 = a&#92;u030A," +  // Latin letter a with ring above
  *                    "  &#92;u00C5 = A&#92;u030A;" +  // Latin letter A with ring above
  *                    "  aa, AA";
@@ -232,9 +232,9 @@
  *                 + ";&#92;u030B;&#92;u030C;&#92;u030D;&#92;u030E"    // main accents
  *                 + ";&#92;u030F;&#92;u0310;&#92;u0311;&#92;u0312"    // main accents
  *                 + "&lt; a , A ; ae, AE ; &#92;u00e6 , &#92;u00c6"
- *                 + "&lt; b , B &lt; c, C &lt; e, E & C &lt; d, D";
+ *                 + "&lt; b , B &lt; c, C &lt; e, E &amp; C &lt; d, D";
  * // change the order of accent characters
- * String addOn = "& &#92;u0300 ; &#92;u0308 ; &#92;u0302";
+ * String addOn = "&amp; &#92;u0300 ; &#92;u0308 ; &#92;u0302";
  * RuleBasedCollator myCollator = new RuleBasedCollator(oldRules + addOn);
  * </pre>
  * </blockquote>
@@ -274,7 +274,7 @@
      * @param rules the collation rules to build the collation table from.
      * @exception ParseException A format exception
      * will be thrown if the build process of the rules fails. For
-     * example, build rule "a < ? < d" will cause the constructor to
+     * example, build rule "a &lt; ? &lt; d" will cause the constructor to
      * throw the ParseException because the '?' is not quoted.
      */
     public RuleBasedCollator(String rules) throws ParseException {
@@ -320,7 +320,10 @@
     }
 
     /**
-     * Return a CollationElementIterator for the given String.
+     * Returns a CollationElementIterator for the given String.
+     *
+     * @param source the string to be collated
+     * @return a {@code CollationElementIterator} object
      * @see java.text.CollationElementIterator
      */
     public CollationElementIterator getCollationElementIterator(String source) {
@@ -328,7 +331,10 @@
     }
 
     /**
-     * Return a CollationElementIterator for the given String.
+     * Returns a CollationElementIterator for the given CharacterIterator.
+     *
+     * @param source the character iterator to be collated
+     * @return a {@code CollationElementIterator} object
      * @see java.text.CollationElementIterator
      * @since 1.2
      */
--- a/jdk/src/share/classes/java/text/SimpleDateFormat.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java	Tue Aug 06 16:54:56 2013 -0700
@@ -59,7 +59,7 @@
 /**
  * <code>SimpleDateFormat</code> is a concrete class for formatting and
  * parsing dates in a locale-sensitive manner. It allows for formatting
- * (date -> text), parsing (text -> date), and normalization.
+ * (date &rarr; text), parsing (text &rarr; date), and normalization.
  *
  * <p>
  * <code>SimpleDateFormat</code> allows you to start by choosing
@@ -73,7 +73,7 @@
  * For more information on using these methods, see
  * {@link DateFormat}.
  *
- * <h4>Date and Time Patterns</h4>
+ * <h3>Date and Time Patterns</h3>
  * <p>
  * Date and time formats are specified by <em>date and time pattern</em>
  * strings.
@@ -93,7 +93,7 @@
  * <code>'z'</code> are reserved):
  * <blockquote>
  * <table border=0 cellspacing=3 cellpadding=0 summary="Chart shows pattern letters, date/time component, presentation, and examples.">
- *     <tr bgcolor="#ccccff">
+ *     <tr style="background-color: rgb(204, 204, 255);">
  *         <th align=left>Letter
  *         <th align=left>Date or Time Component
  *         <th align=left>Presentation
@@ -103,7 +103,7 @@
  *         <td>Era designator
  *         <td><a href="#text">Text</a>
  *         <td><code>AD</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>y</code>
  *         <td>Year
  *         <td><a href="#year">Year</a>
@@ -113,7 +113,7 @@
  *         <td>Week year
  *         <td><a href="#year">Year</a>
  *         <td><code>2009</code>; <code>09</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>M</code>
  *         <td>Month in year (context sensitive)
  *         <td><a href="#month">Month</a>
@@ -123,7 +123,7 @@
  *         <td>Month in year (standalone form)
  *         <td><a href="#month">Month</a>
  *         <td><code>July</code>; <code>Jul</code>; <code>07</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>w</code>
  *         <td>Week in year
  *         <td><a href="#number">Number</a>
@@ -133,7 +133,7 @@
  *         <td>Week in month
  *         <td><a href="#number">Number</a>
  *         <td><code>2</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>D</code>
  *         <td>Day in year
  *         <td><a href="#number">Number</a>
@@ -143,7 +143,7 @@
  *         <td>Day in month
  *         <td><a href="#number">Number</a>
  *         <td><code>10</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>F</code>
  *         <td>Day of week in month
  *         <td><a href="#number">Number</a>
@@ -153,7 +153,7 @@
  *         <td>Day name in week
  *         <td><a href="#text">Text</a>
  *         <td><code>Tuesday</code>; <code>Tue</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>u</code>
  *         <td>Day number of week (1 = Monday, ..., 7 = Sunday)
  *         <td><a href="#number">Number</a>
@@ -163,7 +163,7 @@
  *         <td>Am/pm marker
  *         <td><a href="#text">Text</a>
  *         <td><code>PM</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>H</code>
  *         <td>Hour in day (0-23)
  *         <td><a href="#number">Number</a>
@@ -173,7 +173,7 @@
  *         <td>Hour in day (1-24)
  *         <td><a href="#number">Number</a>
  *         <td><code>24</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>K</code>
  *         <td>Hour in am/pm (0-11)
  *         <td><a href="#number">Number</a>
@@ -183,7 +183,7 @@
  *         <td>Hour in am/pm (1-12)
  *         <td><a href="#number">Number</a>
  *         <td><code>12</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>m</code>
  *         <td>Minute in hour
  *         <td><a href="#number">Number</a>
@@ -193,7 +193,7 @@
  *         <td>Second in minute
  *         <td><a href="#number">Number</a>
  *         <td><code>55</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>S</code>
  *         <td>Millisecond
  *         <td><a href="#number">Number</a>
@@ -203,7 +203,7 @@
  *         <td>Time zone
  *         <td><a href="#timezone">General time zone</a>
  *         <td><code>Pacific Standard Time</code>; <code>PST</code>; <code>GMT-08:00</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>Z</code>
  *         <td>Time zone
  *         <td><a href="#rfc822timezone">RFC 822 time zone</a>
@@ -365,37 +365,37 @@
  * in the U.S. Pacific Time time zone.
  * <blockquote>
  * <table border=0 cellspacing=3 cellpadding=0 summary="Examples of date and time patterns interpreted in the U.S. locale">
- *     <tr bgcolor="#ccccff">
+ *     <tr style="background-color: rgb(204, 204, 255);">
  *         <th align=left>Date and Time Pattern
  *         <th align=left>Result
  *     <tr>
  *         <td><code>"yyyy.MM.dd G 'at' HH:mm:ss z"</code>
  *         <td><code>2001.07.04 AD at 12:08:56 PDT</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"EEE, MMM d, ''yy"</code>
  *         <td><code>Wed, Jul 4, '01</code>
  *     <tr>
  *         <td><code>"h:mm a"</code>
  *         <td><code>12:08 PM</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"hh 'o''clock' a, zzzz"</code>
  *         <td><code>12 o'clock PM, Pacific Daylight Time</code>
  *     <tr>
  *         <td><code>"K:mm a, z"</code>
  *         <td><code>0:08 PM, PDT</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"yyyyy.MMMMM.dd GGG hh:mm aaa"</code>
  *         <td><code>02001.July.04 AD 12:08 PM</code>
  *     <tr>
  *         <td><code>"EEE, d MMM yyyy HH:mm:ss Z"</code>
  *         <td><code>Wed, 4 Jul 2001 12:08:56 -0700</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"yyMMddHHmmssZ"</code>
  *         <td><code>010704120856-0700</code>
  *     <tr>
  *         <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSZ"</code>
  *         <td><code>2001-07-04T12:08:56.235-0700</code>
- *     <tr bgcolor="#eeeeff">
+ *     <tr style="background-color: rgb(238, 238, 255);">
  *         <td><code>"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"</code>
  *         <td><code>2001-07-04T12:08:56.235-07:00</code>
  *     <tr>
--- a/jdk/src/share/classes/java/text/StringCharacterIterator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/text/StringCharacterIterator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,6 +59,8 @@
 
     /**
      * Constructs an iterator with an initial index of 0.
+     *
+     * @param text the {@code String} to be iterated over
      */
     public StringCharacterIterator(String text)
     {
--- a/jdk/src/share/classes/java/time/DayOfWeek.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/DayOfWeek.java	Tue Aug 06 16:54:56 2013 -0700
@@ -61,7 +61,6 @@
  */
 package java.time;
 
-import java.time.temporal.UnsupportedTemporalTypeException;
 import static java.time.temporal.ChronoField.DAY_OF_WEEK;
 import static java.time.temporal.ChronoUnit.DAYS;
 
@@ -73,6 +72,7 @@
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
+import java.time.temporal.UnsupportedTemporalTypeException;
 import java.time.temporal.ValueRange;
 import java.time.temporal.WeekFields;
 import java.util.Locale;
@@ -339,7 +339,7 @@
         if (field == DAY_OF_WEEK) {
             return getValue();
         } else if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
--- a/jdk/src/share/classes/java/time/Duration.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/Duration.java	Tue Aug 06 16:54:56 2013 -0700
@@ -459,9 +459,9 @@
      */
     public static Duration between(Temporal startInclusive, Temporal endExclusive) {
         try {
-            return ofNanos(startInclusive.periodUntil(endExclusive, NANOS));
+            return ofNanos(startInclusive.until(endExclusive, NANOS));
         } catch (DateTimeException | ArithmeticException ex) {
-            long secs = startInclusive.periodUntil(endExclusive, SECONDS);
+            long secs = startInclusive.until(endExclusive, SECONDS);
             long nanos;
             try {
                 nanos = endExclusive.getLong(NANO_OF_SECOND) - startInclusive.getLong(NANO_OF_SECOND);
@@ -523,7 +523,7 @@
         } else if (unit == NANOS) {
             return nanos;
         } else {
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
     }
 
--- a/jdk/src/share/classes/java/time/Instant.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/Instant.java	Tue Aug 06 16:54:56 2013 -0700
@@ -69,6 +69,7 @@
 import static java.time.temporal.ChronoField.MICRO_OF_SECOND;
 import static java.time.temporal.ChronoField.MILLI_OF_SECOND;
 import static java.time.temporal.ChronoField.NANO_OF_SECOND;
+import static java.time.temporal.ChronoUnit.DAYS;
 import static java.time.temporal.ChronoUnit.NANOS;
 
 import java.io.DataInput;
@@ -418,8 +419,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this instant can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -448,6 +450,44 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code NANOS}
+     * <li>{@code MICROS}
+     * <li>{@code MILLIS}
+     * <li>{@code SECONDS}
+     * <li>{@code MINUTES}
+     * <li>{@code HOURS}
+     * <li>{@code HALF_DAYS}
+     * <li>{@code DAYS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override
+    public boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit.isTimeBased() || unit == DAYS;
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -511,7 +551,7 @@
                 case MILLI_OF_SECOND: return nanos / 1000_000;
                 case INSTANT_SECONDS: INSTANT_SECONDS.checkValidIntValue(seconds);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return range(field).checkValidIntValue(field.getFrom(this), field);
     }
@@ -548,7 +588,7 @@
                 case MILLI_OF_SECOND: return nanos / 1000_000;
                 case INSTANT_SECONDS: return seconds;
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
@@ -665,7 +705,7 @@
                 case NANO_OF_SECOND: return (newValue != nanos ? create(seconds, (int) newValue) : this);
                 case INSTANT_SECONDS: return (newValue != seconds ? create(newValue, nanos) : this);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.adjustInto(this, newValue);
     }
@@ -807,7 +847,7 @@
                 case HALF_DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY / 2));
                 case DAYS: return plusSeconds(Math.multiplyExact(amountToAdd, SECONDS_PER_DAY));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.addTo(this, amountToAdd);
     }
@@ -1053,14 +1093,14 @@
      * complete units between the two instants.
      * The {@code Temporal} passed to this method must be an {@code Instant}.
      * For example, the amount in days between two dates can be calculated
-     * using {@code startInstant.periodUntil(endInstant, SECONDS)}.
+     * using {@code startInstant.until(endInstant, SECONDS)}.
      * <p>
      * There are two equivalent ways of using this method.
      * The first is to invoke this method.
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, SECONDS);
+     *   amount = start.until(end, SECONDS);
      *   amount = SECONDS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1085,7 +1125,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endInstant, TemporalUnit unit) {
+    public long until(Temporal endInstant, TemporalUnit unit) {
         if (endInstant instanceof Instant == false) {
             Objects.requireNonNull(endInstant, "endInstant");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1103,7 +1143,7 @@
                 case HALF_DAYS: return secondsUntil(end) / (12 * SECONDS_PER_HOUR);
                 case DAYS: return secondsUntil(end) / (SECONDS_PER_DAY);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endInstant);
     }
--- a/jdk/src/share/classes/java/time/LocalDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/LocalDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -127,7 +127,7 @@
  * @since 1.8
  */
 public final class LocalDate
-        implements Temporal, TemporalAdjuster, ChronoLocalDate<LocalDate>, Serializable {
+        implements Temporal, TemporalAdjuster, ChronoLocalDate, Serializable {
 
     /**
      * The minimum supported {@code LocalDate}, '-999999999-01-01'.
@@ -466,8 +466,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this date can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -502,6 +503,41 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code DAYS}
+     * <li>{@code WEEKS}
+     * <li>{@code MONTHS}
+     * <li>{@code YEARS}
+     * <li>{@code DECADES}
+     * <li>{@code CENTURIES}
+     * <li>{@code MILLENNIA}
+     * <li>{@code ERAS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override  // override for Javadoc
+    public boolean isSupported(TemporalUnit unit) {
+        return ChronoLocalDate.super.isSupported(unit);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -538,7 +574,7 @@
                 }
                 return field.range();
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
@@ -631,7 +667,7 @@
             case YEAR: return year;
             case ERA: return (year >= 1 ? 1 : 0);
         }
-        throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+        throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
     }
 
     private long getProlepticMonth() {
@@ -988,7 +1024,7 @@
                 case YEAR: return withYear((int) newValue);
                 case ERA: return (getLong(ERA) == newValue ? this : withYear(1 - year));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.adjustInto(this, newValue);
     }
@@ -1187,7 +1223,7 @@
                 case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
                 case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.addTo(this, amountToAdd);
     }
@@ -1497,7 +1533,7 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method must be a {@code LocalDate}.
      * For example, the amount in days between two dates can be calculated
-     * using {@code startDate.periodUntil(endDate, DAYS)}.
+     * using {@code startDate.until(endDate, DAYS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two dates.
@@ -1509,7 +1545,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MONTHS);
+     *   amount = start.until(end, MONTHS);
      *   amount = MONTHS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1534,7 +1570,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endDate, TemporalUnit unit) {
+    public long until(Temporal endDate, TemporalUnit unit) {
         Objects.requireNonNull(unit, "unit");
         if (endDate instanceof LocalDate == false) {
             Objects.requireNonNull(endDate, "endDate");
@@ -1552,7 +1588,7 @@
                 case MILLENNIA: return monthsUntil(end) / 12000;
                 case ERAS: return end.getLong(ERA) - getLong(ERA);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endDate);
     }
@@ -1591,7 +1627,7 @@
      * The second is to use {@link Period#between(LocalDate, LocalDate)}:
      * <pre>
      *   // these two lines are equivalent
-     *   period = start.periodUntil(end);
+     *   period = start.until(end);
      *   period = Period.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1600,7 +1636,7 @@
      * @return the period between this date and the end date, not null
      */
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
+    public Period until(ChronoLocalDate endDate) {
         LocalDate end = LocalDate.from(endDate);
         long totalMonths = end.getProlepticMonth() - this.getProlepticMonth();  // safe
         int days = end.day - this.day;
@@ -1803,7 +1839,7 @@
      * @return the comparator value, negative if less, positive if greater
      */
     @Override  // override for Javadoc and performance
-    public int compareTo(ChronoLocalDate<?> other) {
+    public int compareTo(ChronoLocalDate other) {
         if (other instanceof LocalDate) {
             return compareTo0((LocalDate) other);
         }
@@ -1843,7 +1879,7 @@
      * @return true if this date is after the specified date
      */
     @Override  // override for Javadoc and performance
-    public boolean isAfter(ChronoLocalDate<?> other) {
+    public boolean isAfter(ChronoLocalDate other) {
         if (other instanceof LocalDate) {
             return compareTo0((LocalDate) other) > 0;
         }
@@ -1872,7 +1908,7 @@
      * @return true if this date is before the specified date
      */
     @Override  // override for Javadoc and performance
-    public boolean isBefore(ChronoLocalDate<?> other) {
+    public boolean isBefore(ChronoLocalDate other) {
         if (other instanceof LocalDate) {
             return compareTo0((LocalDate) other) < 0;
         }
@@ -1901,7 +1937,7 @@
      * @return true if this date is equal to the specified date
      */
     @Override  // override for Javadoc and performance
-    public boolean isEqual(ChronoLocalDate<?> other) {
+    public boolean isEqual(ChronoLocalDate other) {
         if (other instanceof LocalDate) {
             return compareTo0((LocalDate) other) == 0;
         }
--- a/jdk/src/share/classes/java/time/LocalDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -515,8 +515,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this date-time can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -570,6 +571,48 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code NANOS}
+     * <li>{@code MICROS}
+     * <li>{@code MILLIS}
+     * <li>{@code SECONDS}
+     * <li>{@code MINUTES}
+     * <li>{@code HOURS}
+     * <li>{@code HALF_DAYS}
+     * <li>{@code DAYS}
+     * <li>{@code WEEKS}
+     * <li>{@code MONTHS}
+     * <li>{@code YEARS}
+     * <li>{@code DECADES}
+     * <li>{@code CENTURIES}
+     * <li>{@code MILLENNIA}
+     * <li>{@code ERAS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override  // override for Javadoc
+    public boolean isSupported(TemporalUnit unit) {
+        return ChronoLocalDateTime.super.isSupported(unit);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -1570,7 +1613,7 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method must be a {@code LocalDateTime}.
      * For example, the amount in days between two date-times can be calculated
-     * using {@code startDateTime.periodUntil(endDateTime, DAYS)}.
+     * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two date-times.
@@ -1582,7 +1625,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MONTHS);
+     *   amount = start.until(end, MONTHS);
      *   amount = MONTHS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1609,18 +1652,17 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         if (endDateTime instanceof LocalDateTime == false) {
             Objects.requireNonNull(endDateTime, "endDateTime");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
         }
         LocalDateTime end = (LocalDateTime) endDateTime;
         if (unit instanceof ChronoUnit) {
-            ChronoUnit f = (ChronoUnit) unit;
-            if (f.isTimeUnit()) {
+            if (unit.isTimeBased()) {
                 long amount = date.daysUntil(end.date);
                 if (amount == 0) {
-                    return time.periodUntil(end.time, unit);
+                    return time.until(end.time, unit);
                 }
                 long timePart = end.time.toNanoOfDay() - time.toNanoOfDay();
                 if (amount > 0) {
@@ -1630,7 +1672,7 @@
                     amount++;  // safe
                     timePart -= NANOS_PER_DAY;  // safe
                 }
-                switch (f) {
+                switch ((ChronoUnit) unit) {
                     case NANOS:
                         amount = Math.multiplyExact(amount, NANOS_PER_DAY);
                         break;
@@ -1667,7 +1709,7 @@
             } else if (endDate.isBefore(date) && end.time.isAfter(time)) {
                 endDate = endDate.plusDays(1);
             }
-            return date.periodUntil(endDate, unit);
+            return date.until(endDate, unit);
         }
         return unit.between(this, endDateTime);
     }
--- a/jdk/src/share/classes/java/time/LocalTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/LocalTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -470,8 +470,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this time can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -511,6 +512,43 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code NANOS}
+     * <li>{@code MICROS}
+     * <li>{@code MILLIS}
+     * <li>{@code SECONDS}
+     * <li>{@code MINUTES}
+     * <li>{@code HOURS}
+     * <li>{@code HALF_DAYS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override  // override for Javadoc
+    public boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit.isTimeBased();
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -628,7 +666,7 @@
             case CLOCK_HOUR_OF_DAY: return (hour == 0 ? 24 : hour);
             case AMPM_OF_DAY: return hour / 12;
         }
-        throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+        throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
     }
 
     //-----------------------------------------------------------------------
@@ -803,7 +841,7 @@
                 case CLOCK_HOUR_OF_DAY: return withHour((int) (newValue == 24 ? 0 : newValue));
                 case AMPM_OF_DAY: return plusHours((newValue - (hour / 12)) * 12);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.adjustInto(this, newValue);
     }
@@ -995,8 +1033,7 @@
     @Override
     public LocalTime plus(long amountToAdd, TemporalUnit unit) {
         if (unit instanceof ChronoUnit) {
-            ChronoUnit f = (ChronoUnit) unit;
-            switch (f) {
+            switch ((ChronoUnit) unit) {
                 case NANOS: return plusNanos(amountToAdd);
                 case MICROS: return plusNanos((amountToAdd % MICROS_PER_DAY) * 1000);
                 case MILLIS: return plusNanos((amountToAdd % MILLIS_PER_DAY) * 1000_000);
@@ -1005,7 +1042,7 @@
                 case HOURS: return plusHours(amountToAdd);
                 case HALF_DAYS: return plusHours((amountToAdd % 2) * 12);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.addTo(this, amountToAdd);
     }
@@ -1295,7 +1332,7 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method must be a {@code LocalTime}.
      * For example, the amount in hours between two times can be calculated
-     * using {@code startTime.periodUntil(endTime, HOURS)}.
+     * using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two times.
@@ -1307,7 +1344,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MINUTES);
+     *   amount = start.until(end, MINUTES);
      *   amount = MINUTES.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1332,7 +1369,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endTime, TemporalUnit unit) {
+    public long until(Temporal endTime, TemporalUnit unit) {
         if (endTime instanceof LocalTime == false) {
             Objects.requireNonNull(endTime, "endTime");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1349,7 +1386,7 @@
                 case HOURS: return nanosUntil / NANOS_PER_HOUR;
                 case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endTime);
     }
--- a/jdk/src/share/classes/java/time/Month.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/Month.java	Tue Aug 06 16:54:56 2013 -0700
@@ -61,7 +61,6 @@
  */
 package java.time;
 
-import java.time.temporal.UnsupportedTemporalTypeException;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoUnit.MONTHS;
 
@@ -75,6 +74,7 @@
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
+import java.time.temporal.UnsupportedTemporalTypeException;
 import java.time.temporal.ValueRange;
 import java.util.Locale;
 
@@ -370,7 +370,7 @@
         if (field == MONTH_OF_YEAR) {
             return getValue();
         } else if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
--- a/jdk/src/share/classes/java/time/MonthDay.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/MonthDay.java	Tue Aug 06 16:54:56 2013 -0700
@@ -438,7 +438,7 @@
                 case DAY_OF_MONTH: return day;
                 case MONTH_OF_YEAR: return month;
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
--- a/jdk/src/share/classes/java/time/OffsetDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/OffsetDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -65,6 +65,7 @@
 import static java.time.temporal.ChronoField.INSTANT_SECONDS;
 import static java.time.temporal.ChronoField.NANO_OF_DAY;
 import static java.time.temporal.ChronoField.OFFSET_SECONDS;
+import static java.time.temporal.ChronoUnit.FOREVER;
 import static java.time.temporal.ChronoUnit.NANOS;
 
 import java.io.IOException;
@@ -137,25 +138,40 @@
     public static final OffsetDateTime MAX = LocalDateTime.MAX.atOffset(ZoneOffset.MIN);
 
     /**
-     * Comparator for two {@code OffsetDateTime} instances based solely on the instant.
+     * Gets a comparator that compares two {@code OffsetDateTime} instances
+     * based solely on the instant.
      * <p>
      * This method differs from the comparison in {@link #compareTo} in that it
      * only compares the underlying instant.
      *
+     * @return a comparator that compares in time-line order
+     *
      * @see #isAfter
      * @see #isBefore
      * @see #isEqual
      */
-    public static final Comparator<OffsetDateTime> INSTANT_COMPARATOR = new Comparator<OffsetDateTime>() {
-        @Override
-        public int compare(OffsetDateTime datetime1, OffsetDateTime datetime2) {
-            int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond());
-            if (cmp == 0) {
-                cmp = Long.compare(datetime1.toLocalTime().toNanoOfDay(), datetime2.toLocalTime().toNanoOfDay());
-            }
-            return cmp;
+    public static Comparator<OffsetDateTime> timeLineOrder() {
+        return OffsetDateTime::compareInstant;
+    }
+
+    /**
+     * Compares this {@code OffsetDateTime} to another date-time.
+     * The comparison is based on the instant.
+     *
+     * @param datetime1  the first date-time to compare, not null
+     * @param datetime2  the other date-time to compare to, not null
+     * @return the comparator value, negative if less, positive if greater
+     */
+    private static int compareInstant(OffsetDateTime datetime1, OffsetDateTime datetime2) {
+        if (datetime1.getOffset().equals(datetime2.getOffset())) {
+            return datetime1.toLocalDateTime().compareTo(datetime2.toLocalDateTime());
         }
-    };
+        int cmp = Long.compare(datetime1.toEpochSecond(), datetime2.toEpochSecond());
+        if (cmp == 0) {
+            cmp = datetime1.toLocalTime().getNano() - datetime2.toLocalTime().getNano();
+        }
+        return cmp;
+    }
 
     /**
      * Serialization version.
@@ -406,8 +422,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this date-time can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -459,6 +476,51 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code NANOS}
+     * <li>{@code MICROS}
+     * <li>{@code MILLIS}
+     * <li>{@code SECONDS}
+     * <li>{@code MINUTES}
+     * <li>{@code HOURS}
+     * <li>{@code HALF_DAYS}
+     * <li>{@code DAYS}
+     * <li>{@code WEEKS}
+     * <li>{@code MONTHS}
+     * <li>{@code YEARS}
+     * <li>{@code DECADES}
+     * <li>{@code CENTURIES}
+     * <li>{@code MILLENNIA}
+     * <li>{@code ERAS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override  // override for Javadoc
+    public boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit != FOREVER;
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -1528,7 +1590,7 @@
      * The start and end points are {@code this} and the specified date-time.
      * The result will be negative if the end is before the start.
      * For example, the period in days between two date-times can be calculated
-     * using {@code startDateTime.periodUntil(endDateTime, DAYS)}.
+     * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The {@code Temporal} passed to this method must be an {@code OffsetDateTime}.
      * If the offset differs between the two date-times, the specified
@@ -1544,7 +1606,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MONTHS);
+     *   amount = start.until(end, MONTHS);
      *   amount = MONTHS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1571,7 +1633,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         if (endDateTime instanceof OffsetDateTime == false) {
             Objects.requireNonNull(endDateTime, "endDateTime");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1579,7 +1641,7 @@
         if (unit instanceof ChronoUnit) {
             OffsetDateTime end = (OffsetDateTime) endDateTime;
             end = end.withOffsetSameInstant(offset);
-            return dateTime.periodUntil(end.dateTime, unit);
+            return dateTime.until(end.dateTime, unit);
         }
         return unit.between(this, endDateTime);
     }
@@ -1724,15 +1786,9 @@
      */
     @Override
     public int compareTo(OffsetDateTime other) {
-        if (getOffset().equals(other.getOffset())) {
-            return toLocalDateTime().compareTo(other.toLocalDateTime());
-        }
-        int cmp = Long.compare(toEpochSecond(), other.toEpochSecond());
+        int cmp = compareInstant(this, other);
         if (cmp == 0) {
-            cmp = toLocalTime().getNano() - other.toLocalTime().getNano();
-            if (cmp == 0) {
-                cmp = toLocalDateTime().compareTo(other.toLocalDateTime());
-            }
+            cmp = toLocalDateTime().compareTo(other.toLocalDateTime());
         }
         return cmp;
     }
--- a/jdk/src/share/classes/java/time/OffsetTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/OffsetTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -348,8 +348,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this time can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -390,6 +391,43 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code NANOS}
+     * <li>{@code MICROS}
+     * <li>{@code MILLIS}
+     * <li>{@code SECONDS}
+     * <li>{@code MINUTES}
+     * <li>{@code HOURS}
+     * <li>{@code HALF_DAYS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override  // override for Javadoc
+    public boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit.isTimeBased();
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -1084,7 +1122,7 @@
      * The start and end points are {@code this} and the specified time.
      * The result will be negative if the end is before the start.
      * For example, the period in hours between two times can be calculated
-     * using {@code startTime.periodUntil(endTime, HOURS)}.
+     * using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The {@code Temporal} passed to this method must be an {@code OffsetTime}.
      * If the offset differs between the two times, then the specified
@@ -1100,7 +1138,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MINUTES);
+     *   amount = start.until(end, MINUTES);
      *   amount = MINUTES.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -1125,7 +1163,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endTime, TemporalUnit unit) {
+    public long until(Temporal endTime, TemporalUnit unit) {
         if (endTime instanceof OffsetTime == false) {
             Objects.requireNonNull(endTime, "endTime");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1142,7 +1180,7 @@
                 case HOURS: return nanosUntil / NANOS_PER_HOUR;
                 case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endTime);
     }
--- a/jdk/src/share/classes/java/time/Period.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/Period.java	Tue Aug 06 16:54:56 2013 -0700
@@ -139,7 +139,7 @@
      * The pattern for parsing.
      */
     private final static Pattern PATTERN =
-            Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE);
+            Pattern.compile("([-+]?)P(?:([-+]?[0-9]+)Y)?(?:([-+]?[0-9]+)M)?(?:([-+]?[0-9]+)W)?(?:([-+]?[0-9]+)D)?", Pattern.CASE_INSENSITIVE);
     /**
      * The set of supported units.
      */
@@ -187,6 +187,20 @@
     }
 
     /**
+     * Obtains a {@code Period} representing a number of weeks.
+     * <p>
+     * The resulting period will be day-based, with the amount of days
+     * equal to the number of weeks multiplied by 7.
+     * The years and months units will be zero.
+     *
+     * @param weeks  the number of weeks, positive or negative
+     * @return the period, with the input weeks converted to days, not null
+     */
+    public static Period ofWeeks(int weeks) {
+        return create(0, 0, Math.multiplyExact(weeks, 7));
+    }
+
+    /**
      * Obtains a {@code Period} representing a number of days.
      * <p>
      * The resulting period will have the specified days.
@@ -257,22 +271,36 @@
      * Obtains a {@code Period} from a text string such as {@code PnYnMnD}.
      * <p>
      * This will parse the string produced by {@code toString()} which is
-     * based on the ISO-8601 period format {@code PnYnMnD}.
+     * based on the ISO-8601 period formats {@code PnYnMnD} and {@code PnW}.
      * <p>
      * The string starts with an optional sign, denoted by the ASCII negative
      * or positive symbol. If negative, the whole period is negated.
      * The ASCII letter "P" is next in upper or lower case.
-     * There are then three sections, each consisting of a number and a suffix.
-     * At least one of the three sections must be present.
-     * The sections have suffixes in ASCII of "Y", "M" and "D" for
-     * years, months and days, accepted in upper or lower case.
+     * There are then four sections, each consisting of a number and a suffix.
+     * At least one of the four sections must be present.
+     * The sections have suffixes in ASCII of "Y", "M", "W" and "D" for
+     * years, months, weeks and days, accepted in upper or lower case.
      * The suffixes must occur in order.
      * The number part of each section must consist of ASCII digits.
      * The number may be prefixed by the ASCII negative or positive symbol.
      * The number must parse to an {@code int}.
      * <p>
      * The leading plus/minus sign, and negative values for other units are
-     * not part of the ISO-8601 standard.
+     * not part of the ISO-8601 standard. In addition, ISO-8601 does not
+     * permit mixing between the {@code PnYnMnD} and {@code PnW} formats.
+     * Any week-based input is multiplied by 7 and treated as a number of days.
+     * <p>
+     * For example, the following are valid inputs:
+     * <pre>
+     *   "P2Y"             -- Period.ofYears(2)
+     *   "P3M"             -- Period.ofMonths(3)
+     *   "P4W"             -- Period.ofWeeks(4)
+     *   "P5D"             -- Period.ofDays(5)
+     *   "P1Y2M3D"         -- Period.of(1, 2, 3)
+     *   "P1Y2M3W4D"       -- Period.of(1, 2, 25)
+     *   "P-1Y2M"          -- Period.of(-1, 2, 0)
+     *   "-P1Y2M"          -- Period.of(-1, -2, 0)
+     * </pre>
      *
      * @param text  the text to parse, not null
      * @return the parsed period, not null
@@ -285,14 +313,18 @@
             int negate = ("-".equals(matcher.group(1)) ? -1 : 1);
             String yearMatch = matcher.group(2);
             String monthMatch = matcher.group(3);
-            String dayMatch = matcher.group(4);
-            if (yearMatch != null || monthMatch != null || dayMatch != null) {
+            String weekMatch = matcher.group(4);
+            String dayMatch = matcher.group(5);
+            if (yearMatch != null || monthMatch != null || dayMatch != null || weekMatch != null) {
                 try {
-                    return create(parseNumber(text, yearMatch, negate),
-                            parseNumber(text, monthMatch, negate),
-                            parseNumber(text, dayMatch, negate));
+                    int years = parseNumber(text, yearMatch, negate);
+                    int months = parseNumber(text, monthMatch, negate);
+                    int weeks = parseNumber(text, weekMatch, negate);
+                    int days = parseNumber(text, dayMatch, negate);
+                    days = Math.addExact(days, Math.multiplyExact(weeks, 7));
+                    return create(years, months, days);
                 } catch (NumberFormatException ex) {
-                    throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex);
+                    throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex);
                 }
             }
         }
@@ -307,7 +339,7 @@
         try {
             return Math.multiplyExact(val, negate);
         } catch (ArithmeticException ex) {
-            throw (DateTimeParseException) new DateTimeParseException("Text cannot be parsed to a Period", text, 0).initCause(ex);
+            throw new DateTimeParseException("Text cannot be parsed to a Period", text, 0, ex);
         }
     }
 
@@ -329,10 +361,10 @@
      * @param startDate  the start date, inclusive, not null
      * @param endDate  the end date, exclusive, not null
      * @return the period between this date and the end date, not null
-     * @see ChronoLocalDate#periodUntil(ChronoLocalDate)
+     * @see ChronoLocalDate#until(ChronoLocalDate)
      */
     public static Period between(LocalDate startDate, LocalDate endDate) {
-        return startDate.periodUntil(endDate);
+        return startDate.until(endDate);
     }
 
     //-----------------------------------------------------------------------
@@ -386,7 +418,7 @@
         } else if (unit == ChronoUnit.DAYS) {
             return getDays();
         } else {
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
     }
 
--- a/jdk/src/share/classes/java/time/Year.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/Year.java	Tue Aug 06 16:54:56 2013 -0700
@@ -64,6 +64,10 @@
 import static java.time.temporal.ChronoField.ERA;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.CENTURIES;
+import static java.time.temporal.ChronoUnit.DECADES;
+import static java.time.temporal.ChronoUnit.ERAS;
+import static java.time.temporal.ChronoUnit.MILLENNIA;
 import static java.time.temporal.ChronoUnit.YEARS;
 
 import java.io.DataInput;
@@ -329,8 +333,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this year can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -358,6 +363,41 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code YEARS}
+     * <li>{@code DECADES}
+     * <li>{@code CENTURIES}
+     * <li>{@code MILLENNIA}
+     * <li>{@code ERAS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override
+    public boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS;
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -450,7 +490,7 @@
                 case YEAR: return year;
                 case ERA: return (year < 1 ? 0 : 1);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
@@ -575,7 +615,7 @@
                 case YEAR: return Year.of((int) newValue);
                 case ERA: return (getLong(ERA) == newValue ? this : Year.of(1 - year));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.adjustInto(this, newValue);
     }
@@ -664,7 +704,7 @@
                 case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
                 case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.addTo(this, amountToAdd);
     }
@@ -821,7 +861,7 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method must be a {@code Year}.
      * For example, the period in decades between two year can be calculated
-     * using {@code startYear.periodUntil(endYear, DECADES)}.
+     * using {@code startYear.until(endYear, DECADES)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two years.
@@ -833,7 +873,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, YEARS);
+     *   amount = start.until(end, YEARS);
      *   amount = YEARS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -858,7 +898,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endYear, TemporalUnit unit) {
+    public long until(Temporal endYear, TemporalUnit unit) {
         if (endYear instanceof Year == false) {
             Objects.requireNonNull(endYear, "endYear");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -873,7 +913,7 @@
                 case MILLENNIA: return yearsUntil / 1000;
                 case ERAS: return end.getLong(ERA) - getLong(ERA);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endYear);
     }
--- a/jdk/src/share/classes/java/time/YearMonth.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/YearMonth.java	Tue Aug 06 16:54:56 2013 -0700
@@ -66,7 +66,12 @@
 import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.CENTURIES;
+import static java.time.temporal.ChronoUnit.DECADES;
+import static java.time.temporal.ChronoUnit.ERAS;
+import static java.time.temporal.ChronoUnit.MILLENNIA;
 import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.YEARS;
 
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -313,8 +318,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this year-month can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -345,6 +351,42 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code MONTHS}
+     * <li>{@code YEARS}
+     * <li>{@code DECADES}
+     * <li>{@code CENTURIES}
+     * <li>{@code MILLENNIA}
+     * <li>{@code ERAS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override
+    public boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit == MONTHS || unit == YEARS || unit == DECADES || unit == CENTURIES || unit == MILLENNIA || unit == ERAS;
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -440,7 +482,7 @@
                 case YEAR: return year;
                 case ERA: return (year < 1 ? 0 : 1);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
@@ -639,7 +681,7 @@
                 case YEAR: return withYear((int) newValue);
                 case ERA: return (getLong(ERA) == newValue ? this : withYear(1 - year));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.adjustInto(this, newValue);
     }
@@ -761,7 +803,7 @@
                 case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
                 case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.addTo(this, amountToAdd);
     }
@@ -952,7 +994,7 @@
      * The result will be negative if the end is before the start.
      * The {@code Temporal} passed to this method must be a {@code YearMonth}.
      * For example, the period in years between two year-months can be calculated
-     * using {@code startYearMonth.periodUntil(endYearMonth, YEARS)}.
+     * using {@code startYearMonth.until(endYearMonth, YEARS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two year-months.
@@ -964,7 +1006,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MONTHS);
+     *   amount = start.until(end, MONTHS);
      *   amount = MONTHS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -989,7 +1031,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endYearMonth, TemporalUnit unit) {
+    public long until(Temporal endYearMonth, TemporalUnit unit) {
         if (endYearMonth instanceof YearMonth == false) {
             Objects.requireNonNull(endYearMonth, "endYearMonth");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -1005,7 +1047,7 @@
                 case MILLENNIA: return monthsUntil / 12000;
                 case ERAS: return end.getLong(ERA) - getLong(ERA);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endYearMonth);
     }
--- a/jdk/src/share/classes/java/time/ZoneId.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/ZoneId.java	Tue Aug 06 16:54:56 2013 -0700
@@ -401,6 +401,36 @@
     }
 
     /**
+     * Obtains an instance of {@code ZoneId} wrapping an offset.
+     * <p>
+     * If the prefix is "GMT", "UTC", or "UT" a {@code ZoneId}
+     * with the prefix and the non-zero offset is returned.
+     * If the prefix is empty {@code ""} the {@code ZoneOffset} is returned.
+     *
+     * @param prefix  the time-zone ID, not null
+     * @param offset  the offset, not null
+     * @return the zone ID, not null
+     * @throws IllegalArgumentException if the prefix is not one of
+     *     "GMT", "UTC", or "UT", or ""
+     */
+    public static ZoneId ofOffset(String prefix, ZoneOffset offset) {
+        Objects.requireNonNull(prefix, "prefix");
+        Objects.requireNonNull(offset, "offset");
+        if (prefix.length() == 0) {
+            return offset;
+        }
+
+        if (!prefix.equals("GMT") && !prefix.equals("UTC") && !prefix.equals("UT")) {
+             throw new IllegalArgumentException("prefix should be GMT, UTC or UT, is: " + prefix);
+        }
+
+        if (offset.getTotalSeconds() != 0) {
+            prefix = prefix.concat(offset.getId());
+        }
+        return new ZoneRegion(prefix, offset.getRules());
+    }
+
+    /**
      * Parses the ID, taking a flag to indicate whether {@code ZoneRulesException}
      * should be thrown or not, used in deserialization.
      *
@@ -433,7 +463,7 @@
     private static ZoneId ofWithPrefix(String zoneId, int prefixLength, boolean checkAvailable) {
         String prefix = zoneId.substring(0, prefixLength);
         if (zoneId.length() == prefixLength) {
-            return ZoneRegion.ofPrefixedOffset(prefix, ZoneOffset.UTC);
+            return ofOffset(prefix, ZoneOffset.UTC);
         }
         if (zoneId.charAt(prefixLength) != '+' && zoneId.charAt(prefixLength) != '-') {
             return ZoneRegion.ofId(zoneId, checkAvailable);  // drop through to ZoneRulesProvider
@@ -441,9 +471,9 @@
         try {
             ZoneOffset offset = ZoneOffset.of(zoneId.substring(prefixLength));
             if (offset == ZoneOffset.UTC) {
-                return ZoneRegion.ofPrefixedOffset(prefix, offset);
+                return ofOffset(prefix, offset);
             }
-            return ZoneRegion.ofPrefixedOffset(prefix + offset.toString(), offset);
+            return ofOffset(prefix, offset);
         } catch (DateTimeException ex) {
             throw new DateTimeException("Invalid ID for offset-based ZoneId: " + zoneId, ex);
         }
--- a/jdk/src/share/classes/java/time/ZoneOffset.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/ZoneOffset.java	Tue Aug 06 16:54:56 2013 -0700
@@ -61,7 +61,6 @@
  */
 package java.time;
 
-import java.time.temporal.UnsupportedTemporalTypeException;
 import static java.time.LocalTime.MINUTES_PER_HOUR;
 import static java.time.LocalTime.SECONDS_PER_HOUR;
 import static java.time.LocalTime.SECONDS_PER_MINUTE;
@@ -79,6 +78,7 @@
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
+import java.time.temporal.UnsupportedTemporalTypeException;
 import java.time.temporal.ValueRange;
 import java.time.zone.ZoneRules;
 import java.util.Objects;
@@ -581,7 +581,7 @@
         if (field == OFFSET_SECONDS) {
             return totalSeconds;
         } else if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return range(field).checkValidIntValue(getLong(field), field);
     }
@@ -613,7 +613,7 @@
         if (field == OFFSET_SECONDS) {
             return totalSeconds;
         } else if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
--- a/jdk/src/share/classes/java/time/ZoneRegion.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/ZoneRegion.java	Tue Aug 06 16:54:56 2013 -0700
@@ -66,7 +66,6 @@
 import java.time.zone.ZoneRulesException;
 import java.time.zone.ZoneRulesProvider;
 import java.util.Objects;
-import java.util.regex.Pattern;
 
 /**
  * A geographical region where the same time-zone rules apply.
@@ -153,19 +152,6 @@
         }
     }
 
-    /**
-     * Obtains an instance of {@code ZoneId} wrapping an offset.
-     * <p>
-     * For example, zone IDs like 'UTC', 'GMT', 'UT' and 'UTC+01:30' will be setup here.
-     *
-     * @param zoneId  the time-zone ID, not null
-     * @param offset  the offset, not null
-     * @return the zone ID, not null
-     */
-    static ZoneRegion ofPrefixedOffset(String zoneId, ZoneOffset offset) {
-        return new ZoneRegion(zoneId, offset.getRules());
-    }
-
     //-------------------------------------------------------------------------
     /**
      * Constructor.
--- a/jdk/src/share/classes/java/time/ZonedDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/ZonedDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -642,8 +642,9 @@
      * Checks if the specified field is supported.
      * <p>
      * This checks if this date-time can be queried for the specified field.
-     * If false, then calling the {@link #range(TemporalField) range} and
-     * {@link #get(TemporalField) get} methods will throw an exception.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
      * <p>
      * If the field is a {@link ChronoField} then the query is implemented here.
      * The supported fields are:
@@ -695,6 +696,48 @@
     }
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * If the unit is a {@link ChronoUnit} then the query is implemented here.
+     * The supported units are:
+     * <ul>
+     * <li>{@code NANOS}
+     * <li>{@code MICROS}
+     * <li>{@code MILLIS}
+     * <li>{@code SECONDS}
+     * <li>{@code MINUTES}
+     * <li>{@code HOURS}
+     * <li>{@code HALF_DAYS}
+     * <li>{@code DAYS}
+     * <li>{@code WEEKS}
+     * <li>{@code MONTHS}
+     * <li>{@code YEARS}
+     * <li>{@code DECADES}
+     * <li>{@code CENTURIES}
+     * <li>{@code MILLENNIA}
+     * <li>{@code ERAS}
+     * </ul>
+     * All other {@code ChronoUnit} instances will return false.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override  // override for Javadoc
+    public boolean isSupported(TemporalUnit unit) {
+        return ChronoZonedDateTime.super.isSupported(unit);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Gets the range of valid values for the specified field.
      * <p>
      * The range object expresses the minimum and maximum valid values for a field.
@@ -1540,8 +1583,7 @@
     @Override
     public ZonedDateTime plus(long amountToAdd, TemporalUnit unit) {
         if (unit instanceof ChronoUnit) {
-            ChronoUnit u = (ChronoUnit) unit;
-            if (u.isDateUnit()) {
+            if (unit.isDateBased()) {
                 return resolveLocal(dateTime.plus(amountToAdd, unit));
             } else {
                 return resolveInstant(dateTime.plus(amountToAdd, unit));
@@ -1990,7 +2032,7 @@
      * The start and end points are {@code this} and the specified date-time.
      * The result will be negative if the end is before the start.
      * For example, the period in days between two date-times can be calculated
-     * using {@code startDateTime.periodUntil(endDateTime, DAYS)}.
+     * using {@code startDateTime.until(endDateTime, DAYS)}.
      * <p>
      * The {@code Temporal} passed to this method must be a {@code ZonedDateTime}.
      * If the time-zone differs between the two zoned date-times, the specified
@@ -2006,7 +2048,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MONTHS);
+     *   amount = start.until(end, MONTHS);
      *   amount = MONTHS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -2047,7 +2089,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         if (endDateTime instanceof ZonedDateTime == false) {
             Objects.requireNonNull(endDateTime, "endDateTime");
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
@@ -2055,11 +2097,10 @@
         if (unit instanceof ChronoUnit) {
             ZonedDateTime end = (ZonedDateTime) endDateTime;
             end = end.withZoneSameInstant(zone);
-            ChronoUnit u = (ChronoUnit) unit;
-            if (u.isDateUnit()) {
-                return dateTime.periodUntil(end.dateTime, unit);
+            if (unit.isDateBased()) {
+                return dateTime.until(end.dateTime, unit);
             } else {
-                return toOffsetDateTime().periodUntil(end.toOffsetDateTime(), unit);
+                return toOffsetDateTime().until(end.toOffsetDateTime(), unit);
             }
         }
         return unit.between(this, endDateTime);
--- a/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoDateImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -67,6 +67,8 @@
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalAmount;
+import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalUnit;
 import java.time.temporal.UnsupportedTemporalTypeException;
 import java.time.temporal.ValueRange;
@@ -96,12 +98,12 @@
  *        // Enumerate the list of available calendars and print today for each
  *        Set&lt;Chronology&gt; chronos = Chronology.getAvailableChronologies();
  *        for (Chronology chrono : chronos) {
- *            ChronoLocalDate&lt;?&gt; date = chrono.dateNow();
+ *            ChronoLocalDate date = chrono.dateNow();
  *            System.out.printf("   %20s: %s%n", chrono.getID(), date.toString());
  *        }
  *
  *        // Print the Hijrah date and calendar
- *        ChronoLocalDate&lt;?&gt; date = Chronology.of("Hijrah").dateNow();
+ *        ChronoLocalDate date = Chronology.of("Hijrah").dateNow();
  *        int day = date.get(ChronoField.DAY_OF_MONTH);
  *        int dow = date.get(ChronoField.DAY_OF_WEEK);
  *        int month = date.get(ChronoField.MONTH_OF_YEAR);
@@ -110,10 +112,10 @@
  *                dow, day, month, year);
 
  *        // Print today's date and the last day of the year
- *        ChronoLocalDate&lt;?&gt; now1 = Chronology.of("Hijrah").dateNow();
- *        ChronoLocalDate&lt;?&gt; first = now1.with(ChronoField.DAY_OF_MONTH, 1)
+ *        ChronoLocalDate now1 = Chronology.of("Hijrah").dateNow();
+ *        ChronoLocalDate first = now1.with(ChronoField.DAY_OF_MONTH, 1)
  *                .with(ChronoField.MONTH_OF_YEAR, 1);
- *        ChronoLocalDate&lt;?&gt; last = first.plus(1, ChronoUnit.YEARS)
+ *        ChronoLocalDate last = first.plus(1, ChronoUnit.YEARS)
  *                .minus(1, ChronoUnit.DAYS);
  *        System.out.printf("  Today is %s: start: %s; end: %s%n", last.getChronology().getID(),
  *                first, last);
@@ -138,8 +140,8 @@
  * @param <D> the ChronoLocalDate of this date-time
  * @since 1.8
  */
-abstract class ChronoDateImpl<D extends ChronoLocalDate<D>>
-        implements ChronoLocalDate<D>, Temporal, TemporalAdjuster, Serializable {
+abstract class ChronoDateImpl<D extends ChronoLocalDate>
+        implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable {
 
     /**
      * Serialization version.
@@ -147,13 +149,52 @@
     private static final long serialVersionUID = 6282433883239719096L;
 
     /**
+     * Casts the {@code Temporal} to {@code ChronoLocalDate} ensuring it bas the specified chronology.
+     *
+     * @param chrono  the chronology to check for, not null
+     * @param temporal  a date-time to cast, not null
+     * @return the date-time checked and cast to {@code ChronoLocalDate}, not null
+     * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate
+     *  or the chronology is not equal this Chronology
+     */
+    static <D extends ChronoLocalDate> D ensureValid(Chronology chrono, Temporal temporal) {
+        @SuppressWarnings("unchecked")
+        D other = (D) temporal;
+        if (chrono.equals(other.getChronology()) == false) {
+            throw new ClassCastException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + other.getChronology().getId());
+        }
+        return other;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Creates an instance.
      */
     ChronoDateImpl() {
     }
 
+    @Override
+    @SuppressWarnings("unchecked")
+    public D with(TemporalAdjuster adjuster) {
+        return (D) ChronoLocalDate.super.with(adjuster);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D with(TemporalField field, long value) {
+        return (D) ChronoLocalDate.super.with(field, value);
+    }
+
     //-----------------------------------------------------------------------
     @Override
+    @SuppressWarnings("unchecked")
+    public D plus(TemporalAmount amount) {
+        return (D) ChronoLocalDate.super.plus(amount);
+    }
+
+    //-----------------------------------------------------------------------
+    @Override
+    @SuppressWarnings("unchecked")
     public D plus(long amountToAdd, TemporalUnit unit) {
         if (unit instanceof ChronoUnit) {
             ChronoUnit f = (ChronoUnit) unit;
@@ -167,9 +208,21 @@
                 case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
                 case ERAS: return with(ERA, Math.addExact(getLong(ERA), amountToAdd));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return ChronoLocalDate.super.plus(amountToAdd, unit);
+        return (D) ChronoLocalDate.super.plus(amountToAdd, unit);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D minus(TemporalAmount amount) {
+        return (D) ChronoLocalDate.super.minus(amount);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public D minus(long amountToSubtract, TemporalUnit unit) {
+        return (D) ChronoLocalDate.super.minus(amountToSubtract, unit);
     }
 
     //-----------------------------------------------------------------------
@@ -254,6 +307,7 @@
      * @return a date based on this one with the years subtracted, not null
      * @throws DateTimeException if the result exceeds the supported date range
      */
+    @SuppressWarnings("unchecked")
     D minusYears(long yearsToSubtract) {
         return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract));
     }
@@ -274,6 +328,7 @@
      * @return a date based on this one with the months subtracted, not null
      * @throws DateTimeException if the result exceeds the supported date range
      */
+    @SuppressWarnings("unchecked")
     D minusMonths(long monthsToSubtract) {
         return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract));
     }
@@ -293,6 +348,7 @@
      * @return a date based on this one with the weeks subtracted, not null
      * @throws DateTimeException if the result exceeds the supported date range
      */
+    @SuppressWarnings("unchecked")
     D minusWeeks(long weeksToSubtract) {
         return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract));
     }
@@ -310,6 +366,7 @@
      * @return a date based on this one with the days subtracted, not null
      * @throws DateTimeException if the result exceeds the supported date range
      */
+    @SuppressWarnings("unchecked")
     D minusDays(long daysToSubtract) {
         return (daysToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract));
     }
@@ -321,13 +378,13 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         Objects.requireNonNull(endDateTime, "endDateTime");
         Objects.requireNonNull(unit, "unit");
         if (endDateTime instanceof ChronoLocalDate == false) {
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
         }
-        ChronoLocalDate<?> end = (ChronoLocalDate<?>) endDateTime;
+        ChronoLocalDate end = (ChronoLocalDate) endDateTime;
         if (getChronology().equals(end.getChronology()) == false) {
             throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
         }
@@ -342,16 +399,16 @@
                 case MILLENNIA: return monthsUntil(end) / 12000;
                 case ERAS: return end.getLong(ERA) - getLong(ERA);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.between(this, endDateTime);
     }
 
-    private long daysUntil(ChronoLocalDate<?> end) {
+    private long daysUntil(ChronoLocalDate end) {
         return end.toEpochDay() - toEpochDay();  // no overflow
     }
 
-    private long monthsUntil(ChronoLocalDate<?> end) {
+    private long monthsUntil(ChronoLocalDate end) {
         ValueRange range = getChronology().range(MONTH_OF_YEAR);
         if (range.getMaximum() != 12) {
             throw new IllegalStateException("ChronoDateImpl only supports Chronologies with 12 months per year");
@@ -367,7 +424,7 @@
             return true;
         }
         if (obj instanceof ChronoLocalDate) {
-            return compareTo((ChronoLocalDate<?>) obj) == 0;
+            return compareTo((ChronoLocalDate) obj) == 0;
         }
         return false;
     }
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -242,11 +242,10 @@
  * Additional calendar systems may be added to the system.
  * See {@link Chronology} for more details.
  *
- * @param <D> the concrete type for the date
  * @since 1.8
  */
-public interface ChronoLocalDate<D extends ChronoLocalDate<D>>
-        extends Temporal, TemporalAdjuster, Comparable<ChronoLocalDate<?>> {
+public interface ChronoLocalDate
+        extends Temporal, TemporalAdjuster, Comparable<ChronoLocalDate> {
 
     /**
      * Gets a comparator that compares {@code ChronoLocalDate} in
@@ -263,7 +262,7 @@
      * @see #isBefore
      * @see #isEqual
      */
-    static Comparator<ChronoLocalDate<?>> timeLineOrder() {
+    static Comparator<ChronoLocalDate> timeLineOrder() {
         return Chronology.DATE_ORDER;
     }
 
@@ -289,9 +288,9 @@
      * @throws DateTimeException if unable to convert to a {@code ChronoLocalDate}
      * @see Chronology#date(TemporalAccessor)
      */
-    static ChronoLocalDate<?> from(TemporalAccessor temporal) {
+    static ChronoLocalDate from(TemporalAccessor temporal) {
         if (temporal instanceof ChronoLocalDate) {
-            return (ChronoLocalDate<?>) temporal;
+            return (ChronoLocalDate) temporal;
         }
         Chronology chrono = temporal.query(TemporalQuery.chronology());
         if (chrono == null) {
@@ -367,6 +366,25 @@
         return (isLeapYear() ? 366 : 365);
     }
 
+    /**
+     * Checks if the specified field is supported.
+     * <p>
+     * This checks if the specified field can be queried on this date.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
+     * <p>
+     * The set of supported fields is defined by the chronology and normally includes
+     * all {@code ChronoField} date fields.
+     * <p>
+     * If the field is not a {@code ChronoField}, then the result of this method
+     * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
+     * passing {@code this} as the argument.
+     * Whether the field is supported is determined by the field.
+     *
+     * @param field  the field to check, null returns false
+     * @return true if the field can be queried, false if not
+     */
     @Override
     default boolean isSupported(TemporalField field) {
         if (field instanceof ChronoField) {
@@ -375,6 +393,32 @@
         return field != null && field.isSupportedBy(this);
     }
 
+    /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * 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>
+     * The set of supported units is defined by the chronology and normally includes
+     * all {@code ChronoUnit} date units except {@code FOREVER}.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override
+    default boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit.isDateBased();
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
     //-----------------------------------------------------------------------
     // override for covariant return type
     /**
@@ -383,8 +427,8 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    default D with(TemporalAdjuster adjuster) {
-        return (D) getChronology().ensureChronoLocalDate(Temporal.super.with(adjuster));
+    default ChronoLocalDate with(TemporalAdjuster adjuster) {
+        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
     }
 
     /**
@@ -394,11 +438,11 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    default D with(TemporalField field, long newValue) {
+    default ChronoLocalDate with(TemporalField field, long newValue) {
         if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
-        return (D) getChronology().ensureChronoLocalDate(field.adjustInto(this, newValue));
+        return ChronoDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
     }
 
     /**
@@ -407,8 +451,8 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    default D plus(TemporalAmount amount) {
-        return (D) getChronology().ensureChronoLocalDate(Temporal.super.plus(amount));
+    default ChronoLocalDate plus(TemporalAmount amount) {
+        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
     }
 
     /**
@@ -417,11 +461,11 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    default D plus(long amountToAdd, TemporalUnit unit) {
+    default ChronoLocalDate plus(long amountToAdd, TemporalUnit unit) {
         if (unit instanceof ChronoUnit) {
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return (D) getChronology().ensureChronoLocalDate(unit.addTo(this, amountToAdd));
+        return ChronoDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd));
     }
 
     /**
@@ -430,8 +474,8 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    default D minus(TemporalAmount amount) {
-        return (D) getChronology().ensureChronoLocalDate(Temporal.super.minus(amount));
+    default ChronoLocalDate minus(TemporalAmount amount) {
+        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
     }
 
     /**
@@ -441,8 +485,8 @@
      * @throws ArithmeticException {@inheritDoc}
      */
     @Override
-    default D minus(long amountToSubtract, TemporalUnit unit) {
-        return (D) getChronology().ensureChronoLocalDate(Temporal.super.minus(amountToSubtract, unit));
+    default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) {
+        return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
     }
 
     //-----------------------------------------------------------------------
@@ -522,14 +566,14 @@
      * The calculation returns a whole number, representing the number of
      * complete units between the two dates.
      * For example, the amount in days between two dates can be calculated
-     * using {@code startDate.periodUntil(endDate, DAYS)}.
+     * using {@code startDate.until(endDate, DAYS)}.
      * <p>
      * There are two equivalent ways of using this method.
      * The first is to invoke this method.
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   amount = start.periodUntil(end, MONTHS);
+     *   amount = start.until(end, MONTHS);
      *   amount = MONTHS.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -555,7 +599,7 @@
      * @throws ArithmeticException if numeric overflow occurs
      */
     @Override  // override for Javadoc
-    long periodUntil(Temporal endDate, TemporalUnit unit);
+    long until(Temporal endDate, TemporalUnit unit);
 
     /**
      * Calculates the period between this date and another date as a {@code Period}.
@@ -575,7 +619,7 @@
      * @throws DateTimeException if the period cannot be calculated
      * @throws ArithmeticException if numeric overflow occurs
      */
-    Period periodUntil(ChronoLocalDate<?> endDate);
+    Period until(ChronoLocalDate endDate);
 
     /**
      * Formats this date using the specified formatter.
@@ -606,8 +650,9 @@
      * @param localTime  the local time to use, not null
      * @return the local date-time formed from this date and the specified time, not null
      */
-    default ChronoLocalDateTime<D> atTime(LocalTime localTime) {
-        return (ChronoLocalDateTime<D>)ChronoLocalDateTimeImpl.of(this, localTime);
+    @SuppressWarnings("unchecked")
+    default ChronoLocalDateTime<?> atTime(LocalTime localTime) {
+        return ChronoLocalDateTimeImpl.of(this, localTime);
     }
 
     //-----------------------------------------------------------------------
@@ -656,7 +701,7 @@
      * @return the comparator value, negative if less, positive if greater
      */
     @Override
-    default int compareTo(ChronoLocalDate<?> other) {
+    default int compareTo(ChronoLocalDate other) {
         int cmp = Long.compare(toEpochDay(), other.toEpochDay());
         if (cmp == 0) {
             cmp = getChronology().compareTo(other.getChronology());
@@ -678,7 +723,7 @@
      * @param other  the other date to compare to, not null
      * @return true if this is after the specified date
      */
-    default boolean isAfter(ChronoLocalDate<?> other) {
+    default boolean isAfter(ChronoLocalDate other) {
         return this.toEpochDay() > other.toEpochDay();
     }
 
@@ -696,7 +741,7 @@
      * @param other  the other date to compare to, not null
      * @return true if this is before the specified date
      */
-    default boolean isBefore(ChronoLocalDate<?> other) {
+    default boolean isBefore(ChronoLocalDate other) {
         return this.toEpochDay() < other.toEpochDay();
     }
 
@@ -714,7 +759,7 @@
      * @param other  the other date to compare to, not null
      * @return true if the underlying date is equal to the specified date
      */
-    default boolean isEqual(ChronoLocalDate<?> other) {
+    default boolean isEqual(ChronoLocalDate other) {
         return this.toEpochDay() == other.toEpochDay();
     }
 
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -63,6 +63,7 @@
 
 import static java.time.temporal.ChronoField.EPOCH_DAY;
 import static java.time.temporal.ChronoField.NANO_OF_DAY;
+import static java.time.temporal.ChronoUnit.FOREVER;
 import static java.time.temporal.ChronoUnit.NANOS;
 
 import java.time.DateTimeException;
@@ -73,6 +74,7 @@
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoField;
+import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalAdjuster;
@@ -114,7 +116,7 @@
  * @param <D> the concrete type for the date of this date-time
  * @since 1.8
  */
-public interface ChronoLocalDateTime<D extends ChronoLocalDate<D>>
+public interface ChronoLocalDateTime<D extends ChronoLocalDate>
         extends Temporal, TemporalAdjuster, Comparable<ChronoLocalDateTime<?>> {
 
     /**
@@ -191,9 +193,54 @@
      */
     LocalTime toLocalTime();
 
-    @Override   // Override to provide javadoc
+    /**
+     * Checks if the specified field is supported.
+     * <p>
+     * This checks if the specified field can be queried on this date-time.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
+     * <p>
+     * The set of supported fields is defined by the chronology and normally includes
+     * all {@code ChronoField} date and time fields.
+     * <p>
+     * If the field is not a {@code ChronoField}, then the result of this method
+     * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
+     * passing {@code this} as the argument.
+     * Whether the field is supported is determined by the field.
+     *
+     * @param field  the field to check, null returns false
+     * @return true if the field can be queried, false if not
+     */
+    @Override
     boolean isSupported(TemporalField field);
 
+    /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to or subtracted from this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * The set of supported units is defined by the chronology and normally includes
+     * all {@code ChronoUnit} units except {@code FOREVER}.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override
+    default boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit != FOREVER;
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
     //-----------------------------------------------------------------------
     // override for covariant return type
     /**
@@ -203,7 +250,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> with(TemporalAdjuster adjuster) {
-        return (ChronoLocalDateTime<D>)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.with(adjuster)));
+        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster));
     }
 
     /**
@@ -221,7 +268,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> plus(TemporalAmount amount) {
-        return (ChronoLocalDateTime<D>)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.plus(amount)));
+        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount));
     }
 
     /**
@@ -239,7 +286,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> minus(TemporalAmount amount) {
-        return (ChronoLocalDateTime<D>)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.minus(amount)));
+        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount));
     }
 
     /**
@@ -249,7 +296,7 @@
      */
     @Override
     default ChronoLocalDateTime<D> minus(long amountToSubtract, TemporalUnit unit) {
-        return (ChronoLocalDateTime<D>)(toLocalDate().getChronology().ensureChronoLocalDateTime(Temporal.super.minus(amountToSubtract, unit)));
+        return ChronoLocalDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -98,7 +98,7 @@
  * @param <D> the concrete type for the date of this date-time
  * @since 1.8
  */
-final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate<D>>
+final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
         implements  ChronoLocalDateTime<D>, Temporal, TemporalAdjuster, Serializable {
 
     /**
@@ -171,9 +171,27 @@
      * @param time  the local time, not null
      * @return the local date-time, not null
      */
-    @SuppressWarnings("rawtypes")
-    static ChronoLocalDateTimeImpl<?> of(ChronoLocalDate<?> date, LocalTime time) {
-        return new ChronoLocalDateTimeImpl(date, time);
+    static <R extends ChronoLocalDate> ChronoLocalDateTimeImpl<R> of(R date, LocalTime time) {
+        return new ChronoLocalDateTimeImpl<>(date, time);
+    }
+
+    /**
+     * Casts the {@code Temporal} to {@code ChronoLocalDateTime} ensuring it bas the specified chronology.
+     *
+     * @param chrono  the chronology to check for, not null
+     * @param temporal   a date-time to cast, not null
+     * @return the date-time checked and cast to {@code ChronoLocalDateTime}, not null
+     * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDateTimeImpl
+     *  or the chronology is not equal this Chronology
+     */
+    static <R extends ChronoLocalDate> ChronoLocalDateTimeImpl<R> ensureValid(Chronology chrono, Temporal temporal) {
+        @SuppressWarnings("unchecked")
+        ChronoLocalDateTimeImpl<R> other = (ChronoLocalDateTimeImpl<R>) temporal;
+        if (chrono.equals(other.toLocalDate().getChronology()) == false) {
+            throw new ClassCastException("Chronology mismatch, required: " + chrono.getId()
+                    + ", actual: " + other.toLocalDate().getChronology().getId());
+        }
+        return other;
     }
 
     /**
@@ -202,7 +220,7 @@
             return this;
         }
         // Validate that the new Temporal is a ChronoLocalDate (and not something else)
-        D cd = (D) date.getChronology().ensureChronoLocalDate(newDate);
+        D cd = ChronoDateImpl.ensureValid(date.getChronology(), newDate);
         return new ChronoLocalDateTimeImpl<>(cd, newTime);
     }
 
@@ -260,13 +278,13 @@
     public ChronoLocalDateTimeImpl<D> with(TemporalAdjuster adjuster) {
         if (adjuster instanceof ChronoLocalDate) {
             // The Chronology is checked in with(date,time)
-            return with((ChronoLocalDate<D>) adjuster, time);
+            return with((ChronoLocalDate) adjuster, time);
         } else if (adjuster instanceof LocalTime) {
             return with(date, (LocalTime) adjuster);
         } else if (adjuster instanceof ChronoLocalDateTimeImpl) {
-            return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime((ChronoLocalDateTimeImpl<?>) adjuster));
+            return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), (ChronoLocalDateTimeImpl<?>) adjuster);
         }
-        return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime((ChronoLocalDateTimeImpl<?>) adjuster.adjustInto(this)));
+        return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), (ChronoLocalDateTimeImpl<?>) adjuster.adjustInto(this));
     }
 
     @Override
@@ -279,7 +297,7 @@
                 return with(date.with(field, newValue), time);
             }
         }
-        return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime(field.adjustInto(this, newValue)));
+        return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), field.adjustInto(this, newValue));
     }
 
     //-----------------------------------------------------------------------
@@ -298,7 +316,7 @@
             }
             return with(date.plus(amountToAdd, unit), time);
         }
-        return (ChronoLocalDateTimeImpl<D>)(date.getChronology().ensureChronoLocalDateTime(unit.addTo(this, amountToAdd)));
+        return ChronoLocalDateTimeImpl.ensureValid(date.getChronology(), unit.addTo(this, amountToAdd));
     }
 
     private ChronoLocalDateTimeImpl<D> plusDays(long days) {
@@ -322,7 +340,7 @@
     }
 
     //-----------------------------------------------------------------------
-    private ChronoLocalDateTimeImpl<D> plusWithOverflow(ChronoLocalDate<?> newDate, long hours, long minutes, long seconds, long nanos) {
+    private ChronoLocalDateTimeImpl<D> plusWithOverflow(D newDate, long hours, long minutes, long seconds, long nanos) {
         // 9223372036854775808 long, 2147483648 int
         if ((hours | minutes | seconds | nanos) == 0) {
             return with(newDate, time);
@@ -351,7 +369,7 @@
 
     //-----------------------------------------------------------------------
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         if (endDateTime instanceof ChronoLocalDateTime == false) {
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
         }
@@ -361,10 +379,9 @@
             throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
         }
         if (unit instanceof ChronoUnit) {
-            ChronoUnit f = (ChronoUnit) unit;
-            if (f.isTimeUnit()) {
+            if (unit.isTimeBased()) {
                 long amount = end.getLong(EPOCH_DAY) - date.getLong(EPOCH_DAY);
-                switch (f) {
+                switch ((ChronoUnit) unit) {
                     case NANOS: amount = Math.multiplyExact(amount, NANOS_PER_DAY); break;
                     case MICROS: amount = Math.multiplyExact(amount, MICROS_PER_DAY); break;
                     case MILLIS: amount = Math.multiplyExact(amount, MILLIS_PER_DAY); break;
@@ -373,13 +390,13 @@
                     case HOURS: amount = Math.multiplyExact(amount, HOURS_PER_DAY); break;
                     case HALF_DAYS: amount = Math.multiplyExact(amount, 2); break;
                 }
-                return Math.addExact(amount, time.periodUntil(end.toLocalTime(), unit));
+                return Math.addExact(amount, time.until(end.toLocalTime(), unit));
             }
-            D endDate = end.toLocalDate();
+            ChronoLocalDate endDate = end.toLocalDate();
             if (end.toLocalTime().isBefore(time)) {
                 endDate = endDate.minus(1, ChronoUnit.DAYS);
             }
-            return date.periodUntil(endDate, unit);
+            return date.until(endDate, unit);
         }
         return unit.between(this, endDateTime);
     }
@@ -404,7 +421,7 @@
     }
 
     static ChronoLocalDateTime<?> readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        ChronoLocalDate<?> date = (ChronoLocalDate<?>) in.readObject();
+        ChronoLocalDate date = (ChronoLocalDate) in.readObject();
         LocalTime time = (LocalTime) in.readObject();
         return date.atTime(time);
     }
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -63,6 +63,7 @@
 
 import static java.time.temporal.ChronoField.INSTANT_SECONDS;
 import static java.time.temporal.ChronoField.OFFSET_SECONDS;
+import static java.time.temporal.ChronoUnit.FOREVER;
 import static java.time.temporal.ChronoUnit.NANOS;
 
 import java.time.DateTimeException;
@@ -73,6 +74,7 @@
 import java.time.ZonedDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoField;
+import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalAdjuster;
@@ -115,7 +117,7 @@
  * @param <D> the concrete type for the date of this date-time
  * @since 1.8
  */
-public interface ChronoZonedDateTime<D extends ChronoLocalDate<D>>
+public interface ChronoZonedDateTime<D extends ChronoLocalDate>
         extends Temporal, Comparable<ChronoZonedDateTime<?>> {
 
     /**
@@ -338,9 +340,54 @@
      */
     ChronoZonedDateTime<D> withZoneSameInstant(ZoneId zone);
 
-    @Override   // Override to provide javadoc
+    /**
+     * Checks if the specified field is supported.
+     * <p>
+     * This checks if the specified field can be queried on this date-time.
+     * If false, then calling the {@link #range(TemporalField) range},
+     * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}
+     * methods will throw an exception.
+     * <p>
+     * The set of supported fields is defined by the chronology and normally includes
+     * all {@code ChronoField} fields.
+     * <p>
+     * If the field is not a {@code ChronoField}, then the result of this method
+     * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
+     * passing {@code this} as the argument.
+     * Whether the field is supported is determined by the field.
+     *
+     * @param field  the field to check, null returns false
+     * @return true if the field can be queried, false if not
+     */
+    @Override
     boolean isSupported(TemporalField field);
 
+    /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to or subtracted from this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     * <p>
+     * The set of supported units is defined by the chronology and normally includes
+     * all {@code ChronoUnit} units except {@code FOREVER}.
+     * <p>
+     * If the unit is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * Whether the unit is supported is determined by the unit.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    @Override
+    default boolean isSupported(TemporalUnit unit) {
+        if (unit instanceof ChronoUnit) {
+            return unit != FOREVER;
+        }
+        return unit != null && unit.isSupportedBy(this);
+    }
+
     //-----------------------------------------------------------------------
     // override for covariant return type
     /**
@@ -350,7 +397,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> with(TemporalAdjuster adjuster) {
-        return (ChronoZonedDateTime<D>)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.with(adjuster)));
+        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.with(adjuster));
     }
 
     /**
@@ -368,7 +415,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> plus(TemporalAmount amount) {
-        return (ChronoZonedDateTime<D>)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.plus(amount)));
+        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.plus(amount));
     }
 
     /**
@@ -386,7 +433,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> minus(TemporalAmount amount) {
-        return (ChronoZonedDateTime<D>)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.minus(amount)));
+        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amount));
     }
 
     /**
@@ -396,7 +443,7 @@
      */
     @Override
     default ChronoZonedDateTime<D> minus(long amountToSubtract, TemporalUnit unit) {
-        return (ChronoZonedDateTime<D>)(toLocalDate().getChronology().ensureChronoZonedDateTime(Temporal.super.minus(amountToSubtract, unit)));
+        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), Temporal.super.minus(amountToSubtract, unit));
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ChronoZonedDateTimeImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -101,7 +101,7 @@
  * @param <D> the concrete type for the date of this date-time
  * @since 1.8
  */
-final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate<D>>
+final class ChronoZonedDateTimeImpl<D extends ChronoLocalDate>
         implements ChronoZonedDateTime<D>, Serializable {
 
     /**
@@ -131,7 +131,7 @@
      * @param preferredOffset  the zone offset, null if no preference
      * @return the zoned date-time, not null
      */
-    static <R extends ChronoLocalDate<R>> ChronoZonedDateTime<R> ofBest(
+    static <R extends ChronoLocalDate> ChronoZonedDateTime<R> ofBest(
             ChronoLocalDateTimeImpl<R> localDateTime, ZoneId zone, ZoneOffset preferredOffset) {
         Objects.requireNonNull(localDateTime, "localDateTime");
         Objects.requireNonNull(zone, "zone");
@@ -167,14 +167,13 @@
      * @param zone  the zone identifier, not null
      * @return the zoned date-time, not null
      */
-    @SuppressWarnings("rawtypes")
     static ChronoZonedDateTimeImpl<?> ofInstant(Chronology chrono, Instant instant, ZoneId zone) {
         ZoneRules rules = zone.getRules();
         ZoneOffset offset = rules.getOffset(instant);
         Objects.requireNonNull(offset, "offset");  // protect against bad ZoneRules
         LocalDateTime ldt = LocalDateTime.ofEpochSecond(instant.getEpochSecond(), instant.getNano(), offset);
-        ChronoLocalDateTimeImpl<?> cldt = (ChronoLocalDateTimeImpl<?>) chrono.localDateTime(ldt);
-        return new ChronoZonedDateTimeImpl(cldt, offset, zone);
+        ChronoLocalDateTimeImpl<?> cldt = (ChronoLocalDateTimeImpl<?>)chrono.localDateTime(ldt);
+        return new ChronoZonedDateTimeImpl<>(cldt, offset, zone);
     }
 
     /**
@@ -184,10 +183,30 @@
      * @param zone  the time-zone to use, validated not null
      * @return the zoned date-time, validated not null
      */
+    @SuppressWarnings("unchecked")
     private ChronoZonedDateTimeImpl<D> create(Instant instant, ZoneId zone) {
         return (ChronoZonedDateTimeImpl<D>)ofInstant(toLocalDate().getChronology(), instant, zone);
     }
 
+    /**
+     * Casts the {@code Temporal} to {@code ChronoZonedDateTimeImpl} ensuring it bas the specified chronology.
+     *
+     * @param chrono  the chronology to check for, not null
+     * @param temporal  a date-time to cast, not null
+     * @return the date-time checked and cast to {@code ChronoZonedDateTimeImpl}, not null
+     * @throws ClassCastException if the date-time cannot be cast to ChronoZonedDateTimeImpl
+     *  or the chronology is not equal this Chronology
+     */
+    static <R extends ChronoLocalDate> ChronoZonedDateTimeImpl<R> ensureValid(Chronology chrono, Temporal temporal) {
+        @SuppressWarnings("unchecked")
+        ChronoZonedDateTimeImpl<R> other = (ChronoZonedDateTimeImpl<R>) temporal;
+        if (chrono.equals(other.toLocalDate().getChronology()) == false) {
+            throw new ClassCastException("Chronology mismatch, required: " + chrono.getId()
+                    + ", actual: " + other.toLocalDate().getChronology().getId());
+        }
+        return other;
+    }
+
     //-----------------------------------------------------------------------
     /**
      * Constructor.
@@ -271,7 +290,7 @@
             }
             return ofBest(dateTime.with(field, newValue), zone, offset);
         }
-        return (ChronoZonedDateTime<D>)(toLocalDate().getChronology().ensureChronoZonedDateTime(field.adjustInto(this, newValue)));
+        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), field.adjustInto(this, newValue));
     }
 
     //-----------------------------------------------------------------------
@@ -280,12 +299,12 @@
         if (unit instanceof ChronoUnit) {
             return with(dateTime.plus(amountToAdd, unit));
         }
-        return (ChronoZonedDateTime<D>)(toLocalDate().getChronology().ensureChronoZonedDateTime(unit.addTo(this, amountToAdd)));   /// TODO: Generics replacement Risk!
+        return ChronoZonedDateTimeImpl.ensureValid(toLocalDate().getChronology(), unit.addTo(this, amountToAdd));   /// TODO: Generics replacement Risk!
     }
 
     //-----------------------------------------------------------------------
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         if (endDateTime instanceof ChronoZonedDateTime == false) {
             throw new DateTimeException("Unable to calculate amount as objects are of two different types");
         }
@@ -296,7 +315,7 @@
         }
         if (unit instanceof ChronoUnit) {
             end = end.withZoneSameInstant(offset);
-            return dateTime.periodUntil(end.toLocalDateTime(), unit);
+            return dateTime.until(end.toLocalDateTime(), unit);
         }
         return unit.between(this, endDateTime);
     }
--- a/jdk/src/share/classes/java/time/chrono/Chronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/Chronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -74,6 +74,9 @@
 import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.WEEKS;
 import static java.time.temporal.TemporalAdjuster.nextOrSame;
 
 import java.io.DataInput;
@@ -88,14 +91,16 @@
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalTime;
+import java.time.Month;
+import java.time.Year;
 import java.time.ZoneId;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.format.ResolverStyle;
 import java.time.format.TextStyle;
 import java.time.temporal.ChronoField;
-import java.time.temporal.ChronoUnit;
 import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
 import java.time.temporal.UnsupportedTemporalTypeException;
@@ -188,8 +193,8 @@
     /**
      * ChronoLocalDate order constant.
      */
-    static final Comparator<ChronoLocalDate<?>> DATE_ORDER =
-        (Comparator<ChronoLocalDate<?>> & Serializable) (date1, date2) -> {
+    static final Comparator<ChronoLocalDate> DATE_ORDER =
+        (Comparator<ChronoLocalDate> & Serializable) (date1, date2) -> {
             return Long.compare(date1.toEpochDay(), date2.toEpochDay());
         };
     /**
@@ -482,60 +487,6 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Casts the {@code Temporal} to {@code ChronoLocalDate} with the same chronology.
-     *
-     * @param temporal  a date-time to cast, not null
-     * @return the date-time checked and cast to {@code ChronoLocalDate}, not null
-     * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDate
-     *  or the chronology is not equal this Chronology
-     */
-    ChronoLocalDate<?> ensureChronoLocalDate(Temporal temporal) {
-        @SuppressWarnings("unchecked")
-        ChronoLocalDate<?> other = (ChronoLocalDate<?>) temporal;
-        if (this.equals(other.getChronology()) == false) {
-            throw new ClassCastException("Chronology mismatch, expected: " + getId() + ", actual: " + other.getChronology().getId());
-        }
-        return other;
-    }
-
-    /**
-     * Casts the {@code Temporal} to {@code ChronoLocalDateTime} with the same chronology.
-     *
-     * @param temporal   a date-time to cast, not null
-     * @return the date-time checked and cast to {@code ChronoLocalDateTime}, not null
-     * @throws ClassCastException if the date-time cannot be cast to ChronoLocalDateTimeImpl
-     *  or the chronology is not equal this Chronology
-     */
-    ChronoLocalDateTimeImpl<?> ensureChronoLocalDateTime(Temporal temporal) {
-        @SuppressWarnings("unchecked")
-        ChronoLocalDateTimeImpl<?> other = (ChronoLocalDateTimeImpl<?>) temporal;
-        if (this.equals(other.toLocalDate().getChronology()) == false) {
-            throw new ClassCastException("Chronology mismatch, required: " + getId()
-                    + ", supplied: " + other.toLocalDate().getChronology().getId());
-        }
-        return other;
-    }
-
-    /**
-     * Casts the {@code Temporal} to {@code ChronoZonedDateTimeImpl} with the same chronology.
-     *
-     * @param temporal  a date-time to cast, not null
-     * @return the date-time checked and cast to {@code ChronoZonedDateTimeImpl}, not null
-     * @throws ClassCastException if the date-time cannot be cast to ChronoZonedDateTimeImpl
-     *  or the chronology is not equal this Chronology
-     */
-    ChronoZonedDateTimeImpl<?> ensureChronoZonedDateTime(Temporal temporal) {
-        @SuppressWarnings("unchecked")
-        ChronoZonedDateTimeImpl<?> other = (ChronoZonedDateTimeImpl<?>) temporal;
-        if (this.equals(other.toLocalDate().getChronology()) == false) {
-            throw new ClassCastException("Chronology mismatch, required: " + getId()
-                    + ", supplied: " + other.toLocalDate().getChronology().getId());
-        }
-        return other;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
      * Gets the ID of the chronology.
      * <p>
      * The ID uniquely identifies the {@code Chronology}.
@@ -574,7 +525,7 @@
      * @throws DateTimeException if unable to create the date
      * @throws ClassCastException if the {@code era} is not of the correct type for the chronology
      */
-    public ChronoLocalDate<?> date(Era era, int yearOfEra, int month, int dayOfMonth) {
+    public ChronoLocalDate date(Era era, int yearOfEra, int month, int dayOfMonth) {
         return date(prolepticYear(era, yearOfEra), month, dayOfMonth);
     }
 
@@ -588,7 +539,7 @@
      * @return the local date in this chronology, not null
      * @throws DateTimeException if unable to create the date
      */
-    public abstract ChronoLocalDate<?> date(int prolepticYear, int month, int dayOfMonth);
+    public abstract ChronoLocalDate date(int prolepticYear, int month, int dayOfMonth);
 
     /**
      * Obtains a local date in this chronology from the era, year-of-era and
@@ -601,7 +552,7 @@
      * @throws DateTimeException if unable to create the date
      * @throws ClassCastException if the {@code era} is not of the correct type for the chronology
      */
-    public ChronoLocalDate<?> dateYearDay(Era era, int yearOfEra, int dayOfYear) {
+    public ChronoLocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) {
         return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear);
     }
 
@@ -614,7 +565,7 @@
      * @return the local date in this chronology, not null
      * @throws DateTimeException if unable to create the date
      */
-    public abstract ChronoLocalDate<?> dateYearDay(int prolepticYear, int dayOfYear);
+    public abstract ChronoLocalDate dateYearDay(int prolepticYear, int dayOfYear);
 
     /**
      * Obtains a local date in this chronology from the epoch-day.
@@ -626,7 +577,7 @@
      * @return the local date in this chronology, not null
      * @throws DateTimeException if unable to create the date
      */
-    public abstract ChronoLocalDate<?> dateEpochDay(long epochDay);
+    public abstract ChronoLocalDate dateEpochDay(long epochDay);
 
     //-----------------------------------------------------------------------
     /**
@@ -643,7 +594,7 @@
      * @return the current local date using the system clock and default time-zone, not null
      * @throws DateTimeException if unable to create the date
      */
-    public ChronoLocalDate<?> dateNow() {
+    public ChronoLocalDate dateNow() {
         return dateNow(Clock.systemDefaultZone());
     }
 
@@ -660,7 +611,7 @@
      * @return the current local date using the system clock, not null
      * @throws DateTimeException if unable to create the date
      */
-    public ChronoLocalDate<?> dateNow(ZoneId zone) {
+    public ChronoLocalDate dateNow(ZoneId zone) {
         return dateNow(Clock.system(zone));
     }
 
@@ -675,7 +626,7 @@
      * @return the current local date, not null
      * @throws DateTimeException if unable to create the date
      */
-    public ChronoLocalDate<?> dateNow(Clock clock) {
+    public ChronoLocalDate dateNow(Clock clock) {
         Objects.requireNonNull(clock, "clock");
         return date(LocalDate.now(clock));
     }
@@ -699,7 +650,7 @@
      * @throws DateTimeException if unable to create the date
      * @see ChronoLocalDate#from(TemporalAccessor)
      */
-    public abstract ChronoLocalDate<?> date(TemporalAccessor temporal);
+    public abstract ChronoLocalDate date(TemporalAccessor temporal);
 
     /**
      * Obtains a local date-time in this chronology from another temporal object.
@@ -722,7 +673,7 @@
      * @throws DateTimeException if unable to create the date-time
      * @see ChronoLocalDateTime#from(TemporalAccessor)
      */
-    public ChronoLocalDateTime<?> localDateTime(TemporalAccessor temporal) {
+    public ChronoLocalDateTime<? extends ChronoLocalDate> localDateTime(TemporalAccessor temporal) {
         try {
             return date(temporal).atTime(LocalTime.from(temporal));
         } catch (DateTimeException ex) {
@@ -754,7 +705,7 @@
      * @throws DateTimeException if unable to create the date-time
      * @see ChronoZonedDateTime#from(TemporalAccessor)
      */
-    public ChronoZonedDateTime<?> zonedDateTime(TemporalAccessor temporal) {
+    public ChronoZonedDateTime<? extends ChronoLocalDate> zonedDateTime(TemporalAccessor temporal) {
         try {
             ZoneId zone = ZoneId.from(temporal);
             try {
@@ -762,8 +713,7 @@
                 return zonedDateTime(instant, zone);
 
             } catch (DateTimeException ex1) {
-                @SuppressWarnings("rawtypes")
-                ChronoLocalDateTimeImpl cldt = ensureChronoLocalDateTime(localDateTime(temporal));
+                ChronoLocalDateTimeImpl<?> cldt = ChronoLocalDateTimeImpl.ensureValid(this, localDateTime(temporal));
                 return ChronoZonedDateTimeImpl.ofBest(cldt, zone, null);
             }
         } catch (DateTimeException ex) {
@@ -781,7 +731,7 @@
      * @return the zoned date-time, not null
      * @throws DateTimeException if the result exceeds the supported range
      */
-    public ChronoZonedDateTime<?> zonedDateTime(Instant instant, ZoneId zone) {
+    public ChronoZonedDateTime<? extends ChronoLocalDate> zonedDateTime(Instant instant, ZoneId zone) {
         return ChronoZonedDateTimeImpl.ofInstant(this, instant, zone);
     }
 
@@ -929,11 +879,82 @@
      * As such, {@code ChronoField} date fields are resolved here in the
      * context of a specific chronology.
      * <p>
+     * {@code ChronoField} instances are resolved by this method, which may
+     * be overridden in subclasses.
+     * <ul>
+     * <li>{@code EPOCH_DAY} - If present, this is converted to a date and
+     *  all other date fields are then cross-checked against the date.
+     * <li>{@code PROLEPTIC_MONTH} - If present, then it is split into the
+     *  {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart
+     *  then the field is validated.
+     * <li>{@code YEAR_OF_ERA} and {@code ERA} - If both are present, then they
+     *  are combined to form a {@code YEAR}. In lenient mode, the {@code YEAR_OF_ERA}
+     *  range is not validated, in smart and strict mode it is. The {@code ERA} is
+     *  validated for range in all three modes. If only the {@code YEAR_OF_ERA} is
+     *  present, and the mode is smart or lenient, then the last available era
+     *  is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is
+     *  left untouched. If only the {@code ERA} is present, then it is left untouched.
+     * <li>{@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} -
+     *  If all three are present, then they are combined to form a date.
+     *  In all three modes, the {@code YEAR} is validated.
+     *  If the mode is smart or strict, then the month and day are validated.
+     *  If the mode is lenient, then the date is combined in a manner equivalent to
+     *  creating a date on the first day of the first month in the requested year,
+     *  then adding the difference in months, then the difference in days.
+     *  If the mode is smart, and the day-of-month is greater than the maximum for
+     *  the year-month, then the day-of-month is adjusted to the last day-of-month.
+     *  If the mode is strict, then the three fields must form a valid date.
+     * <li>{@code YEAR} and {@code DAY_OF_YEAR} -
+     *  If both are present, then they are combined to form a date.
+     *  In all three modes, the {@code YEAR} is validated.
+     *  If the mode is lenient, then the date is combined in a manner equivalent to
+     *  creating a date on the first day of the requested year, then adding
+     *  the difference in days.
+     *  If the mode is smart or strict, then the two fields must form a valid date.
+     * <li>{@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and
+     *  {@code ALIGNED_DAY_OF_WEEK_IN_MONTH} -
+     *  If all four are present, then they are combined to form a date.
+     *  In all three modes, the {@code YEAR} is validated.
+     *  If the mode is lenient, then the date is combined in a manner equivalent to
+     *  creating a date on the first day of the first month in the requested year, then adding
+     *  the difference in months, then the difference in weeks, then in days.
+     *  If the mode is smart or strict, then the all four fields are validated to
+     *  their outer ranges. The date is then combined in a manner equivalent to
+     *  creating a date on the first day of the requested year and month, then adding
+     *  the amount in weeks and days to reach their values. If the mode is strict,
+     *  the date is additionally validated to check that the day and week adjustment
+     *  did not change the month.
+     * <li>{@code YEAR}, {@code MONTH_OF_YEAR}, {@code ALIGNED_WEEK_OF_MONTH} and
+     *  {@code DAY_OF_WEEK} - If all four are present, then they are combined to
+     *  form a date. The approach is the same as described above for
+     *  years, months and weeks in {@code ALIGNED_DAY_OF_WEEK_IN_MONTH}.
+     *  The day-of-week is adjusted as the next or same matching day-of-week once
+     *  the years, months and weeks have been handled.
+     * <li>{@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code ALIGNED_DAY_OF_WEEK_IN_YEAR} -
+     *  If all three are present, then they are combined to form a date.
+     *  In all three modes, the {@code YEAR} is validated.
+     *  If the mode is lenient, then the date is combined in a manner equivalent to
+     *  creating a date on the first day of the requested year, then adding
+     *  the difference in weeks, then in days.
+     *  If the mode is smart or strict, then the all three fields are validated to
+     *  their outer ranges. The date is then combined in a manner equivalent to
+     *  creating a date on the first day of the requested year, then adding
+     *  the amount in weeks and days to reach their values. If the mode is strict,
+     *  the date is additionally validated to check that the day and week adjustment
+     *  did not change the year.
+     * <li>{@code YEAR}, {@code ALIGNED_WEEK_OF_YEAR} and {@code DAY_OF_WEEK} -
+     *  If all three are present, then they are combined to form a date.
+     *  The approach is the same as described above for years and weeks in
+     *  {@code ALIGNED_DAY_OF_WEEK_IN_YEAR}. The day-of-week is adjusted as the
+     *  next or same matching day-of-week once the years and weeks have been handled.
+     * </ul>
+     * <p>
      * The default implementation is suitable for most calendar systems.
      * If {@link ChronoField#YEAR_OF_ERA} is found without an {@link ChronoField#ERA}
      * then the last era in {@link #eras()} is used.
      * The implementation assumes a 7 day week, that the first day-of-month
-     * has the value 1, and that first day-of-year has the value 1.
+     * has the value 1, that first day-of-year has the value 1, and that the
+     * first of the month and year always exists.
      *
      * @param fieldValues  the map of fields to values, which can be updated, not null
      * @param resolverStyle  the requested type of resolve, not null
@@ -941,99 +962,214 @@
      * @throws DateTimeException if the date cannot be resolved, typically
      *  because of a conflict in the input data
      */
-    public ChronoLocalDate<?> resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+    public ChronoLocalDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
         // check epoch-day before inventing era
         if (fieldValues.containsKey(EPOCH_DAY)) {
             return dateEpochDay(fieldValues.remove(EPOCH_DAY));
         }
 
         // fix proleptic month before inventing era
-        Long pMonth = fieldValues.remove(PROLEPTIC_MONTH);
-        if (pMonth != null) {
-            // first day-of-month is likely to be safest for setting proleptic-month
-            // cannot add to year zero, as not all chronologies have a year zero
-            ChronoLocalDate<?> chronoDate = dateNow()
-                    .with(DAY_OF_MONTH, 1).with(PROLEPTIC_MONTH, pMonth);
-            addFieldValue(fieldValues, MONTH_OF_YEAR, chronoDate.get(MONTH_OF_YEAR));
-            addFieldValue(fieldValues, YEAR, chronoDate.get(YEAR));
-        }
+        resolveProlepticMonth(fieldValues, resolverStyle);
 
         // invent era if necessary to resolve year-of-era
-        Long yoeLong = fieldValues.remove(YEAR_OF_ERA);
-        if (yoeLong != null) {
-            Long eraLong = fieldValues.remove(ERA);
-            int yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA);
-            if (eraLong != null) {
-                Era eraObj = eraOf(Math.toIntExact(eraLong));
-                addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe));
-            } else if (fieldValues.containsKey(YEAR)) {
-                int year = range(YEAR).checkValidIntValue(fieldValues.get(YEAR), YEAR);
-                ChronoLocalDate<?> chronoDate = dateYearDay(year, 1);
-                addFieldValue(fieldValues, YEAR, prolepticYear(chronoDate.getEra(), yoe));
-            } else {
-                List<Era> eras = eras();
-                if (eras.isEmpty()) {
-                    addFieldValue(fieldValues, YEAR, yoe);
-                } else {
-                    Era eraObj = eras.get(eras.size() - 1);
-                    addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe));
-                }
-            }
+        ChronoLocalDate resolved = resolveYearOfEra(fieldValues, resolverStyle);
+        if (resolved != null) {
+            return resolved;
         }
 
         // build date
         if (fieldValues.containsKey(YEAR)) {
             if (fieldValues.containsKey(MONTH_OF_YEAR)) {
                 if (fieldValues.containsKey(DAY_OF_MONTH)) {
-                    int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
-                    int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
-                    int dom = range(DAY_OF_MONTH).checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH);
-                    return date(y, moy, dom);
+                    return resolveYMD(fieldValues, resolverStyle);
                 }
                 if (fieldValues.containsKey(ALIGNED_WEEK_OF_MONTH)) {
                     if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_MONTH)) {
-                        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
-                        int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
-                        int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH);
-                        int ad = range(ALIGNED_DAY_OF_WEEK_IN_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), ALIGNED_DAY_OF_WEEK_IN_MONTH);
-                        ChronoLocalDate<?> chronoDate = date(y, moy, 1);
-                        return chronoDate.plus((aw - 1) * 7 + (ad - 1), ChronoUnit.DAYS);
+                        return resolveYMAA(fieldValues, resolverStyle);
                     }
                     if (fieldValues.containsKey(DAY_OF_WEEK)) {
-                        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
-                        int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
-                        int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH);
-                        int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK);
-                        ChronoLocalDate<?> chronoDate = date(y, moy, 1);
-                        return chronoDate.plus((aw - 1) * 7, ChronoUnit.DAYS).with(nextOrSame(DayOfWeek.of(dow)));
+                        return resolveYMAD(fieldValues, resolverStyle);
                     }
                 }
             }
             if (fieldValues.containsKey(DAY_OF_YEAR)) {
-                int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
-                int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR);
-                return dateYearDay(y, doy);
+                return resolveYD(fieldValues, resolverStyle);
             }
             if (fieldValues.containsKey(ALIGNED_WEEK_OF_YEAR)) {
                 if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_YEAR)) {
-                    int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
-                    int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR);
-                    int ad = range(ALIGNED_DAY_OF_WEEK_IN_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), ALIGNED_DAY_OF_WEEK_IN_YEAR);
-                    ChronoLocalDate<?> chronoDate = dateYearDay(y, 1);
-                    return chronoDate.plus((aw - 1) * 7 + (ad - 1), ChronoUnit.DAYS);
+                    return resolveYAA(fieldValues, resolverStyle);
                 }
                 if (fieldValues.containsKey(DAY_OF_WEEK)) {
-                    int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
-                    int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR);
-                    int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK);
-                    ChronoLocalDate<?> chronoDate = dateYearDay(y, 1);
-                    return chronoDate.plus((aw - 1) * 7, ChronoUnit.DAYS).with(nextOrSame(DayOfWeek.of(dow)));
+                    return resolveYAD(fieldValues, resolverStyle);
                 }
             }
         }
         return null;
     }
 
+    void resolveProlepticMonth(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        Long pMonth = fieldValues.remove(PROLEPTIC_MONTH);
+        if (pMonth != null) {
+            if (resolverStyle != ResolverStyle.LENIENT) {
+                PROLEPTIC_MONTH.checkValidValue(pMonth);
+            }
+            // first day-of-month is likely to be safest for setting proleptic-month
+            // cannot add to year zero, as not all chronologies have a year zero
+            ChronoLocalDate chronoDate = dateNow()
+                    .with(DAY_OF_MONTH, 1).with(PROLEPTIC_MONTH, pMonth);
+            addFieldValue(fieldValues, MONTH_OF_YEAR, chronoDate.get(MONTH_OF_YEAR));
+            addFieldValue(fieldValues, YEAR, chronoDate.get(YEAR));
+        }
+    }
+
+    ChronoLocalDate resolveYearOfEra(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        Long yoeLong = fieldValues.remove(YEAR_OF_ERA);
+        if (yoeLong != null) {
+            Long eraLong = fieldValues.remove(ERA);
+            int yoe;
+            if (resolverStyle != ResolverStyle.LENIENT) {
+                yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA);
+            } else {
+                yoe = Math.toIntExact(yoeLong);
+            }
+            if (eraLong != null) {
+                Era eraObj = eraOf(range(ERA).checkValidIntValue(eraLong, ERA));
+                addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe));
+            } else {
+                if (fieldValues.containsKey(YEAR)) {
+                    int year = range(YEAR).checkValidIntValue(fieldValues.get(YEAR), YEAR);
+                    ChronoLocalDate chronoDate = dateYearDay(year, 1);
+                    addFieldValue(fieldValues, YEAR, prolepticYear(chronoDate.getEra(), yoe));
+                } else if (resolverStyle == ResolverStyle.STRICT) {
+                    // do not invent era if strict
+                    // reinstate the field removed earlier, no cross-check issues
+                    fieldValues.put(YEAR_OF_ERA, yoeLong);
+                } else {
+                    List<Era> eras = eras();
+                    if (eras.isEmpty()) {
+                        addFieldValue(fieldValues, YEAR, yoe);
+                    } else {
+                        Era eraObj = eras.get(eras.size() - 1);
+                        addFieldValue(fieldValues, YEAR, prolepticYear(eraObj, yoe));
+                    }
+                }
+            }
+        } else if (fieldValues.containsKey(ERA)) {
+            range(ERA).checkValidValue(fieldValues.get(ERA), ERA);  // always validated
+        }
+        return null;
+    }
+
+    ChronoLocalDate resolveYMD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
+            long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1);
+            return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS);
+        }
+        int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
+        ValueRange domRange = range(DAY_OF_MONTH);
+        int dom = domRange.checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH);
+        if (resolverStyle == ResolverStyle.SMART) {  // previous valid
+            try {
+                return date(y, moy, dom);
+            } catch (DateTimeException ex) {
+                return date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth());
+            }
+        }
+        return date(y, moy, dom);
+    }
+
+    ChronoLocalDate resolveYD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1);
+            return dateYearDay(y, 1).plus(days, DAYS);
+        }
+        int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR);
+        return dateYearDay(y, doy);  // smart is same as strict
+    }
+
+    ChronoLocalDate resolveYMAA(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
+            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1);
+            long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1);
+            return date(y, 1, 1).plus(months, MONTHS).plus(weeks, WEEKS).plus(days, DAYS);
+        }
+        int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
+        int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH);
+        int ad = range(ALIGNED_DAY_OF_WEEK_IN_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), ALIGNED_DAY_OF_WEEK_IN_MONTH);
+        ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7 + (ad - 1), DAYS);
+        if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) {
+            throw new DateTimeException("Strict mode rejected resolved date as it is in a different month");
+        }
+        return date;
+    }
+
+    ChronoLocalDate resolveYMAD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
+            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1);
+            long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1);
+            return resolveAligned(date(y, 1, 1), months, weeks, dow);
+        }
+        int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
+        int aw = range(ALIGNED_WEEK_OF_MONTH).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), ALIGNED_WEEK_OF_MONTH);
+        int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK);
+        ChronoLocalDate date = date(y, moy, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow)));
+        if (resolverStyle == ResolverStyle.STRICT && date.get(MONTH_OF_YEAR) != moy) {
+            throw new DateTimeException("Strict mode rejected resolved date as it is in a different month");
+        }
+        return date;
+    }
+
+    ChronoLocalDate resolveYAA(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1);
+            long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), 1);
+            return dateYearDay(y, 1).plus(weeks, WEEKS).plus(days, DAYS);
+        }
+        int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR);
+        int ad = range(ALIGNED_DAY_OF_WEEK_IN_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), ALIGNED_DAY_OF_WEEK_IN_YEAR);
+        ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7 + (ad - 1), DAYS);
+        if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) {
+            throw new DateTimeException("Strict mode rejected resolved date as it is in a different year");
+        }
+        return date;
+    }
+
+    ChronoLocalDate resolveYAD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        int y = range(YEAR).checkValidIntValue(fieldValues.remove(YEAR), YEAR);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1);
+            long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1);
+            return resolveAligned(dateYearDay(y, 1), 0, weeks, dow);
+        }
+        int aw = range(ALIGNED_WEEK_OF_YEAR).checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), ALIGNED_WEEK_OF_YEAR);
+        int dow = range(DAY_OF_WEEK).checkValidIntValue(fieldValues.remove(DAY_OF_WEEK), DAY_OF_WEEK);
+        ChronoLocalDate date = dateYearDay(y, 1).plus((aw - 1) * 7, DAYS).with(nextOrSame(DayOfWeek.of(dow)));
+        if (resolverStyle == ResolverStyle.STRICT && date.get(YEAR) != y) {
+            throw new DateTimeException("Strict mode rejected resolved date as it is in a different year");
+        }
+        return date;
+    }
+
+    ChronoLocalDate resolveAligned(ChronoLocalDate base, long months, long weeks, long dow) {
+        ChronoLocalDate date = base.plus(months, MONTHS).plus(weeks, WEEKS);
+        if (dow > 7) {
+            date = date.plus((dow - 1) / 7, WEEKS);
+            dow = ((dow - 1) % 7) + 1;
+        } else if (dow < 1) {
+            date = date.plus(Math.subtractExact(dow,  7) / 7, WEEKS);
+            dow = ((dow + 6) % 7) + 1;
+        }
+        return date.with(nextOrSame(DayOfWeek.of((int) dow)));
+    }
+
     /**
      * Adds a field-value pair to the map, checking for conflicts.
      * <p>
--- a/jdk/src/share/classes/java/time/chrono/Era.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/Era.java	Tue Aug 06 16:54:56 2013 -0700
@@ -238,7 +238,7 @@
         if (field == ERA) {
             return getValue();
         } else if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
--- a/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/HijrahChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -71,8 +71,10 @@
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.ZoneId;
+import java.time.format.ResolverStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalField;
 import java.time.temporal.ValueRange;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -115,7 +117,7 @@
  * <tr class="altColor">
  * <td>Hijrah-umalqura</td>
  * <td>islamic-umalqura</td>
- * <td>ca-islamic-cv-umalqura</td>
+ * <td>ca-islamic-umalqura</td>
  * <td>Islamic - Umm Al-Qura calendar of Saudi Arabia</td>
  * </tr>
  * </tbody>
@@ -126,10 +128,10 @@
  * <p>
  * Selecting the chronology from the locale uses {@link Chronology#ofLocale}
  * to find the Chronology based on Locale supported BCP 47 extension mechanism
- * to request a specific calendar ("ca") and variant ("cv"). For example,
+ * to request a specific calendar ("ca"). For example,
  * </p>
  * <pre>
- *      Locale locale = Locale.forLanguageTag("en-US-u-ca-islamic-cv-umalqura");
+ *      Locale locale = Locale.forLanguageTag("en-US-u-ca-islamic-umalqura");
  *      Chronology chrono = Chronology.ofLocale(locale);
  * </pre>
  *
@@ -472,11 +474,16 @@
      * @param prolepticYear  the proleptic-year
      * @param dayOfYear  the day-of-year
      * @return the Hijrah local date, not null
-     * @throws DateTimeException if unable to create the date
+     * @throws DateTimeException if the value of the year is out of range,
+     *  or if the day-of-year is invalid for the year
      */
     @Override
     public HijrahDate dateYearDay(int prolepticYear, int dayOfYear) {
-        return HijrahDate.of(this, prolepticYear, 1, 1).plusDays(dayOfYear - 1);  // TODO better
+        HijrahDate date = HijrahDate.of(this, prolepticYear, 1, 1);
+        if (dayOfYear > date.lengthOfYear()) {
+            throw new DateTimeException("Invalid dayOfYear: " + dayOfYear);
+        }
+        return date.plusDays(dayOfYear - 1);
     }
 
     /**
@@ -515,16 +522,19 @@
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoLocalDateTime<HijrahDate> localDateTime(TemporalAccessor temporal) {
         return (ChronoLocalDateTime<HijrahDate>) super.localDateTime(temporal);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoZonedDateTime<HijrahDate> zonedDateTime(TemporalAccessor temporal) {
         return (ChronoZonedDateTime<HijrahDate>) super.zonedDateTime(temporal);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoZonedDateTime<HijrahDate> zonedDateTime(Instant instant, ZoneId zone) {
         return (ChronoZonedDateTime<HijrahDate>) super.zonedDateTime(instant, zone);
     }
@@ -550,7 +560,7 @@
     }
 
     @Override
-    public Era eraOf(int eraValue) {
+    public HijrahEra eraOf(int eraValue) {
         switch (eraValue) {
             case 1:
                 return HijrahEra.AH;
@@ -580,6 +590,8 @@
                 case YEAR:
                 case YEAR_OF_ERA:
                     return ValueRange.of(getMinimumYear(), getMaximumYear());
+                case ERA:
+                    return ValueRange.of(1, 1);
                 default:
                     return field.range();
             }
@@ -587,6 +599,13 @@
         return field.range();
     }
 
+    //-----------------------------------------------------------------------
+    @Override  // override for return type
+    public HijrahDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        return (HijrahDate) super.resolveDate(fieldValues, resolverStyle);
+    }
+
+    //-----------------------------------------------------------------------
     /**
      * Check the validity of a year.
      *
--- a/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/HijrahDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -109,7 +109,7 @@
  */
 public final class HijrahDate
         extends ChronoDateImpl<HijrahDate>
-        implements ChronoLocalDate<HijrahDate>, Serializable {
+        implements ChronoLocalDate, Serializable {
 
     /**
      * Serialization version.
@@ -204,7 +204,7 @@
      * @throws DateTimeException if the current date cannot be obtained
      */
     public static HijrahDate now(Clock clock) {
-        return HijrahChronology.INSTANCE.date(LocalDate.now(clock));
+        return HijrahDate.ofEpochDay(HijrahChronology.INSTANCE, LocalDate.now(clock).toEpochDay());
     }
 
     /**
@@ -349,7 +349,7 @@
                 }
                 return getChronology().range(f);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
@@ -372,7 +372,7 @@
                 case YEAR: return prolepticYear;
                 case ERA: return getEraValue();
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
@@ -393,7 +393,7 @@
                 case ALIGNED_DAY_OF_WEEK_IN_MONTH: return plusDays(newValue - getLong(ALIGNED_DAY_OF_WEEK_IN_MONTH));
                 case ALIGNED_DAY_OF_WEEK_IN_YEAR: return plusDays(newValue - getLong(ALIGNED_DAY_OF_WEEK_IN_YEAR));
                 case DAY_OF_MONTH: return resolvePreviousValid(prolepticYear, monthOfYear, nvalue);
-                case DAY_OF_YEAR: return resolvePreviousValid(prolepticYear, ((nvalue - 1) / 30) + 1, ((nvalue - 1) % 30) + 1);
+                case DAY_OF_YEAR: return plusDays(Math.min(nvalue, lengthOfYear()) - getDayOfYear());
                 case EPOCH_DAY: return new HijrahDate(chrono, newValue);
                 case ALIGNED_WEEK_OF_MONTH: return plusDays((newValue - getLong(ALIGNED_WEEK_OF_MONTH)) * 7);
                 case ALIGNED_WEEK_OF_YEAR: return plusDays((newValue - getLong(ALIGNED_WEEK_OF_YEAR)) * 7);
@@ -403,9 +403,9 @@
                 case YEAR: return resolvePreviousValid(nvalue, monthOfYear, dayOfMonth);
                 case ERA: return resolvePreviousValid(1 - prolepticYear, monthOfYear, dayOfMonth);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
-        return ChronoLocalDate.super.with(field, newValue);
+        return super.with(field, newValue);
     }
 
     private HijrahDate resolvePreviousValid(int prolepticYear, int month, int day) {
@@ -479,7 +479,7 @@
      * @return the day-of-year
      */
     private int getDayOfYear() {
-        return chrono.getDayOfYear(prolepticYear, monthOfYear);
+        return chrono.getDayOfYear(prolepticYear, monthOfYear) + dayOfMonth;
     }
 
     /**
@@ -575,12 +575,13 @@
     }
 
     @Override        // for javadoc and covariant return type
+    @SuppressWarnings("unchecked")
     public final ChronoLocalDateTime<HijrahDate> atTime(LocalTime localTime) {
-        return super.atTime(localTime);
+        return (ChronoLocalDateTime<HijrahDate>)super.atTime(localTime);
     }
 
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
+    public Period until(ChronoLocalDate endDate) {
         // TODO: untested
         HijrahDate end = getChronology().date(endDate);
         long totalMonths = (end.prolepticYear - this.prolepticYear) * 12 + (end.monthOfYear - this.monthOfYear);  // safe
@@ -622,7 +623,7 @@
         return this;
     }
 
-    static ChronoLocalDate<HijrahDate> readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+    static HijrahDate readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         HijrahChronology chrono = (HijrahChronology) in.readObject();
         int year = in.readInt();
         int month = in.readByte();
--- a/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/IsoChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -61,25 +61,16 @@
  */
 package java.time.chrono;
 
-import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH;
-import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR;
-import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH;
-import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
-import static java.time.temporal.ChronoField.DAY_OF_WEEK;
-import static java.time.temporal.ChronoField.DAY_OF_YEAR;
-import static java.time.temporal.ChronoField.EPOCH_DAY;
 import static java.time.temporal.ChronoField.ERA;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
-import static java.time.temporal.TemporalAdjuster.nextOrSame;
 
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
-import java.time.DayOfWeek;
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
@@ -398,7 +389,7 @@
     }
 
     @Override
-    public Era eraOf(int eraValue) {
+    public IsoEra eraOf(int eraValue) {
         return IsoEra.of(eraValue);
     }
 
@@ -421,7 +412,7 @@
      * as follows.
      * <ul>
      * <li>{@code EPOCH_DAY} - If present, this is converted to a {@code LocalDate}
-     *  all other date fields are then cross-checked against the date
+     *  and all other date fields are then cross-checked against the date.
      * <li>{@code PROLEPTIC_MONTH} - If present, then it is split into the
      *  {@code YEAR} and {@code MONTH_OF_YEAR}. If the mode is strict or smart
      *  then the field is validated.
@@ -430,7 +421,7 @@
      *  range is not validated, in smart and strict mode it is. The {@code ERA} is
      *  validated for range in all three modes. If only the {@code YEAR_OF_ERA} is
      *  present, and the mode is smart or lenient, then the current era (CE/AD)
-     *  is assumed. In strict mode, no ers is assumed and the {@code YEAR_OF_ERA} is
+     *  is assumed. In strict mode, no era is assumed and the {@code YEAR_OF_ERA} is
      *  left untouched. If only the {@code ERA} is present, then it is left untouched.
      * <li>{@code YEAR}, {@code MONTH_OF_YEAR} and {@code DAY_OF_MONTH} -
      *  If all three are present, then they are combined to form a {@code LocalDate}.
@@ -495,48 +486,11 @@
      */
     @Override  // override for performance
     public LocalDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
-        // check epoch-day before inventing era
-        if (fieldValues.containsKey(EPOCH_DAY)) {
-            return LocalDate.ofEpochDay(fieldValues.remove(EPOCH_DAY));
-        }
-
-        // fix proleptic month before inventing era
-        resolveProlepticMonth(fieldValues, resolverStyle);
-
-        // invent era if necessary to resolve year-of-era
-        resolveYearOfEra(fieldValues, resolverStyle);
-
-        // build date
-        if (fieldValues.containsKey(YEAR)) {
-            if (fieldValues.containsKey(MONTH_OF_YEAR)) {
-                if (fieldValues.containsKey(DAY_OF_MONTH)) {
-                    return resolveYMD(fieldValues, resolverStyle);
-                }
-                if (fieldValues.containsKey(ALIGNED_WEEK_OF_MONTH)) {
-                    if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_MONTH)) {
-                        return resolveYMAA(fieldValues, resolverStyle);
-                    }
-                    if (fieldValues.containsKey(DAY_OF_WEEK)) {
-                        return resolveYMAD(fieldValues, resolverStyle);
-                    }
-                }
-            }
-            if (fieldValues.containsKey(DAY_OF_YEAR)) {
-                return resolveYD(fieldValues, resolverStyle);
-            }
-            if (fieldValues.containsKey(ALIGNED_WEEK_OF_YEAR)) {
-                if (fieldValues.containsKey(ALIGNED_DAY_OF_WEEK_IN_YEAR)) {
-                    return resolveYAA(fieldValues, resolverStyle);
-                }
-                if (fieldValues.containsKey(DAY_OF_WEEK)) {
-                    return resolveYAD(fieldValues, resolverStyle);
-                }
-            }
-        }
-        return null;
+        return (LocalDate) super.resolveDate(fieldValues, resolverStyle);
     }
 
-    private void resolveProlepticMonth(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+    @Override  // override for better proleptic algorithm
+    void resolveProlepticMonth(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
         Long pMonth = fieldValues.remove(PROLEPTIC_MONTH);
         if (pMonth != null) {
             if (resolverStyle != ResolverStyle.LENIENT) {
@@ -547,7 +501,8 @@
         }
     }
 
-    private void resolveYearOfEra(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+    @Override  // override for enhanced behaviour
+    LocalDate resolveYearOfEra(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
         Long yoeLong = fieldValues.remove(YEAR_OF_ERA);
         if (yoeLong != null) {
             if (resolverStyle != ResolverStyle.LENIENT) {
@@ -575,10 +530,14 @@
             } else {
                 throw new DateTimeException("Invalid value for era: " + era);
             }
+        } else if (fieldValues.containsKey(ERA)) {
+            ERA.checkValidValue(fieldValues.get(ERA));  // always validated
         }
+        return null;
     }
 
-    private LocalDate resolveYMD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+    @Override  // override for performance
+    LocalDate resolveYMD(Map <TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
         int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR));
         if (resolverStyle == ResolverStyle.LENIENT) {
             long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
@@ -598,96 +557,6 @@
         return LocalDate.of(y, moy, dom);
     }
 
-    private LocalDate resolveYD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
-        int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR));
-        if (resolverStyle == ResolverStyle.LENIENT) {
-            long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1);
-            return LocalDate.of(y, 1, 1).plusDays(days);
-        }
-        int doy = DAY_OF_YEAR.checkValidIntValue(fieldValues.remove(DAY_OF_YEAR));
-        return LocalDate.ofYearDay(y, doy);  // smart is same as strict
-    }
-
-    private LocalDate resolveYMAA(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
-        int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR));
-        if (resolverStyle == ResolverStyle.LENIENT) {
-            long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
-            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1);
-            long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH), 1);
-            return LocalDate.of(y, 1, 1).plusMonths(months).plusWeeks(weeks).plusDays(days);
-        }
-        int moy = MONTH_OF_YEAR.checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR));
-        int aw = ALIGNED_WEEK_OF_MONTH.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH));
-        int ad = ALIGNED_DAY_OF_WEEK_IN_MONTH.checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_MONTH));
-        LocalDate date = LocalDate.of(y, moy, 1).plusDays((aw - 1) * 7 + (ad - 1));
-        if (resolverStyle == ResolverStyle.STRICT && date.getMonthValue() != moy) {
-            throw new DateTimeException("Strict mode rejected resolved date as it is in a different month");
-        }
-        return date;
-    }
-
-    private LocalDate resolveYMAD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
-        int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR));
-        if (resolverStyle == ResolverStyle.LENIENT) {
-            long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
-            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_MONTH), 1);
-            long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1);
-            return resolveAligned(y, months, weeks, dow);
-        }
-        int moy = MONTH_OF_YEAR.checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR));
-        int aw = ALIGNED_WEEK_OF_MONTH.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_MONTH));
-        int dow = DAY_OF_WEEK.checkValidIntValue(fieldValues.remove(DAY_OF_WEEK));
-        LocalDate date = LocalDate.of(y, moy, 1).plusDays((aw - 1) * 7).with(nextOrSame(DayOfWeek.of(dow)));
-        if (resolverStyle == ResolverStyle.STRICT && date.getMonthValue() != moy) {
-            throw new DateTimeException("Strict mode rejected resolved date as it is in a different month");
-        }
-        return date;
-    }
-
-    private LocalDate resolveYAA(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
-        int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR));
-        if (resolverStyle == ResolverStyle.LENIENT) {
-            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1);
-            long days = Math.subtractExact(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR), 1);
-            return LocalDate.of(y, 1, 1).plusWeeks(weeks).plusDays(days);
-        }
-        int aw = ALIGNED_WEEK_OF_YEAR.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR));
-        int ad = ALIGNED_DAY_OF_WEEK_IN_YEAR.checkValidIntValue(fieldValues.remove(ALIGNED_DAY_OF_WEEK_IN_YEAR));
-        LocalDate date = LocalDate.of(y, 1, 1).plusDays((aw - 1) * 7 + (ad - 1));
-        if (resolverStyle == ResolverStyle.STRICT && date.getYear() != y) {
-            throw new DateTimeException("Strict mode rejected resolved date as it is in a different year");
-        }
-        return date;
-    }
-
-    private LocalDate resolveYAD(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
-        int y = YEAR.checkValidIntValue(fieldValues.remove(YEAR));
-        if (resolverStyle == ResolverStyle.LENIENT) {
-            long weeks = Math.subtractExact(fieldValues.remove(ALIGNED_WEEK_OF_YEAR), 1);
-            long dow = Math.subtractExact(fieldValues.remove(DAY_OF_WEEK), 1);
-            return resolveAligned(y, 0, weeks, dow);
-        }
-        int aw = ALIGNED_WEEK_OF_YEAR.checkValidIntValue(fieldValues.remove(ALIGNED_WEEK_OF_YEAR));
-        int dow = DAY_OF_WEEK.checkValidIntValue(fieldValues.remove(DAY_OF_WEEK));
-        LocalDate date = LocalDate.of(y, 1, 1).plusDays((aw - 1) * 7).with(nextOrSame(DayOfWeek.of(dow)));
-        if (resolverStyle == ResolverStyle.STRICT && date.getYear() != y) {
-            throw new DateTimeException("Strict mode rejected resolved date as it is in a different year");
-        }
-        return date;
-    }
-
-    private LocalDate resolveAligned(int y, long months, long weeks, long dow) {
-        LocalDate date = LocalDate.of(y, 1, 1).plusMonths(months).plusWeeks(weeks);
-        if (dow > 7) {
-            date = date.plusWeeks((dow - 1) / 7);
-            dow = ((dow - 1) % 7) + 1;
-        } else if (dow < 1) {
-            date = date.plusWeeks(Math.subtractExact(dow,  7) / 7);
-            dow = ((dow + 6) % 7) + 1;
-        }
-        return date.with(nextOrSame(DayOfWeek.of((int) dow)));
-    }
-
     //-----------------------------------------------------------------------
     @Override
     public ValueRange range(ChronoField field) {
--- a/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -56,6 +56,15 @@
  */
 package java.time.chrono;
 
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
+import static java.time.temporal.ChronoField.ERA;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.MONTHS;
+
 import java.io.Serializable;
 import java.time.Clock;
 import java.time.DateTimeException;
@@ -63,13 +72,18 @@
 import java.time.LocalDate;
 import java.time.Year;
 import java.time.ZoneId;
+import java.time.format.ResolverStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalField;
+import java.time.temporal.UnsupportedTemporalTypeException;
 import java.time.temporal.ValueRange;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import sun.util.calendar.CalendarSystem;
 import sun.util.calendar.LocalGregorianCalendar;
@@ -82,8 +96,22 @@
  * The Japanese Imperial calendar system is the same as the ISO calendar system
  * apart from the era-based year numbering.
  * <p>
- * Only Meiji (1865-04-07 - 1868-09-07) and later eras are supported.
- * Older eras are handled as an unknown era where the year-of-era is the ISO year.
+ * Japan introduced the Gregorian calendar starting with Meiji 6.
+ * Only Meiji and later eras are supported;
+ * dates before Meiji 6, January 1 are not supported.
+ * <p>
+ * The supported {@code ChronoField} instances are:
+ * <ul>
+ * <li>{@code DAY_OF_WEEK}
+ * <li>{@code DAY_OF_MONTH}
+ * <li>{@code DAY_OF_YEAR}
+ * <li>{@code EPOCH_DAY}
+ * <li>{@code MONTH_OF_YEAR}
+ * <li>{@code PROLEPTIC_MONTH}
+ * <li>{@code YEAR_OF_ERA}
+ * <li>{@code YEAR}
+ * <li>{@code ERA}
+ * </ul>
  *
  * @implSpec
  * This class is immutable and thread-safe.
@@ -91,7 +119,6 @@
  * @since 1.8
  */
 public final class JapaneseChronology extends Chronology implements Serializable {
-    // TODO: definition for unknown era may break requirement that year-of-era >= 1
 
     static final LocalGregorianCalendar JCAL =
         (LocalGregorianCalendar) CalendarSystem.forName("japanese");
@@ -152,6 +179,16 @@
     /**
      * Obtains a local date in Japanese calendar system from the
      * era, year-of-era, month-of-year and day-of-month fields.
+     * <p>
+     * The Japanese month and day-of-month are the same as those in the
+     * ISO calendar system. They are not reset when the era changes.
+     * For example:
+     * <pre>
+     *  6th Jan Showa 64 = ISO 1989-01-06
+     *  7th Jan Showa 64 = ISO 1989-01-07
+     *  8th Jan Heisei 1 = ISO 1989-01-08
+     *  9th Jan Heisei 1 = ISO 1989-01-09
+     * </pre>
      *
      * @param era  the Japanese era, not null
      * @param yearOfEra  the year-of-era
@@ -172,6 +209,9 @@
     /**
      * Obtains a local date in Japanese calendar system from the
      * proleptic-year, month-of-year and day-of-month fields.
+     * <p>
+     * The Japanese proleptic year, month and day-of-month are the same as those
+     * in the ISO calendar system. They are not reset when the era changes.
      *
      * @param prolepticYear  the proleptic-year
      * @param month  the month-of-year
@@ -187,6 +227,17 @@
     /**
      * Obtains a local date in Japanese calendar system from the
      * era, year-of-era and day-of-year fields.
+     * <p>
+     * The day-of-year in this factory is expressed relative to the start of the year-of-era.
+     * This definition changes the normal meaning of day-of-year only in those years
+     * where the year-of-era is reset to one due to a change in the era.
+     * For example:
+     * <pre>
+     *  6th Jan Showa 64 = day-of-year 6
+     *  7th Jan Showa 64 = day-of-year 7
+     *  8th Jan Heisei 1 = day-of-year 1
+     *  9th Jan Heisei 1 = day-of-year 2
+     * </pre>
      *
      * @param era  the Japanese era, not null
      * @param yearOfEra  the year-of-era
@@ -203,6 +254,10 @@
     /**
      * Obtains a local date in Japanese calendar system from the
      * proleptic-year and day-of-year fields.
+     * <p>
+     * The day-of-year in this factory is expressed relative to the start of the proleptic year.
+     * The Japanese proleptic year and day-of-year are the same as those in the ISO calendar system.
+     * They are not reset when the era changes.
      *
      * @param prolepticYear  the proleptic-year
      * @param dayOfYear  the day-of-year
@@ -211,8 +266,7 @@
      */
     @Override
     public JapaneseDate dateYearDay(int prolepticYear, int dayOfYear) {
-        LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear);
-        return date(prolepticYear, date.getMonthValue(), date.getDayOfMonth());
+        return new JapaneseDate(LocalDate.ofYearDay(prolepticYear, dayOfYear));
     }
 
     /**
@@ -290,15 +344,6 @@
             throw new ClassCastException("Era must be JapaneseEra");
         }
 
-        if (era == JapaneseEra.SEIREKI) {
-            JapaneseEra nextEra = JapaneseEra.values()[1];
-            int nextEraYear = nextEra.getPrivateEra().getSinceDate().getYear();
-            if (yearOfEra >= nextEraYear || yearOfEra < Year.MIN_VALUE) {
-                throw new DateTimeException("Invalid yearOfEra value");
-            }
-            return yearOfEra;
-        }
-
         JapaneseEra jera = (JapaneseEra) era;
         int gregorianYear = jera.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
         if (yearOfEra == 1) {
@@ -320,14 +365,13 @@
      * See the description of each Era for the numeric values of:
      * {@link JapaneseEra#HEISEI}, {@link JapaneseEra#SHOWA},{@link JapaneseEra#TAISHO},
      * {@link JapaneseEra#MEIJI}), only Meiji and later eras are supported.
-     * Prior to Meiji {@link JapaneseEra#SEIREKI} is used.
      *
      * @param eraValue  the era value
      * @return the Japanese {@code Era} for the given numeric era value
      * @throws DateTimeException if {@code eraValue} is invalid
      */
     @Override
-    public Era eraOf(int eraValue) {
+    public JapaneseEra eraOf(int eraValue) {
         return JapaneseEra.of(eraValue);
     }
 
@@ -346,49 +390,117 @@
     @Override
     public ValueRange range(ChronoField field) {
         switch (field) {
-            case YEAR:
-            case DAY_OF_MONTH:
-            case DAY_OF_WEEK:
-            case MICRO_OF_DAY:
-            case MICRO_OF_SECOND:
-            case HOUR_OF_DAY:
-            case HOUR_OF_AMPM:
-            case MINUTE_OF_DAY:
-            case MINUTE_OF_HOUR:
-            case SECOND_OF_DAY:
-            case SECOND_OF_MINUTE:
-            case MILLI_OF_DAY:
-            case MILLI_OF_SECOND:
-            case NANO_OF_DAY:
-            case NANO_OF_SECOND:
-            case CLOCK_HOUR_OF_DAY:
-            case CLOCK_HOUR_OF_AMPM:
-            case EPOCH_DAY:
-            case PROLEPTIC_MONTH:
-            case MONTH_OF_YEAR:
-                return field.range();
-            case ERA:
-                return ValueRange.of(JapaneseEra.SEIREKI.getValue(),
-                                     getCurrentEra().getValue());
-        }
-        Calendar jcal = Calendar.getInstance(LOCALE);
-        int fieldIndex;
-        switch (field) {
+            case ALIGNED_DAY_OF_WEEK_IN_MONTH:
+            case ALIGNED_DAY_OF_WEEK_IN_YEAR:
+            case ALIGNED_WEEK_OF_MONTH:
+            case ALIGNED_WEEK_OF_YEAR:
+                throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
             case YEAR_OF_ERA: {
+                Calendar jcal = Calendar.getInstance(LOCALE);
                 int startYear = getCurrentEra().getPrivateEra().getSinceDate().getYear();
-                return ValueRange.of(Year.MIN_VALUE, jcal.getGreatestMinimum(Calendar.YEAR),
+                return ValueRange.of(1, jcal.getGreatestMinimum(Calendar.YEAR),
                         jcal.getLeastMaximum(Calendar.YEAR) + 1, // +1 due to the different definitions
                         Year.MAX_VALUE - startYear);
             }
-            case DAY_OF_YEAR:
-                fieldIndex = Calendar.DAY_OF_YEAR;
-                break;
+            case DAY_OF_YEAR: {
+                Calendar jcal = Calendar.getInstance(LOCALE);
+                int fieldIndex = Calendar.DAY_OF_YEAR;
+                return ValueRange.of(jcal.getMinimum(fieldIndex), jcal.getGreatestMinimum(fieldIndex),
+                        jcal.getLeastMaximum(fieldIndex), jcal.getMaximum(fieldIndex));
+            }
+            case YEAR:
+                return ValueRange.of(JapaneseDate.MEIJI_6_ISODATE.getYear(), Year.MAX_VALUE);
+            case ERA:
+                return ValueRange.of(JapaneseEra.MEIJI.getValue(), getCurrentEra().getValue());
             default:
-                 // TODO: review the remaining fields
-                throw new UnsupportedOperationException("Unimplementable field: " + field);
+                return field.range();
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Override  // override for return type
+    public JapaneseDate resolveDate(Map <TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        return (JapaneseDate) super.resolveDate(fieldValues, resolverStyle);
+    }
+
+    @Override  // override for special Japanese behavior
+    ChronoLocalDate resolveYearOfEra(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        // validate era and year-of-era
+        Long eraLong = fieldValues.get(ERA);
+        JapaneseEra era = null;
+        if (eraLong != null) {
+            era = eraOf(range(ERA).checkValidIntValue(eraLong, ERA));  // always validated
+        }
+        Long yoeLong = fieldValues.get(YEAR_OF_ERA);
+        int yoe = 0;
+        if (yoeLong != null) {
+            yoe = range(YEAR_OF_ERA).checkValidIntValue(yoeLong, YEAR_OF_ERA);  // always validated
+        }
+        // if only year-of-era and no year then invent era unless strict
+        if (era == null && yoeLong != null && fieldValues.containsKey(YEAR) == false && resolverStyle != ResolverStyle.STRICT) {
+            era = JapaneseEra.values()[JapaneseEra.values().length - 1];
+        }
+        // if both present, then try to create date
+        if (yoeLong != null && era != null) {
+            if (fieldValues.containsKey(MONTH_OF_YEAR)) {
+                if (fieldValues.containsKey(DAY_OF_MONTH)) {
+                    return resolveYMD(era, yoe, fieldValues, resolverStyle);
+                }
+            }
+            if (fieldValues.containsKey(DAY_OF_YEAR)) {
+                return resolveYD(era, yoe, fieldValues, resolverStyle);
+            }
         }
-        return ValueRange.of(jcal.getMinimum(fieldIndex), jcal.getGreatestMinimum(fieldIndex),
-                jcal.getLeastMaximum(fieldIndex), jcal.getMaximum(fieldIndex));
+        return null;
+    }
+
+    private int prolepticYearLenient(JapaneseEra era, int yearOfEra) {
+        return era.getPrivateEra().getSinceDate().getYear() + yearOfEra - 1;
+    }
+
+     private ChronoLocalDate resolveYMD(JapaneseEra era, int yoe, Map<TemporalField,Long> fieldValues, ResolverStyle resolverStyle) {
+         fieldValues.remove(ERA);
+         fieldValues.remove(YEAR_OF_ERA);
+         if (resolverStyle == ResolverStyle.LENIENT) {
+             int y = prolepticYearLenient(era, yoe);
+             long months = Math.subtractExact(fieldValues.remove(MONTH_OF_YEAR), 1);
+             long days = Math.subtractExact(fieldValues.remove(DAY_OF_MONTH), 1);
+             return date(y, 1, 1).plus(months, MONTHS).plus(days, DAYS);
+         }
+         int moy = range(MONTH_OF_YEAR).checkValidIntValue(fieldValues.remove(MONTH_OF_YEAR), MONTH_OF_YEAR);
+         int dom = range(DAY_OF_MONTH).checkValidIntValue(fieldValues.remove(DAY_OF_MONTH), DAY_OF_MONTH);
+         if (resolverStyle == ResolverStyle.SMART) {  // previous valid
+             if (yoe < 1) {
+                 throw new DateTimeException("Invalid YearOfEra: " + yoe);
+             }
+             int y = prolepticYearLenient(era, yoe);
+             JapaneseDate result;
+             try {
+                 result = date(y, moy, dom);
+             } catch (DateTimeException ex) {
+                 result = date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth());
+             }
+             // handle the era being changed
+             // only allow if the new date is in the same Jan-Dec as the era change
+             // determine by ensuring either original yoe or result yoe is 1
+             if (result.getEra() != era && result.get(YEAR_OF_ERA) > 1 && yoe > 1) {
+                 throw new DateTimeException("Invalid YearOfEra for Era: " + era + " " + yoe);
+             }
+             return result;
+         }
+         return date(era, yoe, moy, dom);
+     }
+
+    private ChronoLocalDate resolveYD(JapaneseEra era, int yoe, Map <TemporalField,Long> fieldValues, ResolverStyle resolverStyle) {
+        fieldValues.remove(ERA);
+        fieldValues.remove(YEAR_OF_ERA);
+        if (resolverStyle == ResolverStyle.LENIENT) {
+            int y = prolepticYearLenient(era, yoe);
+            long days = Math.subtractExact(fieldValues.remove(DAY_OF_YEAR), 1);
+            return dateYearDay(y, 1).plus(days, DAYS);
+        }
+        int doy = range(DAY_OF_YEAR).checkValidIntValue(fieldValues.remove(DAY_OF_YEAR), DAY_OF_YEAR);
+        return dateYearDay(era, yoe, doy);  // smart is same as strict
     }
 
 }
--- a/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -56,9 +56,15 @@
  */
 package java.time.chrono;
 
+import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH;
+import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR;
+import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH;
+import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.YEAR_OF_ERA;
 
 import java.io.DataInput;
 import java.io.DataOutput;
@@ -96,6 +102,10 @@
  * apart from the era-based year numbering. The proleptic-year is defined to be
  * equal to the ISO proleptic-year.
  * <p>
+ * Japan introduced the Gregorian calendar starting with Meiji 6.
+ * Only Meiji and later eras are supported;
+ * dates before Meiji 6, January 1 are not supported.
+ * <p>
  * For example, the Japanese year "Heisei 24" corresponds to ISO year "2012".<br>
  * Calling {@code japaneseDate.get(YEAR_OF_ERA)} will return 24.<br>
  * Calling {@code japaneseDate.get(YEAR)} will return 2012.<br>
@@ -109,7 +119,7 @@
  */
 public final class JapaneseDate
         extends ChronoDateImpl<JapaneseDate>
-        implements ChronoLocalDate<JapaneseDate>, Serializable {
+        implements ChronoLocalDate, Serializable {
 
     /**
      * Serialization version.
@@ -129,6 +139,11 @@
      */
     private transient int yearOfEra;
 
+    /**
+     * The first day supported by the JapaneseChronology is Meiji 6, January 1st.
+     */
+    final static LocalDate MEIJI_6_ISODATE = LocalDate.of(1873, 1, 1);
+
     //-----------------------------------------------------------------------
     /**
      * Obtains the current {@code JapaneseDate} from the system clock in the default time-zone.
@@ -173,7 +188,7 @@
      * @throws DateTimeException if the current date cannot be obtained
      */
     public static JapaneseDate now(Clock clock) {
-        return JapaneseChronology.INSTANCE.date(LocalDate.now(clock));
+        return new JapaneseDate(LocalDate.now(clock));
     }
 
     /**
@@ -182,6 +197,16 @@
      * <p>
      * This returns a {@code JapaneseDate} with the specified fields.
      * The day must be valid for the year and month, otherwise an exception will be thrown.
+     * <p>
+     * The Japanese month and day-of-month are the same as those in the
+     * ISO calendar system. They are not reset when the era changes.
+     * For example:
+     * <pre>
+     *  6th Jan Showa 64 = ISO 1989-01-06
+     *  7th Jan Showa 64 = ISO 1989-01-07
+     *  8th Jan Heisei 1 = ISO 1989-01-08
+     *  9th Jan Heisei 1 = ISO 1989-01-09
+     * </pre>
      *
      * @param era  the Japanese era, not null
      * @param yearOfEra  the Japanese year-of-era
@@ -192,11 +217,15 @@
      *  or if the day-of-month is invalid for the month-year,
      *  or if the date is not a Japanese era
      */
-    public static JapaneseDate of(Era era, int yearOfEra, int month, int dayOfMonth) {
-        if (era instanceof JapaneseEra == false) {
-            throw new ClassCastException("Era must be JapaneseEra");
+    public static JapaneseDate of(JapaneseEra era, int yearOfEra, int month, int dayOfMonth) {
+        Objects.requireNonNull(era, "era");
+        LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null);
+        jdate.setEra(era.getPrivateEra()).setDate(yearOfEra, month, dayOfMonth);
+        if (!JapaneseChronology.JCAL.validate(jdate)) {
+            throw new DateTimeException("year, month, and day not valid for Era");
         }
-        return JapaneseDate.of((JapaneseEra) era, yearOfEra, month, dayOfMonth);
+        LocalDate date = LocalDate.of(jdate.getNormalizedYear(), month, dayOfMonth);
+        return new JapaneseDate(era, yearOfEra, date);
     }
 
     /**
@@ -205,6 +234,9 @@
      * <p>
      * This returns a {@code JapaneseDate} with the specified fields.
      * The day must be valid for the year and month, otherwise an exception will be thrown.
+     * <p>
+     * The Japanese proleptic year, month and day-of-month are the same as those
+     * in the ISO calendar system. They are not reset when the era changes.
      *
      * @param prolepticYear  the Japanese proleptic-year
      * @param month  the Japanese month-of-year, from 1 to 12
@@ -219,23 +251,31 @@
 
     /**
      * Obtains a {@code JapaneseDate} representing a date in the Japanese calendar
-     * system from the proleptic-year and day-of-year fields.
+     * system from the era, year-of-era and day-of-year fields.
      * <p>
      * This returns a {@code JapaneseDate} with the specified fields.
      * The day must be valid for the year, otherwise an exception will be thrown.
+     * <p>
+     * The day-of-year in this factory is expressed relative to the start of the year-of-era.
+     * This definition changes the normal meaning of day-of-year only in those years
+     * where the year-of-era is reset to one due to a change in the era.
+     * For example:
+     * <pre>
+     *  6th Jan Showa 64 = day-of-year 6
+     *  7th Jan Showa 64 = day-of-year 7
+     *  8th Jan Heisei 1 = day-of-year 1
+     *  9th Jan Heisei 1 = day-of-year 2
+     * </pre>
      *
-     * @param prolepticYear  the chronology proleptic-year
+     * @param era  the Japanese era, not null
+     * @param yearOfEra  the Japanese year-of-era
      * @param dayOfYear  the chronology day-of-year, from 1 to 366
      * @return the date in Japanese calendar system, not null
      * @throws DateTimeException if the value of any field is out of range,
      *  or if the day-of-year is invalid for the year
      */
-    public static JapaneseDate ofYearDay(int prolepticYear, int dayOfYear) {
-        LocalDate date = LocalDate.ofYearDay(prolepticYear, dayOfYear);
-        return of(prolepticYear, date.getMonthValue(), date.getDayOfMonth());
-    }
-
     static JapaneseDate ofYearDay(JapaneseEra era, int yearOfEra, int dayOfYear) {
+        Objects.requireNonNull(era, "era");
         CalendarDate firstDay = era.getPrivateEra().getSinceDate();
         LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null);
         jdate.setEra(era.getPrivateEra());
@@ -254,32 +294,6 @@
     }
 
     /**
-     * Obtains a {@code JapaneseDate} representing a date in the Japanese calendar
-     * system from the era, year-of-era, month-of-year and day-of-month fields.
-     * <p>
-     * This returns a {@code JapaneseDate} with the specified fields.
-     * The day must be valid for the year and month, otherwise an exception will be thrown.
-     *
-     * @param era  the Japanese era, not null
-     * @param yearOfEra  the Japanese year-of-era
-     * @param month  the Japanese month-of-year, from 1 to 12
-     * @param dayOfMonth  the Japanese day-of-month, from 1 to 31
-     * @return the date in Japanese calendar system, not null
-     * @throws DateTimeException if the value of any field is out of range,
-     *  or if the day-of-month is invalid for the month-year
-     */
-    static JapaneseDate of(JapaneseEra era, int yearOfEra, int month, int dayOfMonth) {
-        Objects.requireNonNull(era, "era");
-        LocalGregorianCalendar.Date jdate = JapaneseChronology.JCAL.newCalendarDate(null);
-        jdate.setEra(era.getPrivateEra()).setDate(yearOfEra, month, dayOfMonth);
-        if (!JapaneseChronology.JCAL.validate(jdate)) {
-            throw new DateTimeException("year, month, and day not valid for Era");
-        }
-        LocalDate date = LocalDate.of(jdate.getNormalizedYear(), month, dayOfMonth);
-        return new JapaneseDate(era, yearOfEra, date);
-    }
-
-    /**
      * Obtains a {@code JapaneseDate} from a temporal object.
      * <p>
      * This obtains a date in the Japanese calendar system based on the specified temporal.
@@ -307,6 +321,9 @@
      * @param isoDate  the standard local date, validated not null
      */
     JapaneseDate(LocalDate isoDate) {
+        if (isoDate.isBefore(MEIJI_6_ISODATE)) {
+            throw new DateTimeException("JapaneseDate before Meiji 6 is not supported");
+        }
         LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate);
         this.era = JapaneseEra.toJapaneseEra(jdate.getEra());
         this.yearOfEra = jdate.getYear();
@@ -322,6 +339,9 @@
      * @param isoDate  the standard local date, validated not null
      */
     JapaneseDate(JapaneseEra era, int year, LocalDate isoDate) {
+        if (isoDate.isBefore(MEIJI_6_ISODATE)) {
+            throw new DateTimeException("JapaneseDate before Meiji 6 is not supported");
+        }
         this.era = era;
         this.yearOfEra = year;
         this.isoDate = isoDate;
@@ -366,55 +386,99 @@
         return isoDate.lengthOfMonth();
     }
 
+    @Override
+    public int lengthOfYear() {
+        Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
+        jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
+        jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
+        return  jcal.getActualMaximum(Calendar.DAY_OF_YEAR);
+    }
+
     //-----------------------------------------------------------------------
+    /**
+     * Checks if the specified field is supported.
+     * <p>
+     * This checks if this date can be queried for the specified field.
+     * If false, then calling the {@link #range(TemporalField) range} and
+     * {@link #get(TemporalField) get} methods will throw an exception.
+     * <p>
+     * If the field is a {@link ChronoField} then the query is implemented here.
+     * The supported fields are:
+     * <ul>
+     * <li>{@code DAY_OF_WEEK}
+     * <li>{@code DAY_OF_MONTH}
+     * <li>{@code DAY_OF_YEAR}
+     * <li>{@code EPOCH_DAY}
+     * <li>{@code MONTH_OF_YEAR}
+     * <li>{@code PROLEPTIC_MONTH}
+     * <li>{@code YEAR_OF_ERA}
+     * <li>{@code YEAR}
+     * <li>{@code ERA}
+     * </ul>
+     * All other {@code ChronoField} instances will return false.
+     * <p>
+     * If the field is not a {@code ChronoField}, then the result of this method
+     * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
+     * passing {@code this} as the argument.
+     * Whether the field is supported is determined by the field.
+     *
+     * @param field  the field to check, null returns false
+     * @return true if the field is supported on this date, false if not
+     */
+    @Override
+    public boolean isSupported(TemporalField field) {
+        if (field == ALIGNED_DAY_OF_WEEK_IN_MONTH || field == ALIGNED_DAY_OF_WEEK_IN_YEAR ||
+                field == ALIGNED_WEEK_OF_MONTH || field == ALIGNED_WEEK_OF_YEAR) {
+            return false;
+        }
+        return ChronoLocalDate.super.isSupported(field);
+    }
+
     @Override
     public ValueRange range(TemporalField field) {
         if (field instanceof ChronoField) {
             if (isSupported(field)) {
                 ChronoField f = (ChronoField) field;
                 switch (f) {
-                    case DAY_OF_MONTH:
-                    case ALIGNED_WEEK_OF_MONTH:
-                        return isoDate.range(field);
-                    case DAY_OF_YEAR:
-                        return actualRange(Calendar.DAY_OF_YEAR);
-                    case YEAR_OF_ERA:
-                        return actualRange(Calendar.YEAR);
+                    case DAY_OF_MONTH: return ValueRange.of(1, lengthOfMonth());
+                    case DAY_OF_YEAR: return ValueRange.of(1, lengthOfYear());
+                    case YEAR_OF_ERA: {
+                        Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
+                        jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
+                        jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
+                        return ValueRange.of(1, jcal.getActualMaximum(Calendar.YEAR));
+                    }
                 }
                 return getChronology().range(f);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
 
-    private ValueRange actualRange(int calendarField) {
-        Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
-        jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);  // TODO: cannot calculate this way for SEIREKI
-        jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
-        return ValueRange.of(jcal.getActualMinimum(calendarField),
-                jcal.getActualMaximum(calendarField));
-    }
-
     @Override
     public long getLong(TemporalField field) {
         if (field instanceof ChronoField) {
             // same as ISO:
-            // DAY_OF_WEEK, ALIGNED_DAY_OF_WEEK_IN_MONTH, DAY_OF_MONTH, EPOCH_DAY,
-            // ALIGNED_WEEK_OF_MONTH, MONTH_OF_YEAR, PROLEPTIC_MONTH, YEAR
+            // DAY_OF_WEEK, DAY_OF_MONTH, EPOCH_DAY, MONTH_OF_YEAR, PROLEPTIC_MONTH, YEAR
             //
             // calendar specific fields
-            // ALIGNED_DAY_OF_WEEK_IN_YEAR, DAY_OF_YEAR, ALIGNED_WEEK_OF_YEAR, YEAR_OF_ERA, ERA
+            // DAY_OF_YEAR, YEAR_OF_ERA, ERA
             switch ((ChronoField) field) {
+                case ALIGNED_DAY_OF_WEEK_IN_MONTH:
+                case ALIGNED_DAY_OF_WEEK_IN_YEAR:
+                case ALIGNED_WEEK_OF_MONTH:
+                case ALIGNED_WEEK_OF_YEAR:
+                    throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
                 case YEAR_OF_ERA:
                     return yearOfEra;
                 case ERA:
                     return era.getValue();
-                case DAY_OF_YEAR: {
-                    LocalGregorianCalendar.Date jdate = toPrivateJapaneseDate(isoDate);
-                    return JapaneseChronology.JCAL.getDayOfYear(jdate);
-                }
-                // TODO: ALIGNED_DAY_OF_WEEK_IN_YEAR and ALIGNED_WEEK_OF_YEAR ???
+                case DAY_OF_YEAR:
+                    Calendar jcal = Calendar.getInstance(JapaneseChronology.LOCALE);
+                    jcal.set(Calendar.ERA, era.getValue() + JapaneseEra.ERA_OFFSET);
+                    jcal.set(yearOfEra, isoDate.getMonthValue() - 1, isoDate.getDayOfMonth());
+                    return jcal.get(Calendar.DAY_OF_YEAR);
             }
             return isoDate.getLong(field);
         }
@@ -444,7 +508,7 @@
     public JapaneseDate with(TemporalField field, long newValue) {
         if (field instanceof ChronoField) {
             ChronoField f = (ChronoField) field;
-            if (getLong(f) == newValue) {
+            if (getLong(f) == newValue) {  // getLong() validates for supported fields
                 return this;
             }
             switch (f) {
@@ -464,10 +528,9 @@
                 }
             }
             // YEAR, PROLEPTIC_MONTH and others are same as ISO
-            // TODO: review other fields, such as WEEK_OF_YEAR
             return with(isoDate.with(field, newValue));
         }
-        return ChronoLocalDate.super.with(field, newValue);
+        return super.with(field, newValue);
     }
 
     /**
@@ -592,13 +655,14 @@
     }
 
     @Override        // for javadoc and covariant return type
+    @SuppressWarnings("unchecked")
     public final ChronoLocalDateTime<JapaneseDate> atTime(LocalTime localTime) {
-        return super.atTime(localTime);
+        return (ChronoLocalDateTime<JapaneseDate>)super.atTime(localTime);
     }
 
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
-        return isoDate.periodUntil(endDate);
+    public Period until(ChronoLocalDate endDate) {
+        return isoDate.until(endDate);
     }
 
     @Override  // override for performance
@@ -624,14 +688,6 @@
         return getChronology().getId().hashCode() ^ isoDate.hashCode();
     }
 
-    @Override
-    public String toString() {
-        if (era == JapaneseEra.SEIREKI) {
-            return getChronology().getId() + " " + isoDate.toString();
-        }
-        return super.toString();
-    }
-
     //-----------------------------------------------------------------------
     private Object writeReplace() {
         return new Ser(Ser.JAPANESE_DATE_TYPE, this);
--- a/jdk/src/share/classes/java/time/chrono/JapaneseEra.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/JapaneseEra.java	Tue Aug 06 16:54:56 2013 -0700
@@ -61,6 +61,7 @@
  */
 package java.time.chrono;
 
+import static java.time.chrono.JapaneseDate.MEIJI_6_ISODATE;
 import static java.time.temporal.ChronoField.ERA;
 
 import java.io.DataInput;
@@ -84,12 +85,9 @@
  * An era in the Japanese Imperial calendar system.
  * <p>
  * This class defines the valid eras for the Japanese chronology.
- * Only Meiji (1868-09-08 - 1912-07-29) and later eras are supported.
- * Japan introduced the Gregorian calendar since Meiji 6. The dates
- * between Meiji 1 - 5 are not historically correct.
- * The older eras are recognized as Seireki (Western calendar) era,
- * and the year of era of Seireki is proleptic Gregorian year.
- * (The Julian to Gregorian transition is not supported.)
+ * Japan introduced the Gregorian calendar starting with Meiji 6.
+ * Only Meiji and later eras are supported;
+ * dates before Meiji 6, January 1 are not supported.
  *
  * @implSpec
  * This class is immutable and thread-safe.
@@ -100,17 +98,12 @@
         implements Era, Serializable {
 
     // The offset value to 0-based index from the era value.
-    // i.e., getValue() + ERA_OFFSET == 0-based index; except that -999 is mapped to zero
+    // i.e., getValue() + ERA_OFFSET == 0-based index
     static final int ERA_OFFSET = 2;
 
     static final sun.util.calendar.Era[] ERA_CONFIG;
 
     /**
-     * The singleton instance for the before Meiji era ( - 1868-09-07)
-     * which has the value -999.
-     */
-    public static final JapaneseEra SEIREKI = new JapaneseEra(-999, LocalDate.MIN);
-    /**
      * The singleton instance for the 'Meiji' era (1868-09-08 - 1912-07-29)
      * which has the value -1.
      */
@@ -144,17 +137,13 @@
     private static final JapaneseEra[] KNOWN_ERAS;
 
     static {
-        sun.util.calendar.Era[] sunEras = JapaneseChronology.JCAL.getEras();
-        ERA_CONFIG = new sun.util.calendar.Era[sunEras.length + 1];
-        for (int i = 1; i < ERA_CONFIG.length; i++) {
-            ERA_CONFIG[i] = sunEras[i - 1];
-        }
+        ERA_CONFIG = JapaneseChronology.JCAL.getEras();
+
         KNOWN_ERAS = new JapaneseEra[ERA_CONFIG.length];
-        KNOWN_ERAS[0] = SEIREKI;
-        KNOWN_ERAS[1] = MEIJI;
-        KNOWN_ERAS[2] = TAISHO;
-        KNOWN_ERAS[3] = SHOWA;
-        KNOWN_ERAS[4] = HEISEI;
+        KNOWN_ERAS[0] = MEIJI;
+        KNOWN_ERAS[1] = TAISHO;
+        KNOWN_ERAS[2] = SHOWA;
+        KNOWN_ERAS[3] = HEISEI;
         for (int i = N_ERA_CONSTANTS; i < ERA_CONFIG.length; i++) {
             CalendarDate date = ERA_CONFIG[i].getSinceDate();
             LocalDate isoDate = LocalDate.of(date.getYear(), date.getMonth(), date.getDayOfMonth());
@@ -203,10 +192,8 @@
     //-----------------------------------------------------------------------
     /**
      * Returns the Sun private Era instance corresponding to this {@code JapaneseEra}.
-     * SEIREKI doesn't have its corresponding one.
      *
-     * @return the Sun private Era instance for this {@code JapaneseEra},
-     *         or null for SEIREKI.
+     * @return the Sun private Era instance for this {@code JapaneseEra}.
      */
     sun.util.calendar.Era getPrivateEra() {
         return ERA_CONFIG[ordinal(eraValue)];
@@ -218,16 +205,14 @@
      * <p>
      * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1
      * Later era is numbered 2 ({@link #HEISEI}). Earlier eras are numbered 0 ({@link #TAISHO}),
-     * -1 ({@link #MEIJI}), only Meiji and later eras are supported. The prior to Meiji,
-     * {@link #SEIREKI} is used.
+     * -1 ({@link #MEIJI}), only Meiji and later eras are supported.
      *
      * @param japaneseEra  the era to represent
      * @return the {@code JapaneseEra} singleton, not null
      * @throws DateTimeException if the value is invalid
      */
     public static JapaneseEra of(int japaneseEra) {
-        if (japaneseEra != SEIREKI.eraValue &&
-            (japaneseEra < MEIJI.eraValue || japaneseEra > HEISEI.eraValue)) {
+        if (japaneseEra < MEIJI.eraValue || japaneseEra > HEISEI.eraValue) {
             throw new DateTimeException("Invalid era: " + japaneseEra);
         }
         return KNOWN_ERAS[ordinal(japaneseEra)];
@@ -276,22 +261,25 @@
      * @return the Era singleton, never null
      */
     static JapaneseEra from(LocalDate date) {
+        if (date.isBefore(MEIJI_6_ISODATE)) {
+            throw new DateTimeException("JapaneseDate before Meiji 6 are not supported");
+        }
         for (int i = KNOWN_ERAS.length - 1; i > 0; i--) {
             JapaneseEra era = KNOWN_ERAS[i];
             if (date.compareTo(era.since) >= 0) {
                 return era;
             }
         }
-        return SEIREKI;
+        return null;
     }
 
     static JapaneseEra toJapaneseEra(sun.util.calendar.Era privateEra) {
-        for (int i = ERA_CONFIG.length - 1; i > 0; i--) {
+        for (int i = ERA_CONFIG.length - 1; i >= 0; i--) {
             if (ERA_CONFIG[i].equals(privateEra)) {
                 return KNOWN_ERAS[i];
             }
         }
-        return SEIREKI;
+        return null;
     }
 
     static sun.util.calendar.Era privateEraFrom(LocalDate isoDate) {
@@ -306,13 +294,13 @@
 
     /**
      * Returns the index into the arrays from the Era value.
-     * the eraValue is a valid Era number, -999, -1..2.
+     * the eraValue is a valid Era number, -1..2.
      *
      * @param eraValue  the era value to convert to the index
      * @return the index of the current Era
      */
     private static int ordinal(int eraValue) {
-        return (eraValue == SEIREKI.eraValue) ? 0 : eraValue + ERA_OFFSET;
+        return eraValue + ERA_OFFSET - 1;
     }
 
     //-----------------------------------------------------------------------
@@ -321,7 +309,7 @@
      * <p>
      * The {@link #SHOWA} era that contains 1970-01-01 (ISO calendar system) has the value 1.
      * Later eras are numbered from 2 ({@link #HEISEI}).
-     * Earlier eras are numbered 0 ({@link #TAISHO}), -1 ({@link #MEIJI}), and -999 ({@link #SEIREKI}).
+     * Earlier eras are numbered 0 ({@link #TAISHO}), -1 ({@link #MEIJI})).
      *
      * @return the era value
      */
@@ -374,11 +362,7 @@
     }
 
     String getName() {
-        int index = ordinal(getValue());
-        if (index == 0) {
-            return "Seireki";
-        }
-        return ERA_CONFIG[index].getName();
+        return ERA_CONFIG[ordinal(getValue())].getName();
     }
 
     @Override
--- a/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/MinguoChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -65,12 +65,15 @@
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.ZoneId;
+import java.time.format.ResolverStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalField;
 import java.time.temporal.ValueRange;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 /**
  * The Minguo calendar system.
@@ -253,16 +256,19 @@
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoLocalDateTime<MinguoDate> localDateTime(TemporalAccessor temporal) {
         return (ChronoLocalDateTime<MinguoDate>)super.localDateTime(temporal);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoZonedDateTime<MinguoDate> zonedDateTime(TemporalAccessor temporal) {
         return (ChronoZonedDateTime<MinguoDate>)super.zonedDateTime(temporal);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoZonedDateTime<MinguoDate> zonedDateTime(Instant instant, ZoneId zone) {
         return (ChronoZonedDateTime<MinguoDate>)super.zonedDateTime(instant, zone);
     }
@@ -292,7 +298,7 @@
     }
 
     @Override
-    public Era eraOf(int eraValue) {
+    public MinguoEra eraOf(int eraValue) {
         return MinguoEra.of(eraValue);
     }
 
@@ -321,4 +327,10 @@
         return field.range();
     }
 
+    //-----------------------------------------------------------------------
+    @Override  // override for return type
+    public MinguoDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        return (MinguoDate) super.resolveDate(fieldValues, resolverStyle);
+    }
+
 }
--- a/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/MinguoDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -96,7 +96,7 @@
  */
 public final class MinguoDate
         extends ChronoDateImpl<MinguoDate>
-        implements ChronoLocalDate<MinguoDate>, Serializable {
+        implements ChronoLocalDate, Serializable {
 
     /**
      * Serialization version.
@@ -152,7 +152,7 @@
      * @throws DateTimeException if the current date cannot be obtained
      */
     public static MinguoDate now(Clock clock) {
-        return MinguoChronology.INSTANCE.date(LocalDate.now(clock));
+        return new MinguoDate(LocalDate.now(clock));
     }
 
     /**
@@ -264,7 +264,7 @@
                 }
                 return getChronology().range(f);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
@@ -325,7 +325,7 @@
             }
             return with(isoDate.with(field, newValue));
         }
-        return ChronoLocalDate.super.with(field, newValue);
+        return super.with(field, newValue);
     }
 
     /**
@@ -370,6 +370,11 @@
     }
 
     @Override
+    MinguoDate plusWeeks(long weeksToAdd) {
+        return super.plusWeeks(weeksToAdd);
+    }
+
+    @Override
     MinguoDate plusDays(long days) {
         return with(isoDate.plusDays(days));
     }
@@ -385,11 +390,6 @@
     }
 
     @Override
-    MinguoDate plusWeeks(long weeksToAdd) {
-        return super.plusWeeks(weeksToAdd);
-    }
-
-    @Override
     MinguoDate minusYears(long yearsToSubtract) {
         return super.minusYears(yearsToSubtract);
     }
@@ -414,13 +414,14 @@
     }
 
     @Override        // for javadoc and covariant return type
+    @SuppressWarnings("unchecked")
     public final ChronoLocalDateTime<MinguoDate> atTime(LocalTime localTime) {
-        return super.atTime(localTime);
+        return (ChronoLocalDateTime<MinguoDate>)super.atTime(localTime);
     }
 
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
-        return isoDate.periodUntil(endDate);
+    public Period until(ChronoLocalDate endDate) {
+        return isoDate.until(endDate);
     }
 
     @Override  // override for performance
@@ -458,7 +459,7 @@
         out.writeByte(get(DAY_OF_MONTH));
     }
 
-    static ChronoLocalDate<?> readExternal(DataInput in) throws IOException {
+    static MinguoDate readExternal(DataInput in) throws IOException {
         int year = in.readInt();
         int month = in.readByte();
         int dayOfMonth = in.readByte();
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -65,13 +65,16 @@
 import java.time.Instant;
 import java.time.LocalDate;
 import java.time.ZoneId;
+import java.time.format.ResolverStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalField;
 import java.time.temporal.ValueRange;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 /**
  * The Thai Buddhist calendar system.
@@ -289,16 +292,19 @@
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoLocalDateTime<ThaiBuddhistDate> localDateTime(TemporalAccessor temporal) {
         return (ChronoLocalDateTime<ThaiBuddhistDate>)super.localDateTime(temporal);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoZonedDateTime<ThaiBuddhistDate> zonedDateTime(TemporalAccessor temporal) {
         return (ChronoZonedDateTime<ThaiBuddhistDate>)super.zonedDateTime(temporal);
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     public ChronoZonedDateTime<ThaiBuddhistDate> zonedDateTime(Instant instant, ZoneId zone) {
         return (ChronoZonedDateTime<ThaiBuddhistDate>)super.zonedDateTime(instant, zone);
     }
@@ -328,7 +334,7 @@
     }
 
     @Override
-    public Era eraOf(int eraValue) {
+    public ThaiBuddhistEra eraOf(int eraValue) {
         return ThaiBuddhistEra.of(eraValue);
     }
 
@@ -357,4 +363,10 @@
         return field.range();
     }
 
+    //-----------------------------------------------------------------------
+    @Override  // override for return type
+    public ThaiBuddhistDate resolveDate(Map<TemporalField, Long> fieldValues, ResolverStyle resolverStyle) {
+        return (ThaiBuddhistDate) super.resolveDate(fieldValues, resolverStyle);
+    }
+
 }
--- a/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/ThaiBuddhistDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -96,7 +96,7 @@
  */
 public final class ThaiBuddhistDate
         extends ChronoDateImpl<ThaiBuddhistDate>
-        implements ChronoLocalDate<ThaiBuddhistDate>, Serializable {
+        implements ChronoLocalDate, Serializable {
 
     /**
      * Serialization version.
@@ -152,7 +152,7 @@
      * @throws DateTimeException if the current date cannot be obtained
      */
     public static ThaiBuddhistDate now(Clock clock) {
-        return ThaiBuddhistChronology.INSTANCE.date(LocalDate.now(clock));
+        return new ThaiBuddhistDate(LocalDate.now(clock));
     }
 
     /**
@@ -264,7 +264,7 @@
                 }
                 return getChronology().range(f);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
@@ -325,7 +325,7 @@
             }
             return with(isoDate.with(field, newValue));
         }
-        return ChronoLocalDate.super.with(field, newValue);
+        return super.with(field, newValue);
     }
 
     /**
@@ -414,13 +414,14 @@
     }
 
     @Override        // for javadoc and covariant return type
+    @SuppressWarnings("unchecked")
     public final ChronoLocalDateTime<ThaiBuddhistDate> atTime(LocalTime localTime) {
-        return super.atTime(localTime);
+        return (ChronoLocalDateTime<ThaiBuddhistDate>) super.atTime(localTime);
     }
 
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
-        return isoDate.periodUntil(endDate);
+    public Period until(ChronoLocalDate endDate) {
+        return isoDate.until(endDate);
     }
 
     @Override  // override for performance
--- a/jdk/src/share/classes/java/time/chrono/package-info.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/chrono/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -103,7 +103,7 @@
  *   // Enumerate the list of available calendars and print todays date for each.
  *       Set&lt;Chronology&gt; chronos = Chronology.getAvailableChronologies();
  *       for (Chronology chrono : chronos) {
- *           ChronoLocalDate&lt;?&gt; date = chrono.dateNow();
+ *           ChronoLocalDate date = chrono.dateNow();
  *           System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
  *       }
  * </pre>
@@ -113,7 +113,7 @@
  * </p>
  * <pre>
  *   // Print the Thai Buddhist date
- *       ChronoLocalDate&lt;?&gt; now1 = Chronology.of("ThaiBuddhist").dateNow();
+ *       ChronoLocalDate now1 = Chronology.of("ThaiBuddhist").dateNow();
  *       int day = now1.get(ChronoField.DAY_OF_MONTH);
  *       int dow = now1.get(ChronoField.DAY_OF_WEEK);
  *       int month = now1.get(ChronoField.MONTH_OF_YEAR);
@@ -121,10 +121,10 @@
  *       System.out.printf("  Today is %s %s %d-%s-%d%n", now1.getChronology().getId(),
  *                 dow, day, month, year);
  *   // Print today's date and the last day of the year for the Thai Buddhist Calendar.
- *       ChronoLocalDate&lt;?&gt; first = now1
+ *       ChronoLocalDate first = now1
  *                 .with(ChronoField.DAY_OF_MONTH, 1)
  *                 .with(ChronoField.MONTH_OF_YEAR, 1);
- *       ChronoLocalDate&lt;?&gt; last = first
+ *       ChronoLocalDate last = first
  *                 .plus(1, ChronoUnit.YEARS)
  *                 .minus(1, ChronoUnit.DAYS);
  *       System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -265,7 +265,7 @@
  * <p>
  * For example:
  * <blockquote><pre>
- *  DateTimeFormatter formatter = DateTimeFormatter.pattern("yyyy MM dd");
+ *  DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy MM dd");
  *  String text = date.toString(formatter);
  *  LocalDate date = LocalDate.parse(text, formatter);
  * </pre></blockquote>
@@ -460,7 +460,7 @@
  * <li>The {@code ChronoField} time fields are resolved.
  * This is documented on {@link ChronoField} and is the same for all chronologies.
  * <li>Any fields that are not {@code ChronoField} are processed.
- * This is achieved using {@link TemporalField#resolve(TemporalAccessor, long, ResolverStyle)}.
+ * This is achieved using {@link TemporalField#resolve(Map, Chronology, ZoneId, ResolverStyle)}.
  * Documentation about field resolution is located in the implementation
  * of {@code TemporalField}.
  * <li>The {@code ChronoField} date and time fields are re-resolved.
--- a/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/format/DateTimeFormatterBuilder.java	Tue Aug 06 16:54:56 2013 -0700
@@ -77,7 +77,6 @@
 import java.math.RoundingMode;
 import java.text.ParsePosition;
 import java.time.DateTimeException;
-import java.time.Duration;
 import java.time.Instant;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
@@ -962,12 +961,9 @@
      * <pre>
      *   "Europe/London"           -- ZoneId.of("Europe/London")
      *   "Z"                       -- ZoneOffset.UTC
-     *   "UT"                      -- ZoneOffset.UTC
-     *   "UTC"                     -- ZoneOffset.UTC
-     *   "GMT"                     -- ZoneOffset.UTC
-     *   "UT0"                     -- ZoneOffset.UTC
-     *   "UTC0"                    -- ZoneOffset.UTC
-     *   "GMT0"                    -- ZoneOffset.UTC
+     *   "UT"                      -- ZoneId.of("UT")
+     *   "UTC"                     -- ZoneId.of("UTC")
+     *   "GMT"                     -- ZoneId.of("GMT")
      *   "+01:30"                  -- ZoneOffset.of("+01:30")
      *   "UT+01:30"                -- ZoneOffset.of("+01:30")
      *   "UTC+01:30"               -- ZoneOffset.of("+01:30")
@@ -1016,12 +1012,9 @@
      * <pre>
      *   "Europe/London"           -- ZoneId.of("Europe/London")
      *   "Z"                       -- ZoneOffset.UTC
-     *   "UT"                      -- ZoneOffset.UTC
-     *   "UTC"                     -- ZoneOffset.UTC
-     *   "GMT"                     -- ZoneOffset.UTC
-     *   "UT0"                     -- ZoneOffset.UTC
-     *   "UTC0"                    -- ZoneOffset.UTC
-     *   "GMT0"                    -- ZoneOffset.UTC
+     *   "UT"                      -- ZoneId.of("UT")
+     *   "UTC"                     -- ZoneId.of("UTC")
+     *   "GMT"                     -- ZoneId.of("GMT")
      *   "+01:30"                  -- ZoneOffset.of("+01:30")
      *   "UT+01:30"                -- ZoneOffset.of("+01:30")
      *   "UTC+01:30"               -- ZoneOffset.of("+01:30")
@@ -1077,16 +1070,13 @@
      * <pre>
      *   "Europe/London"           -- ZoneId.of("Europe/London")
      *   "Z"                       -- ZoneOffset.UTC
-     *   "UT"                      -- ZoneOffset.UTC
-     *   "UTC"                     -- ZoneOffset.UTC
-     *   "GMT"                     -- ZoneOffset.UTC
-     *   "UT0"                     -- ZoneOffset.UTC
-     *   "UTC0"                    -- ZoneOffset.UTC
-     *   "GMT0"                    -- ZoneOffset.UTC
+     *   "UT"                      -- ZoneId.of("UT")
+     *   "UTC"                     -- ZoneId.of("UTC")
+     *   "GMT"                     -- ZoneId.of("GMT")
      *   "+01:30"                  -- ZoneOffset.of("+01:30")
-     *   "UT+01:30"                -- ZoneOffset.of("+01:30")
-     *   "UTC+01:30"               -- ZoneOffset.of("+01:30")
-     *   "GMT+01:30"               -- ZoneOffset.of("+01:30")
+     *   "UT+01:30"                -- ZoneOffset.of("UT+01:30")
+     *   "UTC+01:30"               -- ZoneOffset.of("UTC+01:30")
+     *   "GMT+01:30"               -- ZoneOffset.of("GMT+01:30")
      * </pre>
      * <p>
      * Note that this method is is identical to {@code appendZoneId()} except
@@ -2530,7 +2520,7 @@
             DecimalStyle decimalStyle = context.getDecimalStyle();
             String str = (value == Long.MIN_VALUE ? "9223372036854775808" : Long.toString(Math.abs(value)));
             if (str.length() > maxWidth) {
-                throw new DateTimeException("Field " + field.getName() +
+                throw new DateTimeException("Field " + field +
                     " cannot be printed as the value " + value +
                     " exceeds the maximum print width of " + maxWidth);
             }
@@ -2555,7 +2545,7 @@
                         buf.append(decimalStyle.getNegativeSign());
                         break;
                     case NOT_NEGATIVE:
-                        throw new DateTimeException("Field " + field.getName() +
+                        throw new DateTimeException("Field " + field +
                             " cannot be printed as the value " + value +
                             " cannot be negative according to the SignStyle");
                 }
@@ -2699,12 +2689,12 @@
         @Override
         public String toString() {
             if (minWidth == 1 && maxWidth == 19 && signStyle == SignStyle.NORMAL) {
-                return "Value(" + field.getName() + ")";
+                return "Value(" + field + ")";
             }
             if (minWidth == maxWidth && signStyle == SignStyle.NOT_NEGATIVE) {
-                return "Value(" + field.getName() + "," + minWidth + ")";
+                return "Value(" + field + "," + minWidth + ")";
             }
-            return "Value(" + field.getName() + "," + minWidth + "," + maxWidth + "," + signStyle + ")";
+            return "Value(" + field + "," + minWidth + "," + maxWidth + "," + signStyle + ")";
         }
     }
 
@@ -2817,7 +2807,7 @@
 
         @Override
         public String toString() {
-            return "ReducedValue(" + field.getName() + "," + minWidth + "," + maxWidth + "," + baseValue + ")";
+            return "ReducedValue(" + field + "," + minWidth + "," + maxWidth + "," + baseValue + ")";
         }
     }
 
@@ -2842,7 +2832,7 @@
         FractionPrinterParser(TemporalField field, int minWidth, int maxWidth, boolean decimalPoint) {
             Objects.requireNonNull(field, "field");
             if (field.range().isFixed() == false) {
-                throw new IllegalArgumentException("Field must have a fixed set of values: " + field.getName());
+                throw new IllegalArgumentException("Field must have a fixed set of values: " + field);
             }
             if (minWidth < 0 || minWidth > 9) {
                 throw new IllegalArgumentException("Minimum width must be from 0 to 9 inclusive but was " + minWidth);
@@ -2984,7 +2974,7 @@
         @Override
         public String toString() {
             String decimal = (decimalPoint ? ",DecimalPoint" : "");
-            return "Fraction(" + field.getName() + "," + minWidth + "," + maxWidth + decimal + ")";
+            return "Fraction(" + field + "," + minWidth + "," + maxWidth + decimal + ")";
         }
     }
 
@@ -3079,9 +3069,9 @@
         @Override
         public String toString() {
             if (textStyle == TextStyle.FULL) {
-                return "Text(" + field.getName() + ")";
+                return "Text(" + field + ")";
             }
-            return "Text(" + field.getName() + "," + textStyle + ")";
+            return "Text(" + field + "," + textStyle + ")";
         }
     }
 
@@ -3756,17 +3746,17 @@
             // handle fixed time-zone IDs
             char nextChar = text.charAt(position);
             if (nextChar == '+' || nextChar == '-') {
-                return parseOffsetBased(context, text, position, OffsetIdPrinterParser.INSTANCE_ID_Z);
+                return parseOffsetBased(context, text, position, position, OffsetIdPrinterParser.INSTANCE_ID_Z);
             } else if (length >= position + 2) {
                 char nextNextChar = text.charAt(position + 1);
                 if (context.charEquals(nextChar, 'U') && context.charEquals(nextNextChar, 'T')) {
                     if (length >= position + 3 && context.charEquals(text.charAt(position + 2), 'C')) {
-                        return parseOffsetBased(context, text, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
+                        return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
                     }
-                    return parseOffsetBased(context, text, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
+                    return parseOffsetBased(context, text, position, position + 2, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
                 } else if (context.charEquals(nextChar, 'G') && length >= position + 3 &&
                         context.charEquals(nextNextChar, 'M') && context.charEquals(text.charAt(position + 2), 'T')) {
-                    return parseOffsetBased(context, text, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
+                    return parseOffsetBased(context, text, position, position + 3, OffsetIdPrinterParser.INSTANCE_ID_ZERO);
                 }
             }
 
@@ -3785,20 +3775,49 @@
             return ppos.getIndex();
         }
 
-        private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int position, OffsetIdPrinterParser parser) {
+        /**
+         * Parse an offset following a prefix and set the ZoneId if it is valid.
+         * To matching the parsing of ZoneId.of the values are not normalized
+         * to ZoneOffsets.
+         *
+         * @param context the parse context
+         * @param text the input text
+         * @param prefixPos start of the prefix
+         * @param position start of text after the prefix
+         * @param parser parser for the value after the prefix
+         * @return the position after the parse
+         */
+        private int parseOffsetBased(DateTimeParseContext context, CharSequence text, int prefixPos, int position, OffsetIdPrinterParser parser) {
+            String prefix = text.toString().substring(prefixPos, position).toUpperCase();
+            if (position >= text.length()) {
+                context.setParsed(ZoneId.of(prefix));
+                return position;
+            }
+
+            // '0' or 'Z' after prefix is not part of a valid ZoneId; use bare prefix
+            if (text.charAt(position) == '0' ||
+                context.charEquals(text.charAt(position), 'Z')) {
+                context.setParsed(ZoneId.of(prefix));
+                return position;
+            }
+
             DateTimeParseContext newContext = context.copy();
             int endPos = parser.parse(newContext, text, position);
-            if (endPos < 0) {
-                if (parser == OffsetIdPrinterParser.INSTANCE_ID_Z) {
-                    return ~position;
+            try {
+                if (endPos < 0) {
+                    if (parser == OffsetIdPrinterParser.INSTANCE_ID_Z) {
+                        return ~prefixPos;
+                    }
+                    context.setParsed(ZoneId.of(prefix));
+                    return position;
                 }
-                context.setParsed(ZoneOffset.UTC);
-                return position;
+                int offset = (int) newContext.getParsed(OFFSET_SECONDS).longValue();
+                ZoneOffset zoneOffset = ZoneOffset.ofTotalSeconds(offset);
+                context.setParsed(ZoneId.ofOffset(prefix, zoneOffset));
+                return endPos;
+            } catch (DateTimeException dte) {
+                return ~prefixPos;
             }
-            int offset = (int) newContext.getParsed(OFFSET_SECONDS).longValue();
-            ZoneId zone = ZoneOffset.ofTotalSeconds(offset);
-            context.setParsed(zone);
-            return endPos;
         }
 
         @Override
--- a/jdk/src/share/classes/java/time/format/DateTimePrintContext.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/format/DateTimePrintContext.java	Tue Aug 06 16:54:56 2013 -0700
@@ -157,7 +157,7 @@
             }
         }
         final ZoneId effectiveZone = (overrideZone != null ? overrideZone : temporalZone);
-        final ChronoLocalDate<?> effectiveDate;
+        final ChronoLocalDate effectiveDate;
         if (overrideChrono != null) {
             if (temporal.isSupported(EPOCH_DAY)) {
                 effectiveDate = effectiveChrono.date(temporal);
--- a/jdk/src/share/classes/java/time/format/Parsed.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/format/Parsed.java	Tue Aug 06 16:54:56 2013 -0700
@@ -143,7 +143,7 @@
     /**
      * The resolved date.
      */
-    private ChronoLocalDate<?> date;
+    private ChronoLocalDate date;
     /**
      * The resolved time.
      */
@@ -197,7 +197,7 @@
             return time.getLong(field);
         }
         if (field instanceof ChronoField) {
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
@@ -255,42 +255,34 @@
         // if any other fields, handle them
         // any lenient date resolution should return epoch-day
         if (fieldValues.size() > 0) {
-            boolean changed = false;
+            int changedCount = 0;
             outer:
-            while (true) {
+            while (changedCount < 50) {
                 for (Map.Entry<TemporalField, Long> entry : fieldValues.entrySet()) {
                     TemporalField targetField = entry.getKey();
-                    Map<TemporalField, Long> changes = targetField.resolve(this, entry.getValue(), resolverStyle);
-                    if (changes != null) {
-                        changed = true;
-                        resolveFieldsMakeChanges(targetField, changes);
-                        fieldValues.remove(targetField);  // helps avoid infinite loops
+                    ChronoLocalDate resolvedDate = targetField.resolve(fieldValues, chrono, zone, resolverStyle);
+                    if (resolvedDate != null) {
+                        updateCheckConflict(resolvedDate);
+                        changedCount++;
+                        continue outer;  // have to restart to avoid concurrent modification
+                    } else if (fieldValues.containsKey(targetField) == false) {
+                        changedCount++;
                         continue outer;  // have to restart to avoid concurrent modification
                     }
                 }
                 break;
             }
+            if (changedCount == 50) {  // catch infinite loops
+                throw new DateTimeException("One of the parsed fields has an incorrectly implemented resolve method");
+            }
             // if something changed then have to redo ChronoField resolve
-            if (changed) {
+            if (changedCount > 0) {
                 resolveDateFields();
                 resolveTimeFields();
             }
         }
     }
 
-    private void resolveFieldsMakeChanges(TemporalField targetField, Map<TemporalField, Long> changes) {
-        for (Map.Entry<TemporalField, Long> change : changes.entrySet()) {
-            TemporalField changeField = change.getKey();
-            Long changeValue = change.getValue();
-            Objects.requireNonNull(changeField, "changeField");
-            if (changeValue != null) {
-                updateCheckConflict(targetField, changeField, changeValue);
-            } else {
-                fieldValues.remove(changeField);
-            }
-        }
-    }
-
     private void updateCheckConflict(TemporalField targetField, TemporalField changeField, Long changeValue) {
         Long old = fieldValues.put(changeField, changeValue);
         if (old != null && old.longValue() != changeValue.longValue()) {
@@ -305,7 +297,7 @@
         updateCheckConflict(chrono.resolveDate(fieldValues, resolverStyle));
     }
 
-    private void updateCheckConflict(ChronoLocalDate<?> cld) {
+    private void updateCheckConflict(ChronoLocalDate cld) {
         if (date != null) {
             if (cld != null && date.equals(cld) == false) {
                 throw new DateTimeException("Conflict found: Fields resolved to two different dates: " + date + " " + cld);
--- a/jdk/src/share/classes/java/time/temporal/ChronoField.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/ChronoField.java	Tue Aug 06 16:54:56 2013 -0700
@@ -403,6 +403,12 @@
      * Non-ISO calendar systems should implement this field using the most recognized
      * day-of-year values for users of the calendar system.
      * Normally, this is a count of days from 1 to the length of the year.
+     * <p>
+     * Note that a non-ISO calendar system may have year numbering system that changes
+     * at a different point to the natural reset in the month numbering. An example
+     * of this is the Japanese calendar system where a change of era, which resets
+     * the year number to 1, can happen on any date. The era and year reset also cause
+     * the day-of-year to be reset to 1, but not the month-of-year or day-of-month.
      */
     DAY_OF_YEAR("DayOfYear", DAYS, YEARS, ValueRange.of(1, 365, 366)),
     /**
@@ -559,12 +565,11 @@
      * <p>
      * This represents the concept of the sequential count of seconds where
      * 1970-01-01T00:00Z (ISO) is zero.
-     * This field may be used with {@link #NANO_OF_DAY} to represent the fraction of the day.
+     * This field may be used with {@link #NANO_OF_SECOND} to represent the fraction of the second.
      * <p>
      * An {@link Instant} represents an instantaneous point on the time-line.
-     * On their own they have no elements which allow a local date-time to be obtained.
-     * Only when paired with an offset or time-zone can the local date or time be found.
-     * This field allows the seconds part of the instant to be queried.
+     * On their own, an instant has insufficient information to allow a local date-time to be obtained.
+     * Only when paired with an offset or time-zone can the local date or time be calculated.
      * <p>
      * This field is strictly defined to have the same meaning in all calendar systems.
      * This is necessary to ensure interoperation between calendars.
@@ -608,24 +613,18 @@
         this.displayNameKey = displayNameKey;
     }
 
-    //-----------------------------------------------------------------------
-    @Override
-    public String getName() {
-        return name;
-    }
-
     @Override
     public String getDisplayName(Locale locale) {
         Objects.requireNonNull(locale, "locale");
         if (displayNameKey == null) {
-            return getName();
+            return name;
         }
 
         LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
                                     .getLocaleResources(locale);
         ResourceBundle rb = lr.getJavaTimeFormatData();
         String key = "field." + displayNameKey;
-        return rb.containsKey(key) ? rb.getString(key) : getName();
+        return rb.containsKey(key) ? rb.getString(key) : name;
     }
 
     @Override
@@ -748,7 +747,7 @@
     //-----------------------------------------------------------------------
     @Override
     public String toString() {
-        return getName();
+        return name;
     }
 
 }
--- a/jdk/src/share/classes/java/time/temporal/ChronoUnit.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/ChronoUnit.java	Tue Aug 06 16:54:56 2013 -0700
@@ -57,9 +57,6 @@
 package java.time.temporal;
 
 import java.time.Duration;
-import java.time.chrono.ChronoLocalDate;
-import java.time.chrono.ChronoLocalDateTime;
-import java.time.chrono.ChronoZonedDateTime;
 
 /**
  * A standard set of date periods units.
@@ -201,12 +198,6 @@
     }
 
     //-----------------------------------------------------------------------
-    @Override
-    public String getName() {
-        return name;
-    }
-
-    //-----------------------------------------------------------------------
     /**
      * Gets the estimated duration of this unit in the ISO calendar system.
      * <p>
@@ -233,41 +224,40 @@
      */
     @Override
     public boolean isDurationEstimated() {
-        return isDateUnit();
+        return this.compareTo(DAYS) >= 0;
     }
 
     //-----------------------------------------------------------------------
     /**
      * Checks if this unit is a date unit.
+     * <p>
+     * All units from days to eras inclusive are date-based.
+     * Time-based units and {@code FOREVER} return false.
      *
      * @return true if a date unit, false if a time unit
      */
-    public boolean isDateUnit() {
-        return this.compareTo(DAYS) >= 0;
+    @Override
+    public boolean isDateBased() {
+        return this.compareTo(DAYS) >= 0 && this != FOREVER;
     }
 
     /**
      * Checks if this unit is a time unit.
+     * <p>
+     * All units from nanos to half-days inclusive are time-based.
+     * Date-based units and {@code FOREVER} return false.
      *
      * @return true if a time unit, false if a date unit
      */
-    public boolean isTimeUnit() {
+    @Override
+    public boolean isTimeBased() {
         return this.compareTo(DAYS) < 0;
     }
 
     //-----------------------------------------------------------------------
     @Override
     public boolean isSupportedBy(Temporal temporal) {
-        if (this == FOREVER) {
-            return false;
-        }
-        if (temporal instanceof ChronoLocalDate) {
-            return isDateUnit();
-        }
-        if (temporal instanceof ChronoLocalDateTime || temporal instanceof ChronoZonedDateTime) {
-            return true;
-        }
-        return TemporalUnit.super.isSupportedBy(temporal);
+        return temporal.isSupported(this);
     }
 
     @SuppressWarnings("unchecked")
@@ -279,13 +269,13 @@
     //-----------------------------------------------------------------------
     @Override
     public long between(Temporal temporal1, Temporal temporal2) {
-        return temporal1.periodUntil(temporal2, this);
+        return temporal1.until(temporal2, this);
     }
 
     //-----------------------------------------------------------------------
     @Override
     public String toString() {
-        return getName();
+        return name;
     }
 
 }
--- a/jdk/src/share/classes/java/time/temporal/IsoFields.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/IsoFields.java	Tue Aug 06 16:54:56 2013 -0700
@@ -71,6 +71,8 @@
 
 import java.time.Duration;
 import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
 import java.time.chrono.IsoChronology;
 import java.time.format.ResolverStyle;
@@ -289,10 +291,6 @@
     private static enum Field implements TemporalField {
         DAY_OF_QUARTER {
             @Override
-            public String getName() {
-                return "DayOfQuarter";
-            }
-            @Override
             public TemporalUnit getBaseUnit() {
                 return DAYS;
             }
@@ -344,17 +342,21 @@
                 return (R) temporal.with(DAY_OF_YEAR, temporal.getLong(DAY_OF_YEAR) + (newValue - curValue));
             }
             @Override
-            public Map<TemporalField, Long> resolve(TemporalAccessor temporal, long doq, ResolverStyle resolverStyle) {
-                if ((temporal.isSupported(YEAR) && temporal.isSupported(QUARTER_OF_YEAR)) == false) {
+            public ChronoLocalDate resolve(
+                    Map<TemporalField, Long> fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) {
+                Long yearLong = fieldValues.get(YEAR);
+                Long qoyLong = fieldValues.get(QUARTER_OF_YEAR);
+                if (yearLong == null || qoyLong == null) {
                     return null;
                 }
-                int y = temporal.get(YEAR);  // validated
+                int y = YEAR.checkValidIntValue(yearLong);  // always validate
+                long doq = fieldValues.get(DAY_OF_QUARTER);
                 LocalDate date;
                 if (resolverStyle == ResolverStyle.LENIENT) {
-                    long qoy = temporal.getLong(QUARTER_OF_YEAR);  // unvalidated
-                    date = LocalDate.of(y, 1, 1).plusMonths(Math.multiplyExact(Math.subtractExact(qoy, 1), 3));
+                    date = LocalDate.of(y, 1, 1).plusMonths(Math.multiplyExact(Math.subtractExact(qoyLong, 1), 3));
+                    doq = Math.subtractExact(doq, 1);
                 } else {
-                    int qoy = temporal.get(QUARTER_OF_YEAR);  // validated
+                    int qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR);  // validated
                     date = LocalDate.of(y, ((qoy - 1) * 3) + 1, 1);
                     if (doq < 1 || doq > 90) {
                         if (resolverStyle == ResolverStyle.STRICT) {
@@ -363,21 +365,20 @@
                             range().checkValidValue(doq, this);  // allow 1-92 rolling into next quarter
                         }
                     }
+                    doq--;
                 }
-                long epochDay = Math.addExact(date.toEpochDay(), Math.subtractExact(doq, 1));
-                Map<TemporalField, Long> result = new HashMap<>(4, 1.0f);
-                result.put(EPOCH_DAY, epochDay);
-                result.put(YEAR, null);
-                result.put(QUARTER_OF_YEAR, null);
-                return result;
+                fieldValues.remove(this);
+                fieldValues.remove(YEAR);
+                fieldValues.remove(QUARTER_OF_YEAR);
+                return date.plusDays(doq);
+            }
+            @Override
+            public String toString() {
+                return "DayOfQuarter";
             }
         },
         QUARTER_OF_YEAR {
             @Override
-            public String getName() {
-                return "QuarterOfYear";
-            }
-            @Override
             public TemporalUnit getBaseUnit() {
                 return QUARTER_YEARS;
             }
@@ -409,20 +410,19 @@
                 range().checkValidValue(newValue, this);  // strictly check from 1 to 4
                 return (R) temporal.with(MONTH_OF_YEAR, temporal.getLong(MONTH_OF_YEAR) + (newValue - curValue) * 3);
             }
+            @Override
+            public String toString() {
+                return "QuarterOfYear";
+            }
         },
         WEEK_OF_WEEK_BASED_YEAR {
             @Override
-            public String getName() {
-                return "WeekOfWeekBasedYear";
-            }
-
-            @Override
             public String getDisplayName(Locale locale) {
                 Objects.requireNonNull(locale, "locale");
                 LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
                                             .getLocaleResources(locale);
                 ResourceBundle rb = lr.getJavaTimeFormatData();
-                return rb.containsKey("field.week") ? rb.getString("field.week") : getName();
+                return rb.containsKey("field.week") ? rb.getString("field.week") : toString();
             }
 
             @Override
@@ -463,14 +463,18 @@
                 return (R) temporal.plus(Math.subtractExact(newValue, getFrom(temporal)), WEEKS);
             }
             @Override
-            public Map<TemporalField, Long> resolve(TemporalAccessor temporal, long wowby, ResolverStyle resolverStyle) {
-                if ((temporal.isSupported(WEEK_BASED_YEAR) && temporal.isSupported(DAY_OF_WEEK)) == false) {
+            public ChronoLocalDate resolve(
+                    Map<TemporalField, Long> fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) {
+                Long wbyLong = fieldValues.get(WEEK_BASED_YEAR);
+                Long dowLong = fieldValues.get(DAY_OF_WEEK);
+                if (wbyLong == null || dowLong == null) {
                     return null;
                 }
-                int wby = temporal.get(WEEK_BASED_YEAR);  // validated
+                int wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR);  // always validate
+                long wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR);
                 LocalDate date = LocalDate.of(wby, 1, 4);
                 if (resolverStyle == ResolverStyle.LENIENT) {
-                    long dow = temporal.getLong(DAY_OF_WEEK);  // unvalidated
+                    long dow = dowLong;  // unvalidated
                     if (dow > 7) {
                         date = date.plusWeeks((dow - 1) / 7);
                         dow = ((dow - 1) % 7) + 1;
@@ -480,7 +484,7 @@
                     }
                     date = date.plusWeeks(Math.subtractExact(wowby, 1)).with(DAY_OF_WEEK, dow);
                 } else {
-                    int dow = temporal.get(DAY_OF_WEEK);  // validated
+                    int dow = DAY_OF_WEEK.checkValidIntValue(dowLong);  // validated
                     if (wowby < 1 || wowby > 52) {
                         if (resolverStyle == ResolverStyle.STRICT) {
                             getWeekRange(date).checkValidValue(wowby, this);  // only allow exact range
@@ -490,19 +494,18 @@
                     }
                     date = date.plusWeeks(wowby - 1).with(DAY_OF_WEEK, dow);
                 }
-                Map<TemporalField, Long> result = new HashMap<>(2, 1.0f);
-                result.put(EPOCH_DAY, date.toEpochDay());
-                result.put(WEEK_BASED_YEAR, null);
-                result.put(DAY_OF_WEEK, null);
-                return result;
+                fieldValues.remove(this);
+                fieldValues.remove(WEEK_BASED_YEAR);
+                fieldValues.remove(DAY_OF_WEEK);
+                return date;
+            }
+            @Override
+            public String toString() {
+                return "WeekOfWeekBasedYear";
             }
         },
         WEEK_BASED_YEAR {
             @Override
-            public String getName() {
-                return "WeekBasedYear";
-            }
-            @Override
             public TemporalUnit getBaseUnit() {
                 return WEEK_BASED_YEARS;
             }
@@ -537,6 +540,10 @@
                 date = date.withDayOfYear(180).withYear(newVal).with(WEEK_OF_WEEK_BASED_YEAR, week);
                 return (R) date.with(date);
             }
+            @Override
+            public String toString() {
+                return "WeekBasedYear";
+            }
         };
 
         @Override
@@ -545,13 +552,13 @@
         }
 
         @Override
-        public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
-            return range();
+        public boolean isTimeBased() {
+            return false;
         }
 
         @Override
-        public String toString() {
-            return getName();
+        public ValueRange rangeRefinedBy(TemporalAccessor temporal) {
+            return range();
         }
 
         //-------------------------------------------------------------------------
@@ -636,11 +643,6 @@
         }
 
         @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
         public Duration getDuration() {
             return duration;
         }
@@ -651,6 +653,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return true;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(Temporal temporal) {
             return temporal.isSupported(EPOCH_DAY);
         }
@@ -658,7 +670,7 @@
         @SuppressWarnings("unchecked")
         @Override
         public <R extends Temporal> R addTo(R temporal, long amount) {
-            switch(this) {
+            switch (this) {
                 case WEEK_BASED_YEARS:
                     return (R) temporal.with(WEEK_BASED_YEAR,
                             Math.addExact(temporal.get(WEEK_BASED_YEAR), amount));
@@ -678,7 +690,7 @@
                     return Math.subtractExact(temporal2.getLong(WEEK_BASED_YEAR),
                             temporal1.getLong(WEEK_BASED_YEAR));
                 case QUARTER_YEARS:
-                    return temporal1.periodUntil(temporal2, MONTHS) / 3;
+                    return temporal1.until(temporal2, MONTHS) / 3;
                 default:
                     throw new IllegalStateException("Unreachable");
             }
@@ -686,8 +698,7 @@
 
         @Override
         public String toString() {
-            return getName();
-
+            return name;
         }
     }
 }
--- a/jdk/src/share/classes/java/time/temporal/JulianFields.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/JulianFields.java	Tue Aug 06 16:54:56 2013 -0700
@@ -66,6 +66,9 @@
 import static java.time.temporal.ChronoUnit.FOREVER;
 
 import java.time.DateTimeException;
+import java.time.ZoneId;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Chronology;
 import java.time.format.ResolverStyle;
 import java.util.Collections;
 import java.util.Map;
@@ -233,11 +236,6 @@
 
         //-----------------------------------------------------------------------
         @Override
-        public String getName() {
-            return name;
-        }
-
-        @Override
         public TemporalUnit getBaseUnit() {
             return baseUnit;
         }
@@ -253,6 +251,11 @@
         }
 
         @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public ValueRange range() {
             return range;
         }
@@ -287,15 +290,14 @@
 
         //-----------------------------------------------------------------------
         @Override
-        public Map<TemporalField, Long> resolve(TemporalAccessor temporal, long value, ResolverStyle resolverStyle) {
-            long epochDay;
+        public ChronoLocalDate resolve(
+                Map<TemporalField, Long> fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) {
+            long value = fieldValues.remove(this);
             if (resolverStyle == ResolverStyle.LENIENT) {
-                epochDay = Math.subtractExact(value, offset);
-            } else {
-                range().checkValidValue(value, this);
-                epochDay = value - offset;
+                return chronology.dateEpochDay(Math.subtractExact(value, offset));
             }
-            return Collections.<TemporalField, Long>singletonMap(EPOCH_DAY, epochDay);
+            range().checkValidValue(value, this);
+            return chronology.dateEpochDay(value - offset);
         }
 
         //-----------------------------------------------------------------------
--- a/jdk/src/share/classes/java/time/temporal/Temporal.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/Temporal.java	Tue Aug 06 16:54:56 2013 -0700
@@ -62,7 +62,6 @@
 package java.time.temporal;
 
 import java.time.DateTimeException;
-import java.time.ZoneId;
 
 /**
  * Framework-level interface defining read-write access to a temporal object,
@@ -81,7 +80,8 @@
  * See {@link ChronoField} for the standard set of fields.
  * <p>
  * Two pieces of date/time information cannot be represented by numbers,
- * the {@linkplain java.time.chrono.Chronology chronology} and the {@linkplain ZoneId time-zone}.
+ * the {@linkplain java.time.chrono.Chronology chronology} and the
+ * {@linkplain java.time.ZoneId time-zone}.
  * These can be accessed via {@link #query(TemporalQuery) queries} using
  * the static methods defined on {@link TemporalQuery}.
  * <p>
@@ -129,6 +129,29 @@
 public interface Temporal extends TemporalAccessor {
 
     /**
+     * Checks if the specified unit is supported.
+     * <p>
+     * This checks if the specified unit can be added to, or subtracted from, this date-time.
+     * If false, then calling the {@link #plus(long, TemporalUnit)} and
+     * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.
+     *
+     * @implSpec
+     * Implementations must check and handle all units defined in {@link ChronoUnit}.
+     * If the unit is supported, then true must be returned, otherwise false must be returned.
+     * <p>
+     * If the field is not a {@code ChronoUnit}, then the result of this method
+     * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}
+     * passing {@code this} as the argument.
+     * <p>
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
+     *
+     * @param unit  the unit to check, null returns false
+     * @return true if the unit can be added/subtracted, false if not
+     */
+    boolean isSupported(TemporalUnit unit);
+
+    /**
      * Returns an adjusted object of the same type as this object with the adjustment made.
      * <p>
      * This adjusts this date-time according to the rules of the specified adjuster.
@@ -352,7 +375,7 @@
      * The start and end points are {@code this} and the specified temporal.
      * The result will be negative if the end is before the start.
      * For example, the period in hours between two temporal objects can be
-     * calculated using {@code startTime.periodUntil(endTime, HOURS)}.
+     * calculated using {@code startTime.until(endTime, HOURS)}.
      * <p>
      * The calculation returns a whole number, representing the number of
      * complete units between the two temporals.
@@ -364,7 +387,7 @@
      * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:
      * <pre>
      *   // these two lines are equivalent
-     *   temporal = start.periodUntil(end, unit);
+     *   temporal = start.until(end, unit);
      *   temporal = unit.between(start, end);
      * </pre>
      * The choice should be made based on which makes the code more readable.
@@ -372,7 +395,7 @@
      * For example, this method allows the number of days between two dates to
      * be calculated:
      * <pre>
-     *  long daysBetween = start.periodUntil(end, DAYS);
+     *  long daysBetween = start.until(end, DAYS);
      *  // or alternatively
      *  long daysBetween = DAYS.between(start, end);
      * </pre>
@@ -399,7 +422,8 @@
      *  return unit.between(this, endTemporal);
      * </pre>
      * <p>
-     * Neither this object, nor the specified temporal, may be altered.
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
      *
      * @param endTemporal  the end temporal, of the same type as this object, not null
      * @param unit  the unit to measure the amount in, not null
@@ -410,6 +434,6 @@
      * @throws UnsupportedTemporalTypeException if the unit is not supported
      * @throws ArithmeticException if numeric overflow occurs
      */
-    long periodUntil(Temporal endTemporal, TemporalUnit unit);
+    long until(Temporal endTemporal, TemporalUnit unit);
 
 }
--- a/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/TemporalAccessor.java	Tue Aug 06 16:54:56 2013 -0700
@@ -62,7 +62,6 @@
 package java.time.temporal;
 
 import java.time.DateTimeException;
-import java.time.ZoneId;
 import java.util.Objects;
 
 /**
@@ -80,7 +79,8 @@
  * See {@link ChronoField} for the standard set of fields.
  * <p>
  * Two pieces of date/time information cannot be represented by numbers,
- * the {@linkplain java.time.chrono.Chronology chronology} and the {@linkplain ZoneId time-zone}.
+ * the {@linkplain java.time.chrono.Chronology chronology} and the
+ * {@linkplain java.time.ZoneId time-zone}.
  * These can be accessed via {@linkplain #query(TemporalQuery) queries} using
  * the static methods defined on {@link TemporalQuery}.
  * <p>
@@ -111,13 +111,14 @@
      *
      * @implSpec
      * Implementations must check and handle all fields defined in {@link ChronoField}.
-     * If the field is supported, then true is returned, otherwise false
+     * If the field is supported, then true must be returned, otherwise false must be returned.
      * <p>
      * If the field is not a {@code ChronoField}, then the result of this method
      * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}
      * passing {@code this} as the argument.
      * <p>
-     * Implementations must not alter either this object.
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
      *
      * @param field  the field to check, null returns false
      * @return true if this date-time can be queried for the field, false if not
@@ -146,7 +147,8 @@
      * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessorl)}
      * passing {@code this} as the argument.
      * <p>
-     * Implementations must not alter either this object.
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
      * <p>
      * The default implementation must behave equivalent to this code:
      * <pre>
@@ -154,7 +156,7 @@
      *    if (isSupported(field)) {
      *      return field.range();
      *    }
-     *    throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+     *    throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
      *  }
      *  return field.rangeRefinedBy(this);
      * </pre>
@@ -169,7 +171,7 @@
             if (isSupported(field)) {
                 return field.range();
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         Objects.requireNonNull(field, "field");
         return field.rangeRefinedBy(this);
@@ -193,7 +195,8 @@
      * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}
      * passing {@code this} as the argument.
      * <p>
-     * Implementations must not alter this object.
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
      * <p>
      * The default implementation must behave equivalent to this code:
      * <pre>
@@ -240,7 +243,8 @@
      * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}
      * passing {@code this} as the argument.
      * <p>
-     * Implementations must not alter either this object.
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
      *
      * @param field  the field to get, not null
      * @return the value for the field
@@ -291,6 +295,9 @@
      *  }
      *  return TemporalAccessor.super.query(query);
      * </pre>
+     * <p>
+     * Implementations must ensure that no observable state is altered when this
+     * read-only method is invoked.
      *
      * @param <R> the type of the result
      * @param query  the query to invoke, not null
--- a/jdk/src/share/classes/java/time/temporal/TemporalField.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/TemporalField.java	Tue Aug 06 16:54:56 2013 -0700
@@ -62,6 +62,9 @@
 package java.time.temporal;
 
 import java.time.DateTimeException;
+import java.time.ZoneId;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.Chronology;
 import java.time.format.ResolverStyle;
 import java.util.Locale;
 import java.util.Map;
@@ -93,29 +96,19 @@
 public interface TemporalField {
 
     /**
-     * Gets a descriptive name for the field.
-     * <p>
-     * The should be of the format 'BaseOfRange', such as 'MonthOfYear',
-     * unless the field has a range of {@code FOREVER}, when only
-     * the base unit is mentioned, such as 'Year' or 'Era'.
-     *
-     * @return the name, not null
-     */
-    String getName();
-
-    /**
      * Gets the display name for the field in the requested locale.
      * <p>
-     * If there is no display name for the locale the value of {@code getName}
-     * is returned.
+     * If there is no display name for the locale then a suitable default must be returned.
+     * <p>
+     * The default implementation must check the locale is not null
+     * and return {@code toString()}.
      *
      * @param locale  the locale to use, not null
-     * @return the display name for the locale or the value of {@code getName},
-     *     not null
+     * @return the display name for the locale or a suitable default, not null
      */
     default String getDisplayName(Locale locale) {
-        Objects.requireNonNull(locale, "local");
-        return getName();
+        Objects.requireNonNull(locale, "locale");
+        return toString();
     }
 
     /**
@@ -164,28 +157,24 @@
      * <p>
      * A field is date-based if it can be derived from
      * {@link ChronoField#EPOCH_DAY EPOCH_DAY}.
-     * <p>
-     * The default implementation must return false.
+     * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()}
+     * to return false, such as when representing a field like minute-of-week.
      *
      * @return true if this field is a component of a date
      */
-    default boolean isDateBased() {
-        return false;
-    }
+    boolean isDateBased();
 
     /**
      * Checks if this field represents a component of a time.
      * <p>
      * A field is time-based if it can be derived from
      * {@link ChronoField#NANO_OF_DAY NANO_OF_DAY}.
-     * <p>
-     * The default implementation must return false.
+     * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()}
+     * to return false, such as when representing a field like minute-of-week.
      *
      * @return true if this field is a component of a time
      */
-    default boolean isTimeBased() {
-        return false;
-    }
+    boolean isTimeBased();
 
     //-----------------------------------------------------------------------
     /**
@@ -319,45 +308,79 @@
     <R extends Temporal> R adjustInto(R temporal, long newValue);
 
     /**
-     * Resolves this field to provide a simpler alternative.
+     * Resolves this field to provide a simpler alternative or a date.
      * <p>
      * This method is invoked during the resolve phase of parsing.
      * It is designed to allow application defined fields to be simplified into
-     * more standard fields, such as those on {@code ChronoField}.
-     * <p>
-     * The method will only be invoked if the specified temporal supports this field.
-     * The value of this field is provided.
+     * more standard fields, such as those on {@code ChronoField}, or into a date.
      * <p>
-     * The temporal must be queried using the methods of {@code TemporalAccessor},
-     * not using {@code getFrom}, {@code isSupportedBy} or {@code rangeRefinedBy}.
-     * Before querying any field, implementations must ensure it is supported, as
-     * exceptions of this type would negatively affect the calculation of a parsed result.
+     * Applications should not normally invoke this method directly.
+     *
+     * @implSpec
+     * If an implementation represents a field that can be simplified, or
+     * combined with others, then this method must be implemented.
+     * <p>
+     * The specified map contains the current state of the parse.
+     * The map is mutable and must be mutated to resolve the field and
+     * any related fields. This method will only be invoked during parsing
+     * if the map contains this field, and implementations should therefore
+     * assume this field is present.
      * <p>
-     * If this field can resolve, it must return a map, if not it must return null.
-     * The returned map contains the changes to be made to the temporal, expressed
-     * as field-value pairs. If the value for a field is null, the field is to be
-     * removed from the temporal. A null key must not be added to the result map.
+     * Resolving a field will consist of looking at the value of this field,
+     * and potentially other fields, and either updating the map with a
+     * simpler value, such as a {@code ChronoField}, or returning a
+     * complete {@code ChronoLocalDate}. If a resolve is successful,
+     * the code must remove all the fields that were resolved from the map,
+     * including this field.
+     * <p>
+     * For example, the {@code IsoFields} class contains the quarter-of-year
+     * and day-of-quarter fields. The implementation of this method in that class
+     * resolves the two fields plus the {@link ChronoField#YEAR YEAR} into a
+     * complete {@code LocalDate}. The resolve method will remove all three
+     * fields from the map before returning the {@code LocalDate}.
      * <p>
-     * If the result is non-null, this field will be removed from the temporal.
-     * This field should not be added to the result map.
+     * If resolution should be possible, but the data is invalid, the resolver
+     * style should be used to determine an appropriate level of leniency, which
+     * may require throwing a {@code DateTimeException} or {@code ArithmeticException}.
+     * If no resolution is possible, the resolve method must return null.
      * <p>
-     * The {@link ResolverStyle} should be used by implementations to determine
-     * how to perform the resolve.
+     * When resolving time fields, the map will be altered and null returned.
+     * When resolving date fields, the date is normally returned from the method,
+     * with the map altered to remove the resolved fields. However, it would also
+     * be acceptable for the date fields to be resolved into other {@code ChronoField}
+     * instances that can produce a date, such as {@code EPOCH_DAY}.
+     * <p>
+     * The zone is not normally required for resolution, but is provided for completeness.
      * <p>
      * The default implementation must return null.
      *
-     * @param temporal  the temporal to resolve, not null
-     * @param value  the value of this field
+     * @param fieldValues  the map of fields to values, which can be updated, not null
+     * @param chronology  the effective chronology, not null
+     * @param zone  the effective zone, not null
      * @param resolverStyle  the requested type of resolve, not null
-     * @return a map of fields to update in the temporal, with a mapping to null
-     *  indicating a deletion. The whole map must be null if no resolving occurred
+     * @return the resolved date; null if resolving only changed the map,
+     *  or no resolve occurred
+     * @throws ArithmeticException if numeric overflow occurs
      * @throws DateTimeException if resolving results in an error. This must not be thrown
      *  by querying a field on the temporal without first checking if it is supported
-     * @throws ArithmeticException if numeric overflow occurs
      */
-    default Map<TemporalField, Long> resolve(
-            TemporalAccessor temporal, long value, ResolverStyle resolverStyle) {
+    default ChronoLocalDate resolve(
+            Map<TemporalField, Long> fieldValues, Chronology chronology,
+            ZoneId zone, ResolverStyle resolverStyle) {
         return null;
     }
 
+    /**
+     * Gets a descriptive name for the field.
+     * <p>
+     * The should be of the format 'BaseOfRange', such as 'MonthOfYear',
+     * unless the field has a range of {@code FOREVER}, when only
+     * the base unit is mentioned, such as 'Year' or 'Era'.
+     *
+     * @return the name of the field, not null
+     */
+    @Override
+    String toString();
+
+
 }
--- a/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/TemporalUnit.java	Tue Aug 06 16:54:56 2013 -0700
@@ -63,7 +63,11 @@
 
 import java.time.DateTimeException;
 import java.time.Duration;
+import java.time.LocalTime;
 import java.time.Period;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoZonedDateTime;
 
 /**
  * A unit of date-time, such as Days or Hours.
@@ -93,15 +97,6 @@
 public interface TemporalUnit {
 
     /**
-     * Gets a descriptive name for the unit.
-     * <p>
-     * This should be in the plural and upper-first camel case, such as 'Days' or 'Minutes'.
-     *
-     * @return the name, not null
-     */
-    String getName();
-
-    /**
      * Gets the duration of this unit, which may be an estimate.
      * <p>
      * All units return a duration measured in standard nanoseconds from this method.
@@ -132,6 +127,33 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Checks if this unit represents a component of a date.
+     * <p>
+     * A date is time-based if it can be used to imply meaning from a date.
+     * It must have a {@linkplain #getDuration() duration} that is an integral
+     * multiple of the length of a standard day.
+     * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()}
+     * to return false, such as when representing a unit like 36 hours.
+     *
+     * @return true if this unit is a component of a date
+     */
+    boolean isDateBased();
+
+    /**
+     * Checks if this unit represents a component of a time.
+     * <p>
+     * A unit is time-based if it can be used to imply meaning from a time.
+     * It must have a {@linkplain #getDuration() duration} that divides into
+     * the length of a standard day without remainder.
+     * Note that it is valid for both {@code isDateBased()} and {@code isTimeBased()}
+     * to return false, such as when representing a unit like 36 hours.
+     *
+     * @return true if this unit is a component of a time
+     */
+    boolean isTimeBased();
+
+    //-----------------------------------------------------------------------
+    /**
      * Checks if this unit is supported by the specified temporal object.
      * <p>
      * This checks that the implementing date-time can add/subtract this unit.
@@ -144,6 +166,15 @@
      * @return true if the unit is supported
      */
     default boolean isSupportedBy(Temporal temporal) {
+        if (temporal instanceof LocalTime) {
+            return isTimeBased();
+        }
+        if (temporal instanceof ChronoLocalDate) {
+            return isDateBased();
+        }
+        if (temporal instanceof ChronoLocalDateTime || temporal instanceof ChronoZonedDateTime) {
+            return true;
+        }
         try {
             temporal.plus(1, this);
             return true;
@@ -212,11 +243,11 @@
      * <p>
      * There are two equivalent ways of using this method.
      * The first is to invoke this method directly.
-     * The second is to use {@link Temporal#periodUntil(Temporal, TemporalUnit)}:
+     * The second is to use {@link Temporal#until(Temporal, TemporalUnit)}:
      * <pre>
      *   // these two lines are equivalent
      *   between = thisUnit.between(start, end);
-     *   between = start.periodUntil(end, thisUnit);
+     *   between = start.until(end, thisUnit);
      * </pre>
      * The choice should be made based on which makes the code more readable.
      * <p>
@@ -225,7 +256,7 @@
      * <pre>
      *  long daysBetween = DAYS.between(start, end);
      *  // or alternatively
-     *  long daysBetween = start.periodUntil(end, DAYS);
+     *  long daysBetween = start.until(end, DAYS);
      * </pre>
      * <p>
      * Implementations should perform any queries or calculations using the units
@@ -245,7 +276,9 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Outputs this unit as a {@code String} using the name.
+     * Gets a descriptive name for the unit.
+     * <p>
+     * This should be in the plural and upper-first camel case, such as 'Days' or 'Minutes'.
      *
      * @return the name of this unit, not null
      */
--- a/jdk/src/share/classes/java/time/temporal/ValueRange.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/ValueRange.java	Tue Aug 06 16:54:56 2013 -0700
@@ -331,7 +331,7 @@
 
     private String genInvalidFieldMessage(TemporalField field, long value) {
         if (field != null) {
-            return "Invalid value for " + field.getName() + " (valid values " + this + "): " + value;
+            return "Invalid value for " + field + " (valid values " + this + "): " + value;
         } else {
             return "Invalid value (valid values " + this + "): " + value;
         }
--- a/jdk/src/share/classes/java/time/temporal/WeekFields.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/time/temporal/WeekFields.java	Tue Aug 06 16:54:56 2013 -0700
@@ -75,7 +75,9 @@
 
 import java.io.InvalidObjectException;
 import java.io.Serializable;
+import java.time.DateTimeException;
 import java.time.DayOfWeek;
+import java.time.ZoneId;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
 import java.time.format.ResolverStyle;
@@ -395,6 +397,11 @@
      * <p>
      * For example, if the first day-of-week is Sunday, then that will have the
      * value 1, with other days ranging from Monday as 2 to Saturday as 7.
+     * <p>
+     * In the resolving phase of parsing, a localized day-of-week will be converted
+     * to a standardized {@code ChronoField} day-of-week.
+     * The day-of-week must be in the valid range 1 to 7.
+     * Other fields in this class build dates using the standardized day-of-week.
      *
      * @return a field providing access to the day-of-week with localized numbering, not null
      */
@@ -421,6 +428,26 @@
      * - if the 5th day of the month is a Monday, week two starts on the 5th and the 1st to 4th is in week one<br>
      * <p>
      * This field can be used with any calendar system.
+     * <p>
+     * In the resolving phase of parsing, a date can be created from a year,
+     * week-of-month, month-of-year and day-of-week.
+     * <p>
+     * In {@linkplain ResolverStyle#STRICT strict mode}, all four fields are
+     * validated against their range of valid values. The week-of-month field
+     * is validated to ensure that the resulting month is the month requested.
+     * <p>
+     * In {@linkplain ResolverStyle#SMART smart mode}, all four fields are
+     * validated against their range of valid values. The week-of-month field
+     * is validated from 0 to 6, meaning that the resulting date can be in a
+     * different month to that specified.
+     * <p>
+     * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week
+     * are validated against the range of valid values. The resulting date is calculated
+     * equivalent to the following four stage approach.
+     * First, create a date on the first day of the first week of January in the requested year.
+     * Then take the month-of-year, subtract one, and add the amount in months to the date.
+     * Then take the week-of-month, subtract one, and add the amount in weeks to the date.
+     * Finally, adjust to the correct day-of-week within the localized week.
      *
      * @return a field providing access to the week-of-month, not null
      */
@@ -447,6 +474,25 @@
      * - if the 5th day of the year is a Monday, week two starts on the 5th and the 1st to 4th is in week one<br>
      * <p>
      * This field can be used with any calendar system.
+     * <p>
+     * In the resolving phase of parsing, a date can be created from a year,
+     * week-of-year and day-of-week.
+     * <p>
+     * In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are
+     * validated against their range of valid values. The week-of-year field
+     * is validated to ensure that the resulting year is the year requested.
+     * <p>
+     * In {@linkplain ResolverStyle#SMART smart mode}, all three fields are
+     * validated against their range of valid values. The week-of-year field
+     * is validated from 0 to 54, meaning that the resulting date can be in a
+     * different year to that specified.
+     * <p>
+     * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week
+     * are validated against the range of valid values. The resulting date is calculated
+     * equivalent to the following three stage approach.
+     * First, create a date on the first day of the first week in the requested year.
+     * Then take the week-of-year, subtract one, and add the amount in weeks to the date.
+     * Finally, adjust to the correct day-of-week within the localized week.
      *
      * @return a field providing access to the week-of-year, not null
      */
@@ -477,6 +523,26 @@
      *   the 1st to 4th is in week one<br>
      * <p>
      * This field can be used with any calendar system.
+     * <p>
+     * In the resolving phase of parsing, a date can be created from a week-based-year,
+     * week-of-year and day-of-week.
+     * <p>
+     * In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are
+     * validated against their range of valid values. The week-of-year field
+     * is validated to ensure that the resulting week-based-year is the
+     * week-based-year requested.
+     * <p>
+     * In {@linkplain ResolverStyle#SMART smart mode}, all three fields are
+     * validated against their range of valid values. The week-of-week-based-year field
+     * is validated from 1 to 53, meaning that the resulting date can be in the
+     * following week-based-year to that specified.
+     * <p>
+     * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week
+     * are validated against the range of valid values. The resulting date is calculated
+     * equivalent to the following three stage approach.
+     * First, create a date on the first day of the first week in the requested week-based-year.
+     * Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date.
+     * Finally, adjust to the correct day-of-week within the localized week.
      *
      * @return a field providing access to the week-of-week-based-year, not null
      */
@@ -499,6 +565,26 @@
      * is in the last week of the previous year.
      * <p>
      * This field can be used with any calendar system.
+     * <p>
+     * In the resolving phase of parsing, a date can be created from a week-based-year,
+     * week-of-year and day-of-week.
+     * <p>
+     * In {@linkplain ResolverStyle#STRICT strict mode}, all three fields are
+     * validated against their range of valid values. The week-of-year field
+     * is validated to ensure that the resulting week-based-year is the
+     * week-based-year requested.
+     * <p>
+     * In {@linkplain ResolverStyle#SMART smart mode}, all three fields are
+     * validated against their range of valid values. The week-of-week-based-year field
+     * is validated from 1 to 53, meaning that the resulting date can be in the
+     * following week-based-year to that specified.
+     * <p>
+     * In {@linkplain ResolverStyle#LENIENT lenient mode}, the year and day-of-week
+     * are validated against the range of valid values. The resulting date is calculated
+     * equivalent to the following three stage approach.
+     * First, create a date on the first day of the first week in the requested week-based-year.
+     * Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date.
+     * Finally, adjust to the correct day-of-week within the localized week.
      *
      * @return a field providing access to the week-based-year, not null
      */
@@ -615,9 +701,9 @@
          * @param dow the day of the week
          * @return a ChronoLocalDate for the requested year, week of year, and day of week
          */
-        private ChronoLocalDate<?> ofWeekBasedYear(Chronology chrono,
+        private ChronoLocalDate ofWeekBasedYear(Chronology chrono,
                 int yowby, int wowby, int dow) {
-            ChronoLocalDate<?> date = chrono.date(yowby, 1, 1);
+            ChronoLocalDate date = chrono.date(yowby, 1, 1);
             int ldow = localizedDayOfWeek(date);
             int offset = startOfWeekOffset(1, ldow);
 
@@ -671,6 +757,11 @@
             return Math.floorMod(isoDow - sow, 7) + 1;
         }
 
+        private int localizedDayOfWeek(int isoDow) {
+            int sow = weekDef.getFirstDayOfWeek().getValue();
+            return Math.floorMod(isoDow - sow, 7) + 1;
+        }
+
         private long localizedWeekOfMonth(TemporalAccessor temporal) {
             int dow = localizedDayOfWeek(temporal);
             int dom = temporal.get(DAY_OF_MONTH);
@@ -800,75 +891,121 @@
         }
 
         @Override
-        public Map<TemporalField, Long> resolve(TemporalAccessor temporal, long value, ResolverStyle resolverStyle) {
-            int newValue = range.checkValidIntValue(value, this);
-            int sow = weekDef.getFirstDayOfWeek().getValue();
+        public ChronoLocalDate resolve(
+                Map<TemporalField, Long> fieldValues, Chronology chronology, ZoneId zone, ResolverStyle resolverStyle) {
+            final long value = fieldValues.get(this);
+            final int newValue = Math.toIntExact(value);  // broad limit makes overflow checking lighter
+            // first convert localized day-of-week to ISO day-of-week
+            // doing this first handles case where both ISO and localized were parsed and might mismatch
+            // day-of-week is always strict as two different day-of-week values makes lenient complex
             if (rangeUnit == WEEKS) {  // day-of-week
-                int isoDow = Math.floorMod((sow - 1) + (newValue - 1), 7) + 1;
-                return Collections.<TemporalField, Long>singletonMap(DAY_OF_WEEK, (long) isoDow);
-            }
-            if (temporal.isSupported(DAY_OF_WEEK) == false) {
+                final int checkedValue = range.checkValidIntValue(value, this);  // no leniency as too complex
+                final int startDow = weekDef.getFirstDayOfWeek().getValue();
+                long isoDow = Math.floorMod((startDow - 1) + (checkedValue - 1), 7) + 1;
+                fieldValues.remove(this);
+                fieldValues.put(DAY_OF_WEEK, isoDow);
                 return null;
             }
-            Chronology chrono = Chronology.from(temporal);  // defaults to ISO
-            int dow = localizedDayOfWeek(temporal);
-            if (temporal.isSupported(YEAR)) {
-                int year = temporal.get(YEAR);
-                if (rangeUnit == MONTHS) {  // week-of-month
-                    if (temporal.isSupported(MONTH_OF_YEAR) == false) {
-                        return null;
-                    }
-                    int month = temporal.get(ChronoField.MONTH_OF_YEAR);
-                @SuppressWarnings("rawtypes")
-                    ChronoLocalDate date = chrono.date(year, month, 1);
-                    int dateDow = localizedDayOfWeek(date);
-                    long weeks = newValue - localizedWeekOfMonth(date);
-                    int days = dow - dateDow;
-                    date = date.plus(weeks * 7 + days, DAYS);
-                    Map<TemporalField, Long> result = new HashMap<>(4, 1.0f);
-                    result.put(EPOCH_DAY, date.toEpochDay());
-                    result.put(YEAR, null);
-                    result.put(MONTH_OF_YEAR, null);
-                    result.put(DAY_OF_WEEK, null);
-                    return result;
-                } else if (rangeUnit == YEARS) {  // week-of-year
-                @SuppressWarnings("rawtypes")
-                    ChronoLocalDate date = chrono.date(year, 1, 1);
-                    int dateDow = localizedDayOfWeek(date);
-                    long weeks = newValue - localizedWeekOfYear(date);
-                    int days = dow - dateDow;
-                    date = date.plus(weeks * 7 + days, DAYS);
-                    Map<TemporalField, Long> result = new HashMap<>(4, 1.0f);
-                    result.put(EPOCH_DAY, date.toEpochDay());
-                    result.put(YEAR, null);
-                    result.put(DAY_OF_WEEK, null);
-                    return result;
+
+            // can only build date if ISO day-of-week is present
+            if (fieldValues.containsKey(DAY_OF_WEEK) == false) {
+                return null;
+            }
+            int isoDow = DAY_OF_WEEK.checkValidIntValue(fieldValues.get(DAY_OF_WEEK));
+            int dow = localizedDayOfWeek(isoDow);
+
+            // build date
+            if (fieldValues.containsKey(YEAR)) {
+                int year = YEAR.checkValidIntValue(fieldValues.get(YEAR));  // validate
+                if (rangeUnit == MONTHS && fieldValues.containsKey(MONTH_OF_YEAR)) {  // week-of-month
+                    long month = fieldValues.get(MONTH_OF_YEAR);  // not validated yet
+                    return resolveWoM(fieldValues, chronology, year, month, newValue, dow, resolverStyle);
                 }
-            } else if (rangeUnit == WEEK_BASED_YEARS || rangeUnit == FOREVER) {
-                if (temporal.isSupported(weekDef.weekBasedYear) &&
-                    temporal.isSupported(weekDef.weekOfWeekBasedYear)) {
-                    // week-of-week-based-year and year-of-week-based-year
-                    int yowby = temporal.get(weekDef.weekBasedYear);
-                    int wowby = temporal.get(weekDef.weekOfWeekBasedYear);
-                    ChronoLocalDate<?> date = ofWeekBasedYear(Chronology.from(temporal), yowby, wowby, dow);
-
-                    Map<TemporalField, Long> result = new HashMap<>(4, 1.0f);
-                    result.put(EPOCH_DAY, date.toEpochDay());
-                    result.put(DAY_OF_WEEK, null);
-                    result.put(weekDef.weekOfWeekBasedYear, null);
-                    result.put(weekDef.weekBasedYear, null);
-                    return result;
+                if (rangeUnit == YEARS) {  // week-of-year
+                    return resolveWoY(fieldValues, chronology, year, newValue, dow, resolverStyle);
                 }
+            } else if ((rangeUnit == WEEK_BASED_YEARS || rangeUnit == FOREVER) &&
+                    fieldValues.containsKey(weekDef.weekBasedYear) &&
+                    fieldValues.containsKey(weekDef.weekOfWeekBasedYear)) { // week-of-week-based-year and year-of-week-based-year
+                return resolveWBY(fieldValues, chronology, dow, resolverStyle);
             }
             return null;
         }
 
-        //-----------------------------------------------------------------------
-        @Override
-        public String getName() {
-            return name;
+        private ChronoLocalDate resolveWoM(
+                Map<TemporalField, Long> fieldValues, Chronology chrono, int year, long month, long wom, int localDow, ResolverStyle resolverStyle) {
+            ChronoLocalDate date;
+            if (resolverStyle == ResolverStyle.LENIENT) {
+                date = chrono.date(year, 1, 1).plus(Math.subtractExact(month, 1), MONTHS);
+                long weeks = Math.subtractExact(wom, localizedWeekOfMonth(date));
+                int days = localDow - localizedDayOfWeek(date);  // safe from overflow
+                date = date.plus(Math.addExact(Math.multiplyExact(weeks, 7), days), DAYS);
+            } else {
+                int monthValid = MONTH_OF_YEAR.checkValidIntValue(month);  // validate
+                date = chrono.date(year, monthValid, 1);
+                int womInt = range.checkValidIntValue(wom, this);  // validate
+                int weeks = (int) (womInt - localizedWeekOfMonth(date));  // safe from overflow
+                int days = localDow - localizedDayOfWeek(date);  // safe from overflow
+                date = date.plus(weeks * 7 + days, DAYS);
+                if (resolverStyle == ResolverStyle.STRICT && date.getLong(MONTH_OF_YEAR) != month) {
+                    throw new DateTimeException("Strict mode rejected resolved date as it is in a different month");
+                }
+            }
+            fieldValues.remove(this);
+            fieldValues.remove(YEAR);
+            fieldValues.remove(MONTH_OF_YEAR);
+            fieldValues.remove(DAY_OF_WEEK);
+            return date;
         }
 
+        private ChronoLocalDate resolveWoY(
+                Map<TemporalField, Long> fieldValues, Chronology chrono, int year, long woy, int localDow, ResolverStyle resolverStyle) {
+            ChronoLocalDate date = chrono.date(year, 1, 1);
+            if (resolverStyle == ResolverStyle.LENIENT) {
+                long weeks = Math.subtractExact(woy, localizedWeekOfYear(date));
+                int days = localDow - localizedDayOfWeek(date);  // safe from overflow
+                date = date.plus(Math.addExact(Math.multiplyExact(weeks, 7), days), DAYS);
+            } else {
+                int womInt = range.checkValidIntValue(woy, this);  // validate
+                int weeks = (int) (womInt - localizedWeekOfYear(date));  // safe from overflow
+                int days = localDow - localizedDayOfWeek(date);  // safe from overflow
+                date = date.plus(weeks * 7 + days, DAYS);
+                if (resolverStyle == ResolverStyle.STRICT && date.getLong(YEAR) != year) {
+                    throw new DateTimeException("Strict mode rejected resolved date as it is in a different year");
+                }
+            }
+            fieldValues.remove(this);
+            fieldValues.remove(YEAR);
+            fieldValues.remove(DAY_OF_WEEK);
+            return date;
+        }
+
+        private ChronoLocalDate resolveWBY(
+                Map<TemporalField, Long> fieldValues, Chronology chrono, int localDow, ResolverStyle resolverStyle) {
+            int yowby = weekDef.weekBasedYear.range().checkValidIntValue(
+                    fieldValues.get(weekDef.weekBasedYear), weekDef.weekBasedYear);
+            ChronoLocalDate date;
+            if (resolverStyle == ResolverStyle.LENIENT) {
+                date = ofWeekBasedYear(chrono, yowby, 1, localDow);
+                long wowby = fieldValues.get(weekDef.weekOfWeekBasedYear);
+                long weeks = Math.subtractExact(wowby, 1);
+                date = date.plus(weeks, WEEKS);
+            } else {
+                int wowby = weekDef.weekOfWeekBasedYear.range().checkValidIntValue(
+                        fieldValues.get(weekDef.weekOfWeekBasedYear), weekDef.weekOfWeekBasedYear);  // validate
+                date = ofWeekBasedYear(chrono, yowby, wowby, localDow);
+                if (resolverStyle == ResolverStyle.STRICT && localizedWeekBasedYear(date) != yowby) {
+                    throw new DateTimeException("Strict mode rejected resolved date as it is in a different week-based-year");
+                }
+            }
+            fieldValues.remove(this);
+            fieldValues.remove(weekDef.weekBasedYear);
+            fieldValues.remove(weekDef.weekOfWeekBasedYear);
+            fieldValues.remove(DAY_OF_WEEK);
+            return date;
+        }
+
+        //-----------------------------------------------------------------------
         @Override
         public String getDisplayName(Locale locale) {
             Objects.requireNonNull(locale, "locale");
@@ -876,9 +1013,9 @@
                 LocaleResources lr = LocaleProviderAdapter.getResourceBundleBased()
                         .getLocaleResources(locale);
                 ResourceBundle rb = lr.getJavaTimeFormatData();
-                return rb.containsKey("field.week") ? rb.getString("field.week") : getName();
+                return rb.containsKey("field.week") ? rb.getString("field.week") : name;
             }
-            return getName();
+            return name;
         }
 
         @Override
@@ -897,6 +1034,11 @@
         }
 
         @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public ValueRange range() {
             return range;
         }
@@ -988,7 +1130,7 @@
         //-----------------------------------------------------------------------
         @Override
         public String toString() {
-            return getName() + "[" + weekDef.toString() + "]";
+            return name + "[" + weekDef.toString() + "]";
         }
     }
 }
--- a/jdk/src/share/classes/java/util/List.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/List.java	Tue Aug 06 16:54:56 2013 -0700
@@ -384,10 +384,12 @@
      * @implSpec
      * The default implementation is equivalent to, for this {@code list}:
      * <pre>
+     * {@code
      * final ListIterator<E> li = list.listIterator();
      * while (li.hasNext()) {
      *   li.set(operator.apply(li.next()));
      * }
+     * }
      * </pre>
      * If the list's list-iterator does not support the {@code set} operation
      * then an {@code UnsupportedOperationException} will be thrown when
--- a/jdk/src/share/classes/java/util/Map.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/Map.java	Tue Aug 06 16:54:56 2013 -0700
@@ -561,6 +561,7 @@
     * concurrency properties.
     *
     * @param key the key whose associated value is to be returned
+    * @param defaultValue the default mapping of the key
     * @return the value to which the specified key is mapped, or
     * {@code defaultValue} if this map contains no mapping for the key
     * @throws ClassCastException if the key is of an inappropriate type for
--- a/jdk/src/share/classes/java/util/Optional.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/Optional.java	Tue Aug 06 16:54:56 2013 -0700
@@ -93,6 +93,7 @@
     /**
      * Returns an {@code Optional} with the specified present non-null value.
      *
+     * @param <T> the class of the value
      * @param value the value to be present, which must be non-null
      * @return an {@code Optional} with the value present
      */
@@ -104,6 +105,7 @@
      * Returns an {@code Optional} describing the specified value, if non-null,
      * otherwise returns an empty {@code Optional}.
      *
+     * @param <T> the class of the value
      * @param value the possibly-null value to describe
      * @return an {@code Optional} with a present value if the specified value
      * is non-null, otherwise an empty {@code Optional}
--- a/jdk/src/share/classes/java/util/PriorityQueue.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/PriorityQueue.java	Tue Aug 06 16:54:56 2013 -0700
@@ -136,6 +136,19 @@
     }
 
     /**
+     * Creates a {@code PriorityQueue} with the default initial capacity and
+     * whose elements are ordered according to the specified comparator.
+     *
+     * @param  comparator the comparator that will be used to order this
+     *         priority queue.  If {@code null}, the {@linkplain Comparable
+     *         natural ordering} of the elements will be used.
+     * @since 1.8
+     */
+    public PriorityQueue(Comparator<? super E> comparator) {
+        this(DEFAULT_INITIAL_CAPACITY, comparator);
+    }
+
+    /**
      * Creates a {@code PriorityQueue} with the specified initial capacity
      * that orders its elements according to the specified comparator.
      *
--- a/jdk/src/share/classes/java/util/Random.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/Random.java	Tue Aug 06 16:54:56 2013 -0700
@@ -225,9 +225,8 @@
      * Returns the next pseudorandom, uniformly distributed {@code int}
      * value from this random number generator's sequence. The general
      * contract of {@code nextInt} is that one {@code int} value is
-     * pseudorandomly generated and returned. All 2<font size="-1"><sup>32
-     * </sup></font> possible {@code int} values are produced with
-     * (approximately) equal probability.
+     * pseudorandomly generated and returned. All 2<sup>32</sup> possible
+     * {@code int} values are produced with (approximately) equal probability.
      *
      * <p>The method {@code nextInt} is implemented by class {@code Random}
      * as if by:
@@ -370,11 +369,9 @@
      * <p>The general contract of {@code nextFloat} is that one
      * {@code float} value, chosen (approximately) uniformly from the
      * range {@code 0.0f} (inclusive) to {@code 1.0f} (exclusive), is
-     * pseudorandomly generated and returned. All 2<font
-     * size="-1"><sup>24</sup></font> possible {@code float} values
-     * of the form <i>m&nbsp;x&nbsp;</i>2<font
-     * size="-1"><sup>-24</sup></font>, where <i>m</i> is a positive
-     * integer less than 2<font size="-1"><sup>24</sup> </font>, are
+     * pseudorandomly generated and returned. All 2<sup>24</sup> possible
+     * {@code float} values of the form <i>m&nbsp;x&nbsp;</i>2<sup>-24</sup>,
+     * where <i>m</i> is a positive integer less than 2<sup>24</sup>, are
      * produced with (approximately) equal probability.
      *
      * <p>The method {@code nextFloat} is implemented by class {@code Random}
--- a/jdk/src/share/classes/java/util/Scanner.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/Scanner.java	Tue Aug 06 16:54:56 2013 -0700
@@ -76,7 +76,7 @@
  * }</pre></blockquote>
  * <p>
  * prints the following output:
- * <blockqjote><pre>{@code
+ * <blockquote><pre>{@code
  *     1
  *     2
  *     red
@@ -149,8 +149,7 @@
  * {@link #reset} method will reset the value of the scanner's radix to
  * <code>10</code> regardless of whether it was previously changed.
  *
- * <a name="localized-numbers">
- * <h4> Localized numbers </h4>
+ * <h3> <a name="localized-numbers">Localized numbers</a> </h3>
  *
  * <p> An instance of this class is capable of scanning numbers in the standard
  * formats as well as in the formats of the scanner's locale. A scanner's
@@ -167,186 +166,139 @@
  * {@link java.text.DecimalFormatSymbols DecimalFormatSymbols} object,
  * <tt>dfs</tt>.
  *
- * <blockquote><table>
- * <tr><td valign="top"><i>LocalGroupSeparator&nbsp;&nbsp;</i></td>
- *     <td valign="top">The character used to separate thousands groups,
- *                      <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
- *                      java.text.DecimalFormatSymbols#getGroupingSeparator
- *                      getGroupingSeparator()}</td></tr>
- * <tr><td valign="top"><i>LocalDecimalSeparator&nbsp;&nbsp;</i></td>
- *     <td valign="top">The character used for the decimal point,
- *                      <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
- *                      java.text.DecimalFormatSymbols#getDecimalSeparator
- *                      getDecimalSeparator()}</td></tr>
- * <tr><td valign="top"><i>LocalPositivePrefix&nbsp;&nbsp;</i></td>
- *     <td valign="top">The string that appears before a positive number (may
- *                      be empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
- *                      java.text.DecimalFormat#getPositivePrefix
- *                      getPositivePrefix()}</td></tr>
- * <tr><td valign="top"><i>LocalPositiveSuffix&nbsp;&nbsp;</i></td>
- *     <td valign="top">The string that appears after a positive number (may be
- *                      empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
- *                      java.text.DecimalFormat#getPositiveSuffix
- *                      getPositiveSuffix()}</td></tr>
- * <tr><td valign="top"><i>LocalNegativePrefix&nbsp;&nbsp;</i></td>
- *     <td valign="top">The string that appears before a negative number (may
- *                      be empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
- *                      java.text.DecimalFormat#getNegativePrefix
- *                      getNegativePrefix()}</td></tr>
- * <tr><td valign="top"><i>LocalNegativeSuffix&nbsp;&nbsp;</i></td>
- *     <td valign="top">The string that appears after a negative number (may be
- *                      empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
- *                      java.text.DecimalFormat#getNegativeSuffix
- *                      getNegativeSuffix()}</td></tr>
- * <tr><td valign="top"><i>LocalNaN&nbsp;&nbsp;</i></td>
- *     <td valign="top">The string that represents not-a-number for
- *                      floating-point values,
- *                      <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
- *                      java.text.DecimalFormatSymbols#getNaN
- *                      getNaN()}</td></tr>
- * <tr><td valign="top"><i>LocalInfinity&nbsp;&nbsp;</i></td>
- *     <td valign="top">The string that represents infinity for floating-point
- *                      values, <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
- *                      java.text.DecimalFormatSymbols#getInfinity
- *                      getInfinity()}</td></tr>
- * </table></blockquote>
+ * <blockquote><dl>
+ *     <dt><i>LocalGroupSeparator&nbsp;&nbsp;</i>
+ *         <dd>The character used to separate thousands groups,
+ *         <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
+ *         java.text.DecimalFormatSymbols#getGroupingSeparator
+ *         getGroupingSeparator()}
+ *     <dt><i>LocalDecimalSeparator&nbsp;&nbsp;</i>
+ *         <dd>The character used for the decimal point,
+ *     <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
+ *     java.text.DecimalFormatSymbols#getDecimalSeparator
+ *     getDecimalSeparator()}
+ *     <dt><i>LocalPositivePrefix&nbsp;&nbsp;</i>
+ *         <dd>The string that appears before a positive number (may
+ *         be empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
+ *         java.text.DecimalFormat#getPositivePrefix
+ *         getPositivePrefix()}
+ *     <dt><i>LocalPositiveSuffix&nbsp;&nbsp;</i>
+ *         <dd>The string that appears after a positive number (may be
+ *         empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
+ *         java.text.DecimalFormat#getPositiveSuffix
+ *         getPositiveSuffix()}
+ *     <dt><i>LocalNegativePrefix&nbsp;&nbsp;</i>
+ *         <dd>The string that appears before a negative number (may
+ *         be empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
+ *         java.text.DecimalFormat#getNegativePrefix
+ *         getNegativePrefix()}
+ *     <dt><i>LocalNegativeSuffix&nbsp;&nbsp;</i>
+ *         <dd>The string that appears after a negative number (may be
+ *         empty), <i>i.e.,</i>&nbsp;<tt>df.</tt>{@link
+ *     java.text.DecimalFormat#getNegativeSuffix
+ *     getNegativeSuffix()}
+ *     <dt><i>LocalNaN&nbsp;&nbsp;</i>
+ *         <dd>The string that represents not-a-number for
+ *         floating-point values,
+ *         <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
+ *         java.text.DecimalFormatSymbols#getNaN
+ *         getNaN()}
+ *     <dt><i>LocalInfinity&nbsp;&nbsp;</i>
+ *         <dd>The string that represents infinity for floating-point
+ *         values, <i>i.e.,</i>&nbsp;<tt>dfs.</tt>{@link
+ *         java.text.DecimalFormatSymbols#getInfinity
+ *         getInfinity()}
+ * </dl></blockquote>
  *
- * <a name="number-syntax">
- * <h4> Number syntax </h4>
+ * <h4> <a name="number-syntax">Number syntax</a> </h4>
  *
  * <p> The strings that can be parsed as numbers by an instance of this class
  * are specified in terms of the following regular-expression grammar, where
- * Rmax is the highest digit in the radix being used (for example, Rmax is 9
- * in base 10).
+ * Rmax is the highest digit in the radix being used (for example, Rmax is 9 in base 10).
  *
  * <p>
- * <table cellspacing=0 cellpadding=0 align=center>
- *
- *   <tr><td valign=top align=right><i>NonASCIIDigit</i>&nbsp;&nbsp;::</td>
- *       <td valign=top>= A non-ASCII character c for which
+ * <dl>
+ *   <dt><i>NonAsciiDigit</i>:
+ *       <dd>A non-ASCII character c for which
  *            {@link java.lang.Character#isDigit Character.isDigit}<tt>(c)</tt>
- *                        returns&nbsp;true</td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
+ *                        returns&nbsp;true
  *
- *   <tr><td align=right><i>Non0Digit</i>&nbsp;&nbsp;::</td>
- *   <td><tt>= [1-</tt><i>Rmax</i><tt>] | </tt><i>NonASCIIDigit</i></td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
+ *   <dt><i>Non0Digit</i>:
+ *       <dd><tt>[1-</tt><i>Rmax</i><tt>] | </tt><i>NonASCIIDigit</i>
  *
- *   <tr><td align=right><i>Digit</i>&nbsp;&nbsp;::</td>
- *   <td><tt>= [0-</tt><i>Rmax</i><tt>] | </tt><i>NonASCIIDigit</i></td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
+ *   <dt><i>Digit</i>:
+ *       <dd><tt>[0-</tt><i>Rmax</i><tt>] | </tt><i>NonASCIIDigit</i>
  *
- *   <tr><td valign=top align=right><i>GroupedNumeral</i>&nbsp;&nbsp;::</td>
- *       <td valign=top>
- *         <table cellpadding=0 cellspacing=0>
- *           <tr><td><tt>= (&nbsp;</tt></td>
- *               <td><i>Non0Digit</i><tt>
- *                   </tt><i>Digit</i><tt>?
- *                   </tt><i>Digit</i><tt>?</tt></td></tr>
- *           <tr><td></td>
- *               <td><tt>(&nbsp;</tt><i>LocalGroupSeparator</i><tt>
- *                         </tt><i>Digit</i><tt>
- *                         </tt><i>Digit</i><tt>
- *                         </tt><i>Digit</i><tt> )+ )</tt></td></tr>
- *         </table></td></tr>
+ *   <dt><i>GroupedNumeral</i>:
+ *       <dd><tt>(&nbsp;</tt><i>Non0Digit</i>
+ *                   <i>Digit</i><tt>?
+ *                   </tt><i>Digit</i><tt>?</tt>
+ *       <dd>&nbsp;&nbsp;&nbsp;&nbsp;<tt>(&nbsp;</tt><i>LocalGroupSeparator</i>
+ *                         <i>Digit</i>
+ *                         <i>Digit</i>
+ *                         <i>Digit</i><tt> )+ )</tt>
  *
- *   <tr><td>&nbsp;</td></tr>
- *
- *   <tr><td align=right><i>Numeral</i>&nbsp;&nbsp;::</td>
- *       <td><tt>= ( ( </tt><i>Digit</i><tt>+ )
- *               | </tt><i>GroupedNumeral</i><tt> )</tt></td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
+ *   <dt><i>Numeral</i>:
+ *       <dd><tt>( ( </tt><i>Digit</i><tt>+ )
+ *               | </tt><i>GroupedNumeral</i><tt> )</tt>
  *
- *   <tr><td valign=top align=right>
- *         <a name="Integer-regex"><i>Integer</i>&nbsp;&nbsp;::</td>
- *       <td valign=top><tt>= ( [-+]? ( </tt><i>Numeral</i><tt>
- *                               ) )</tt></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalPositivePrefix</i><tt> </tt><i>Numeral</i><tt>
- *                      </tt><i>LocalPositiveSuffix</i></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalNegativePrefix</i><tt> </tt><i>Numeral</i><tt>
- *                 </tt><i>LocalNegativeSuffix</i></td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
+ *   <dt><a name="Integer-regex"><i>Integer</i>:</a>
+ *       <dd><tt>( [-+]? ( </tt><i>Numeral</i><tt>
+ *                               ) )</tt>
+ *       <dd><tt>| </tt><i>LocalPositivePrefix</i> <i>Numeral</i>
+ *                      <i>LocalPositiveSuffix</i>
+ *       <dd><tt>| </tt><i>LocalNegativePrefix</i> <i>Numeral</i>
+ *                 <i>LocalNegativeSuffix</i>
  *
- *   <tr><td align=right><i>DecimalNumeral</i>&nbsp;&nbsp;::</td>
- *       <td><tt>= </tt><i>Numeral</i></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>Numeral</i><tt>
- *                 </tt><i>LocalDecimalSeparator</i><tt>
- *                 </tt><i>Digit</i><tt>*</tt></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalDecimalSeparator</i><tt>
- *                 </tt><i>Digit</i><tt>+</tt></td></tr>
+ *   <dt><i>DecimalNumeral</i>:
+ *       <dd><i>Numeral</i>
+ *       <dd><tt>| </tt><i>Numeral</i>
+ *                 <i>LocalDecimalSeparator</i>
+ *                 <i>Digit</i><tt>*</tt>
+ *       <dd><tt>| </tt><i>LocalDecimalSeparator</i>
+ *                 <i>Digit</i><tt>+</tt>
  *
- *   <tr><td>&nbsp;</td></tr>
- *
- *   <tr><td align=right><i>Exponent</i>&nbsp;&nbsp;::</td>
- *       <td><tt>= ( [eE] [+-]? </tt><i>Digit</i><tt>+ )</tt></td></tr>
+ *   <dt><i>Exponent</i>:
+ *       <dd><tt>( [eE] [+-]? </tt><i>Digit</i><tt>+ )</tt>
  *
- *   <tr><td>&nbsp;</td></tr>
+ *   <dt><a name="Decimal-regex"><i>Decimal</i>:</a>
+ *       <dd><tt>( [-+]? </tt><i>DecimalNumeral</i>
+ *                         <i>Exponent</i><tt>? )</tt>
+ *       <dd><tt>| </tt><i>LocalPositivePrefix</i>
+ *                 <i>DecimalNumeral</i>
+ *                 <i>LocalPositiveSuffix</i>
+ *                 <i>Exponent</i><tt>?</tt>
+ *       <dd><tt>| </tt><i>LocalNegativePrefix</i>
+ *                 <i>DecimalNumeral</i>
+ *                 <i>LocalNegativeSuffix</i>
+ *                 <i>Exponent</i><tt>?</tt>
  *
- *   <tr><td align=right>
- *         <a name="Decimal-regex"><i>Decimal</i>&nbsp;&nbsp;::</td>
- *       <td><tt>= ( [-+]? </tt><i>DecimalNumeral</i><tt>
- *                         </tt><i>Exponent</i><tt>? )</tt></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalPositivePrefix</i><tt>
- *                 </tt><i>DecimalNumeral</i><tt>
- *                 </tt><i>LocalPositiveSuffix</i>
- *                 </tt><i>Exponent</i><tt>?</td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalNegativePrefix</i><tt>
- *                 </tt><i>DecimalNumeral</i><tt>
- *                 </tt><i>LocalNegativeSuffix</i>
- *                 </tt><i>Exponent</i><tt>?</td></tr>
+ *   <dt><i>HexFloat</i>:
+ *       <dd><tt>[-+]? 0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+
+ *                 ([pP][-+]?[0-9]+)?</tt>
  *
- *   <tr><td>&nbsp;</td></tr>
- *
- *   <tr><td align=right><i>HexFloat</i>&nbsp;&nbsp;::</td>
- *       <td><tt>= [-+]? 0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+
- *                 ([pP][-+]?[0-9]+)?</tt></td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
- *
- *   <tr><td align=right><i>NonNumber</i>&nbsp;&nbsp;::</td>
- *       <td valign=top><tt>= NaN
+ *   <dt><i>NonNumber</i>:
+ *       <dd><tt>NaN
  *                          | </tt><i>LocalNan</i><tt>
  *                          | Infinity
- *                          | </tt><i>LocalInfinity</i></td></tr>
- *
- *   <tr><td>&nbsp;</td></tr>
- *
- *   <tr><td align=right><i>SignedNonNumber</i>&nbsp;&nbsp;::</td>
- *       <td><tt>= ( [-+]? </tt><i>NonNumber</i><tt> )</tt></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalPositivePrefix</i><tt>
- *                 </tt><i>NonNumber</i><tt>
- *                 </tt><i>LocalPositiveSuffix</i></td></tr>
- *   <tr><td></td>
- *       <td><tt>| </tt><i>LocalNegativePrefix</i><tt>
- *                 </tt><i>NonNumber</i><tt>
- *                 </tt><i>LocalNegativeSuffix</i></td></tr>
+ *                          | </tt><i>LocalInfinity</i>
  *
- *   <tr><td>&nbsp;</td></tr>
+ *   <dt><i>SignedNonNumber</i>:
+ *       <dd><tt>( [-+]? </tt><i>NonNumber</i><tt> )</tt>
+ *       <dd><tt>| </tt><i>LocalPositivePrefix</i>
+ *                 <i>NonNumber</i>
+ *                 <i>LocalPositiveSuffix</i>
+ *       <dd><tt>| </tt><i>LocalNegativePrefix</i>
+ *                 <i>NonNumber</i>
+ *                 <i>LocalNegativeSuffix</i>
  *
- *   <tr><td valign=top align=right>
- *         <a name="Float-regex"><i>Float</i>&nbsp;&nbsp;::</td>
- *       <td valign=top><tt>= </tt><i>Decimal</i><tt></td></tr>
- *       <tr><td></td>
- *           <td><tt>| </tt><i>HexFloat</i><tt></td></tr>
- *       <tr><td></td>
- *           <td><tt>| </tt><i>SignedNonNumber</i><tt></td></tr>
+ *   <dt><a name="Float-regex"><i>Float</i></a>:
+ *       <dd><i>Decimal</i>
+ *           <tt>| </tt><i>HexFloat</i>
+ *           <tt>| </tt><i>SignedNonNumber</i>
  *
- * </table>
- * </center>
- *
- * <p> Whitespace is not significant in the above regular expressions.
+ * </dl>
+ * <p>Whitespace is not significant in the above regular expressions.
  *
  * @since   1.5
  */
@@ -1675,6 +1627,7 @@
      * <tt>findWithinHorizon(Pattern.compile(pattern, horizon))</tt>.
      *
      * @param pattern a string specifying the pattern to search for
+     * @param horizon the search horizon
      * @return the text that matched the specified pattern
      * @throws IllegalStateException if this scanner is closed
      * @throws IllegalArgumentException if horizon is negative
@@ -1709,6 +1662,7 @@
      * thrown.
      *
      * @param pattern the pattern to scan for
+     * @param horizon the search horizon
      * @return the text that matched the specified pattern
      * @throws IllegalStateException if this scanner is closed
      * @throws IllegalArgumentException if horizon is negative
--- a/jdk/src/share/classes/java/util/ServiceLoader.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/ServiceLoader.java	Tue Aug 06 16:54:56 2013 -0700
@@ -68,12 +68,13 @@
  *
  * <p><a name="format"> A service provider is identified by placing a
  * <i>provider-configuration file</i> in the resource directory
- * <tt>META-INF/services</tt>.  The file's name is the fully-qualified <a
+ * <tt>META-INF/services</tt>.</a>  The file's name is the fully-qualified <a
  * href="../lang/ClassLoader.html#name">binary name</a> of the service's type.
  * The file contains a list of fully-qualified binary names of concrete
  * provider classes, one per line.  Space and tab characters surrounding each
  * name, as well as blank lines, are ignored.  The comment character is
- * <tt>'#'</tt> (<tt>'&#92;u0023'</tt>, <font size="-1">NUMBER SIGN</font>); on
+ * <tt>'#'</tt> (<tt>'&#92;u0023'</tt>,
+ * <font style="font-size:smaller;">NUMBER SIGN</font>); on
  * each line all characters following the first comment character are ignored.
  * The file must be encoded in UTF-8.
  *
@@ -484,6 +485,8 @@
      * Creates a new service loader for the given service type and class
      * loader.
      *
+     * @param  <S> the class of the service type
+     *
      * @param  service
      *         The interface or abstract class representing the service
      *
@@ -517,6 +520,8 @@
      * ServiceLoader.load(<i>service</i>,
      *                    Thread.currentThread().getContextClassLoader())</pre></blockquote>
      *
+     * @param  <S> the class of the service type
+     *
      * @param  service
      *         The interface or abstract class representing the service
      *
@@ -546,6 +551,8 @@
      * have been installed into the current Java virtual machine; providers on
      * the application's class path will be ignored.
      *
+     * @param  <S> the class of the service type
+     *
      * @param  service
      *         The interface or abstract class representing the service
      *
--- a/jdk/src/share/classes/java/util/StringJoiner.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/StringJoiner.java	Tue Aug 06 16:54:56 2013 -0700
@@ -202,15 +202,17 @@
      * @param other The {@code StringJoiner} whose contents should be merged
      *              into this one
      * @throws NullPointerException if the other {@code StringJoiner} is null
+     * @return This {@code StringJoiner}
      */
     public StringJoiner merge(StringJoiner other) {
         Objects.requireNonNull(other);
         if (other.value != null) {
+            final int length = other.value.length();
+            // lock the length so that we can seize the data to be appended
+            // before initiate copying to avoid interference, especially when
+            // merge 'this'
             StringBuilder builder = prepareBuilder();
-            StringBuilder otherBuilder = other.value;
-            if (other.prefix.length() < otherBuilder.length()) {
-                builder.append(otherBuilder, other.prefix.length(), otherBuilder.length());
-            }
+            builder.append(other.value, other.prefix.length(), length);
         }
         return this;
     }
--- a/jdk/src/share/classes/java/util/TimeZone.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/TimeZone.java	Tue Aug 06 16:54:56 2013 -0700
@@ -118,7 +118,7 @@
  * </pre></blockquote>
  * For example, TimeZone.getTimeZone("GMT-8").getID() returns "GMT-08:00".
  *
- * <h4>Three-letter time zone IDs</h4>
+ * <h3>Three-letter time zone IDs</h3>
  *
  * For compatibility with JDK 1.1.x, some other three-letter time zone IDs
  * (such as "PST", "CTT", "AST") are also supported. However, <strong>their
@@ -304,10 +304,10 @@
      * presentation to the user in the default locale.
      *
      * <p>This method is equivalent to:
-     * <pre><blockquote>
+     * <blockquote><pre>
      * getDisplayName(false, {@link #LONG},
      *                Locale.getDefault({@link Locale.Category#DISPLAY}))
-     * </blockquote></pre>
+     * </pre></blockquote>
      *
      * @return the human-readable name of this time zone in the default locale.
      * @since 1.2
@@ -325,9 +325,9 @@
      * presentation to the user in the specified {@code locale}.
      *
      * <p>This method is equivalent to:
-     * <pre><blockquote>
+     * <blockquote><pre>
      * getDisplayName(false, {@link #LONG}, locale)
-     * </blockquote></pre>
+     * </pre></blockquote>
      *
      * @param locale the locale in which to supply the display name.
      * @return the human-readable name of this time zone in the given locale.
@@ -347,10 +347,10 @@
      * Time). Otherwise, a Standard Time name is returned.
      *
      * <p>This method is equivalent to:
-     * <pre><blockquote>
+     * <blockquote><pre>
      * getDisplayName(daylight, style,
      *                Locale.getDefault({@link Locale.Category#DISPLAY}))
-     * </blockquote></pre>
+     * </pre></blockquote>
      *
      * @param daylight {@code true} specifying a Daylight Saving Time name, or
      *                 {@code false} specifying a Standard Time name
--- a/jdk/src/share/classes/java/util/TreeMap.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/TreeMap.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,6 +25,7 @@
 
 package java.util;
 
+import java.io.Serializable;
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
 import java.util.function.Consumer;
@@ -2865,7 +2866,7 @@
         }
 
         public int characteristics() {
-            return (side == 0 ? Spliterator.SIZED : 0);
+            return (side == 0 ? Spliterator.SIZED : 0) | Spliterator.ORDERED;
         }
     }
 
@@ -2942,9 +2943,23 @@
         }
 
         @Override
-        public Comparator<? super Map.Entry<K, V>> getComparator() {
-            return tree.comparator != null ?
-                    Map.Entry.comparingByKey(tree.comparator) : null;
+        public Comparator<Map.Entry<K, V>> getComparator() {
+            // Since SORTED is reported and Map.Entry elements are not comparable
+            // then a non-null comparator needs to be returned
+            if (tree.comparator != null) {
+                // Adapt the existing non-null comparator to compare entries
+                // by key
+                return Map.Entry.comparingByKey(tree.comparator);
+            }
+            else {
+                // Return a comparator of entries by key, with K assumed to be
+                // of Comparable
+                return (Comparator<Map.Entry<K, V>> & Serializable) (e1, e2) -> {
+                    @SuppressWarnings("unchecked")
+                    Comparable<? super K> k1 = (Comparable<? super K>) e1.getKey();
+                    return k1.compareTo(e2.getKey());
+                };
+            }
         }
     }
 }
--- a/jdk/src/share/classes/java/util/UUID.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/UUID.java	Tue Aug 06 16:54:56 2013 -0700
@@ -286,6 +286,7 @@
      *
      * @throws UnsupportedOperationException
      *         If this UUID is not a version 1 UUID
+     * @return The timestamp of this {@code UUID}.
      */
     public long timestamp() {
         if (version() != 1) {
--- a/jdk/src/share/classes/java/util/Vector.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/Vector.java	Tue Aug 06 16:54:56 2013 -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><a name="fail-fast">
  * The iterators returned by this class's {@link #iterator() iterator} and
- * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>:
+ * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em></a>:
  * 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
--- a/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/AbstractExecutorService.java	Tue Aug 06 16:54:56 2013 -0700
@@ -76,6 +76,7 @@
      *
      * @param runnable the runnable task being wrapped
      * @param value the default value for the returned future
+     * @param <T> the type of the given value
      * @return a {@code RunnableFuture} which, when run, will run the
      * underlying runnable and which, as a {@code Future}, will yield
      * the given value as its result and provide for cancellation of
@@ -90,6 +91,7 @@
      * Returns a {@code RunnableFuture} for the given callable task.
      *
      * @param callable the callable task being wrapped
+     * @param <T> the type of the callable's result
      * @return a {@code RunnableFuture} which, when run, will call the
      * underlying callable and which, as a {@code Future}, will yield
      * the callable's result as its result and provide for
--- a/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ConcurrentHashMap.java	Tue Aug 06 16:54:56 2013 -0700
@@ -265,7 +265,8 @@
  * @param <K> the type of keys maintained by this map
  * @param <V> the type of mapped values
  */
-public class ConcurrentHashMap<K,V> extends AbstractMap<K,V> implements ConcurrentMap<K,V>, Serializable {
+public class ConcurrentHashMap<K,V> extends AbstractMap<K,V>
+    implements ConcurrentMap<K,V>, Serializable {
     private static final long serialVersionUID = 7249069246763182397L;
 
     /*
@@ -439,16 +440,18 @@
      * related operations (which is the main reason we cannot use
      * existing collections such as TreeMaps). TreeBins contain
      * Comparable elements, but may contain others, as well as
-     * elements that are Comparable but not necessarily Comparable
-     * for the same T, so we cannot invoke compareTo among them. To
-     * handle this, the tree is ordered primarily by hash value, then
-     * by Comparable.compareTo order if applicable.  On lookup at a
-     * node, if elements are not comparable or compare as 0 then both
-     * left and right children may need to be searched in the case of
-     * tied hash values. (This corresponds to the full list search
-     * that would be necessary if all elements were non-Comparable and
-     * had tied hashes.)  The red-black balancing code is updated from
-     * pre-jdk-collections
+     * elements that are Comparable but not necessarily Comparable for
+     * the same T, so we cannot invoke compareTo among them. To handle
+     * this, the tree is ordered primarily by hash value, then by
+     * Comparable.compareTo order if applicable.  On lookup at a node,
+     * if elements are not comparable or compare as 0 then both left
+     * and right children may need to be searched in the case of tied
+     * hash values. (This corresponds to the full list search that
+     * would be necessary if all elements were non-Comparable and had
+     * tied hashes.) On insertion, to keep a total ordering (or as
+     * close as is required here) across rebalancings, we compare
+     * classes and identityHashCodes as tie-breakers. The red-black
+     * balancing code is updated from pre-jdk-collections
      * (http://gee.cs.oswego.edu/dl/classes/collections/RBCell.java)
      * based in turn on Cormen, Leiserson, and Rivest "Introduction to
      * Algorithms" (CLR).
@@ -478,6 +481,10 @@
      * unused "Segment" class that is instantiated in minimal form
      * only when serializing.
      *
+     * Also, solely for compatibility with previous versions of this
+     * class, it extends AbstractMap, even though all of its methods
+     * are overridden, so it is just useless baggage.
+     *
      * This file is organized to make things a little easier to follow
      * while reading than they might otherwise: First the main static
      * declarations and utilities, then fields, then main public
@@ -1352,6 +1359,7 @@
      * Saves the state of the {@code ConcurrentHashMap} instance to a
      * stream (i.e., serializes it).
      * @param s the stream
+     * @throws java.io.IOException if an I/O error occurs
      * @serialData
      * the key (Object) and value (Object)
      * for each key-value mapping, followed by a null pair.
@@ -1394,6 +1402,9 @@
     /**
      * Reconstitutes the instance from a stream (that is, deserializes it).
      * @param s the stream
+     * @throws ClassNotFoundException if the class of a serialized object
+     *         could not be found
+     * @throws java.io.IOException if an I/O error occurs
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
@@ -2080,6 +2091,7 @@
      * Creates a new {@link Set} backed by a ConcurrentHashMap
      * from the given type to {@code Boolean.TRUE}.
      *
+     * @param <K> the element type of the returned set
      * @return the new set
      * @since 1.8
      */
@@ -2094,9 +2106,10 @@
      *
      * @param initialCapacity The implementation performs internal
      * sizing to accommodate this many elements.
+     * @param <K> the element type of the returned set
+     * @return the new set
      * @throws IllegalArgumentException if the initial capacity of
      * elements is negative
-     * @return the new set
      * @since 1.8
      */
     public static <K> KeySetView<K,Boolean> newKeySet(int initialCapacity) {
@@ -2643,19 +2656,18 @@
                         p = pr;
                     else if ((pk = p.key) == k || (pk != null && k.equals(pk)))
                         return p;
-                    else if (pl == null && pr == null)
-                        break;
+                    else if (pl == null)
+                        p = pr;
+                    else if (pr == null)
+                        p = pl;
                     else if ((kc != null ||
                               (kc = comparableClassFor(k)) != null) &&
                              (dir = compareComparables(kc, k, pk)) != 0)
                         p = (dir < 0) ? pl : pr;
-                    else if (pl == null)
-                        p = pr;
-                    else if (pr == null ||
-                             (q = pr.findTreeNode(h, k, kc)) == null)
+                    else if ((q = pr.findTreeNode(h, k, kc)) != null)
+                        return q;
+                    else
                         p = pl;
-                    else
-                        return q;
                 } while (p != null);
             }
             return null;
@@ -2682,6 +2694,23 @@
         static final int READER = 4; // increment value for setting read lock
 
         /**
+         * Tie-breaking utility for ordering insertions when equal
+         * hashCodes and non-comparable. We don't require a total
+         * order, just a consistent insertion rule to maintain
+         * equivalence across rebalancings. Tie-breaking further than
+         * necessary simplifies testing a bit.
+         */
+        static int tieBreakOrder(Object a, Object b) {
+            int d;
+            if (a == null || b == null ||
+                (d = a.getClass().getName().
+                 compareTo(b.getClass().getName())) == 0)
+                d = (System.identityHashCode(a) <= System.identityHashCode(b) ?
+                     -1 : 1);
+            return d;
+        }
+
+        /**
          * Creates bin with initial set of nodes headed by b.
          */
         TreeBin(TreeNode<K,V> b) {
@@ -2697,21 +2726,21 @@
                     r = x;
                 }
                 else {
-                    Object key = x.key;
-                    int hash = x.hash;
+                    K k = x.key;
+                    int h = x.hash;
                     Class<?> kc = null;
                     for (TreeNode<K,V> p = r;;) {
                         int dir, ph;
-                        if ((ph = p.hash) > hash)
+                        K pk = p.key;
+                        if ((ph = p.hash) > h)
                             dir = -1;
-                        else if (ph < hash)
+                        else if (ph < h)
                             dir = 1;
-                        else if ((kc != null ||
-                                  (kc = comparableClassFor(key)) != null))
-                            dir = compareComparables(kc, key, p.key);
-                        else
-                            dir = 0;
-                        TreeNode<K,V> xp = p;
+                        else if ((kc == null &&
+                                  (kc = comparableClassFor(k)) == null) ||
+                                 (dir = compareComparables(kc, k, pk)) == 0)
+                            dir = tieBreakOrder(k, pk);
+                            TreeNode<K,V> xp = p;
                         if ((p = (dir <= 0) ? p.left : p.right) == null) {
                             x.parent = xp;
                             if (dir <= 0)
@@ -2725,6 +2754,7 @@
                 }
             }
             this.root = r;
+            assert checkInvariants(root);
         }
 
         /**
@@ -2805,8 +2835,9 @@
          */
         final TreeNode<K,V> putTreeVal(int h, K k, V v) {
             Class<?> kc = null;
+            boolean searched = false;
             for (TreeNode<K,V> p = root;;) {
-                int dir, ph; K pk; TreeNode<K,V> q, pr;
+                int dir, ph; K pk;
                 if (p == null) {
                     first = root = new TreeNode<K,V>(h, k, v, null, null);
                     break;
@@ -2820,21 +2851,25 @@
                 else if ((kc == null &&
                           (kc = comparableClassFor(k)) == null) ||
                          (dir = compareComparables(kc, k, pk)) == 0) {
-                    if (p.left == null)
-                        dir = 1;
-                    else if ((pr = p.right) == null ||
-                             (q = pr.findTreeNode(h, k, kc)) == null)
-                        dir = -1;
-                    else
-                        return q;
+                    if (!searched) {
+                        TreeNode<K,V> q, ch;
+                        searched = true;
+                        if (((ch = p.left) != null &&
+                             (q = ch.findTreeNode(h, k, kc)) != null) ||
+                            ((ch = p.right) != null &&
+                             (q = ch.findTreeNode(h, k, kc)) != null))
+                            return q;
+                    }
+                    dir = tieBreakOrder(k, pk);
                 }
+
                 TreeNode<K,V> xp = p;
-                if ((p = (dir < 0) ? p.left : p.right) == null) {
+                if ((p = (dir <= 0) ? p.left : p.right) == null) {
                     TreeNode<K,V> x, f = first;
                     first = x = new TreeNode<K,V>(h, k, v, f, xp);
                     if (f != null)
                         f.prev = x;
-                    if (dir < 0)
+                    if (dir <= 0)
                         xp.left = x;
                     else
                         xp.right = x;
@@ -3546,6 +3581,7 @@
      * for an element, or null if there is no transformation (in
      * which case the action is not applied)
      * @param action the action
+     * @param <U> the return type of the transformer
      * @since 1.8
      */
     public <U> void forEach(long parallelismThreshold,
@@ -3569,6 +3605,7 @@
      * needed for this operation to be executed in parallel
      * @param searchFunction a function returning a non-null
      * result on success, else null
+     * @param <U> the return type of the search function
      * @return a non-null result from applying the given search
      * function on each (key, value), or null if none
      * @since 1.8
@@ -3592,6 +3629,7 @@
      * for an element, or null if there is no transformation (in
      * which case it is not combined)
      * @param reducer a commutative associative combining function
+     * @param <U> the return type of the transformer
      * @return the result of accumulating the given transformation
      * of all (key, value) pairs
      * @since 1.8
@@ -3710,6 +3748,7 @@
      * for an element, or null if there is no transformation (in
      * which case the action is not applied)
      * @param action the action
+     * @param <U> the return type of the transformer
      * @since 1.8
      */
     public <U> void forEachKey(long parallelismThreshold,
@@ -3733,6 +3772,7 @@
      * needed for this operation to be executed in parallel
      * @param searchFunction a function returning a non-null
      * result on success, else null
+     * @param <U> the return type of the search function
      * @return a non-null result from applying the given search
      * function on each key, or null if none
      * @since 1.8
@@ -3775,6 +3815,7 @@
      * for an element, or null if there is no transformation (in
      * which case it is not combined)
      * @param reducer a commutative associative combining function
+     * @param <U> the return type of the transformer
      * @return the result of accumulating the given transformation
      * of all keys
      * @since 1.8
@@ -3894,6 +3935,7 @@
      * for an element, or null if there is no transformation (in
      * which case the action is not applied)
      * @param action the action
+     * @param <U> the return type of the transformer
      * @since 1.8
      */
     public <U> void forEachValue(long parallelismThreshold,
@@ -3917,6 +3959,7 @@
      * needed for this operation to be executed in parallel
      * @param searchFunction a function returning a non-null
      * result on success, else null
+     * @param <U> the return type of the search function
      * @return a non-null result from applying the given search
      * function on each value, or null if none
      * @since 1.8
@@ -3958,6 +4001,7 @@
      * for an element, or null if there is no transformation (in
      * which case it is not combined)
      * @param reducer a commutative associative combining function
+     * @param <U> the return type of the transformer
      * @return the result of accumulating the given transformation
      * of all values
      * @since 1.8
@@ -4075,6 +4119,7 @@
      * for an element, or null if there is no transformation (in
      * which case the action is not applied)
      * @param action the action
+     * @param <U> the return type of the transformer
      * @since 1.8
      */
     public <U> void forEachEntry(long parallelismThreshold,
@@ -4098,6 +4143,7 @@
      * needed for this operation to be executed in parallel
      * @param searchFunction a function returning a non-null
      * result on success, else null
+     * @param <U> the return type of the search function
      * @return a non-null result from applying the given search
      * function on each entry, or null if none
      * @since 1.8
@@ -4139,6 +4185,7 @@
      * for an element, or null if there is no transformation (in
      * which case it is not combined)
      * @param reducer a commutative associative combining function
+     * @param <U> the return type of the transformer
      * @return the result of accumulating the given transformation
      * of all entries
      * @since 1.8
--- a/jdk/src/share/classes/java/util/concurrent/ExecutorService.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ExecutorService.java	Tue Aug 06 16:54:56 2013 -0700
@@ -227,6 +227,7 @@
      * {@link Callable} form so they can be submitted.
      *
      * @param task the task to submit
+     * @param <T> the type of the task's result
      * @return a Future representing pending completion of the task
      * @throws RejectedExecutionException if the task cannot be
      *         scheduled for execution
@@ -241,6 +242,7 @@
      *
      * @param task the task to submit
      * @param result the result to return
+     * @param <T> the type of the result
      * @return a Future representing pending completion of the task
      * @throws RejectedExecutionException if the task cannot be
      *         scheduled for execution
@@ -272,6 +274,7 @@
      * collection is modified while this operation is in progress.
      *
      * @param tasks the collection of tasks
+     * @param <T> the type of the values returned from the tasks
      * @return a list of Futures representing the tasks, in the same
      *         sequential order as produced by the iterator for the
      *         given task list, each of which has completed
@@ -299,6 +302,7 @@
      * @param tasks the collection of tasks
      * @param timeout the maximum time to wait
      * @param unit the time unit of the timeout argument
+     * @param <T> the type of the values returned from the tasks
      * @return a list of Futures representing the tasks, in the same
      *         sequential order as produced by the iterator for the
      *         given task list. If the operation did not time out,
@@ -324,6 +328,7 @@
      * collection is modified while this operation is in progress.
      *
      * @param tasks the collection of tasks
+     * @param <T> the type of the values returned from the tasks
      * @return the result returned by one of the tasks
      * @throws InterruptedException if interrupted while waiting
      * @throws NullPointerException if tasks or any element task
@@ -348,6 +353,7 @@
      * @param tasks the collection of tasks
      * @param timeout the maximum time to wait
      * @param unit the time unit of the timeout argument
+     * @param <T> the type of the values returned from the tasks
      * @return the result returned by one of the tasks
      * @throws InterruptedException if interrupted while waiting
      * @throws NullPointerException if tasks, or unit, or any element
--- a/jdk/src/share/classes/java/util/concurrent/Executors.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/Executors.java	Tue Aug 06 16:54:56 2013 -0700
@@ -397,6 +397,7 @@
      * {@code Callable} to an otherwise resultless action.
      * @param task the task to run
      * @param result the result to return
+     * @param <T> the type of the result
      * @return a callable object
      * @throws NullPointerException if task null
      */
@@ -458,6 +459,7 @@
      * action; or if not possible, throw an associated {@link
      * AccessControlException}.
      * @param callable the underlying task
+     * @param <T> the type of the callable's result
      * @return a callable object
      * @throws NullPointerException if callable null
      */
@@ -480,6 +482,7 @@
      * AccessControlException}.
      *
      * @param callable the underlying task
+     * @param <T> the type of the callable's result
      * @return a callable object
      * @throws NullPointerException if callable null
      * @throws AccessControlException if the current access control
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java	Tue Aug 06 16:54:56 2013 -0700
@@ -561,8 +561,8 @@
          * Returns a new worker thread operating in the given pool.
          *
          * @param pool the pool this thread works in
+         * @return the new worker thread
          * @throws NullPointerException if the pool is null
-         * @return the new worker thread
          */
         public ForkJoinWorkerThread newThread(ForkJoinPool pool);
     }
@@ -2497,6 +2497,7 @@
      * minimally only the latter.
      *
      * @param task the task
+     * @param <T> the type of the task's result
      * @return the task's result
      * @throws NullPointerException if the task is null
      * @throws RejectedExecutionException if the task cannot be
@@ -2545,6 +2546,7 @@
      * Submits a ForkJoinTask for execution.
      *
      * @param task the task to submit
+     * @param <T> the type of the task's result
      * @return the task
      * @throws NullPointerException if the task is null
      * @throws RejectedExecutionException if the task cannot be
--- a/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java	Tue Aug 06 16:54:56 2013 -0700
@@ -810,6 +810,7 @@
      * unprocessed.
      *
      * @param tasks the collection of tasks
+     * @param <T> the type of the values returned from the tasks
      * @return the tasks argument, to simplify usage
      * @throws NullPointerException if tasks or any element are null
      */
@@ -1472,6 +1473,7 @@
      *
      * @param runnable the runnable action
      * @param result the result upon completion
+     * @param <T> the type of the result
      * @return the task
      */
     public static <T> ForkJoinTask<T> adapt(Runnable runnable, T result) {
@@ -1485,6 +1487,7 @@
      * encountered into {@code RuntimeException}.
      *
      * @param callable the callable action
+     * @param <T> the type of the callable's result
      * @return the task
      */
     public static <T> ForkJoinTask<T> adapt(Callable<? extends T> callable) {
@@ -1498,6 +1501,8 @@
     /**
      * Saves this task to a stream (that is, serializes it).
      *
+     * @param s the stream
+     * @throws java.io.IOException if an I/O error occurs
      * @serialData the current run status and the exception thrown
      * during execution, or {@code null} if none
      */
@@ -1509,6 +1514,10 @@
 
     /**
      * Reconstitutes this task from a stream (that is, deserializes it).
+     * @param s the stream
+     * @throws ClassNotFoundException if the class of a serialized object
+     *         could not be found
+     * @throws java.io.IOException if an I/O error occurs
      */
     private void readObject(java.io.ObjectInputStream s)
         throws java.io.IOException, ClassNotFoundException {
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledExecutorService.java	Tue Aug 06 16:54:56 2013 -0700
@@ -117,6 +117,7 @@
      * @param callable the function to execute
      * @param delay the time from now to delay execution
      * @param unit the time unit of the delay parameter
+     * @param <V> the type of the callable's result
      * @return a ScheduledFuture that can be used to extract result or cancel
      * @throws RejectedExecutionException if the task cannot be
      *         scheduled for execution
--- a/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/ScheduledThreadPoolExecutor.java	Tue Aug 06 16:54:56 2013 -0700
@@ -392,6 +392,7 @@
      *
      * @param runnable the submitted Runnable
      * @param task the task created to execute the runnable
+     * @param <V> the type of the task's result
      * @return a task that can execute the runnable
      * @since 1.6
      */
@@ -408,6 +409,7 @@
      *
      * @param callable the submitted Callable
      * @param task the task created to execute the callable
+     * @param <V> the type of the task's result
      * @return a task that can execute the callable
      * @since 1.6
      */
--- a/jdk/src/share/classes/java/util/concurrent/TimeUnit.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/TimeUnit.java	Tue Aug 06 16:54:56 2013 -0700
@@ -69,6 +69,9 @@
  * @author Doug Lea
  */
 public enum TimeUnit {
+    /**
+     * Time unit representing one thousandth of a microsecond
+     */
     NANOSECONDS {
         public long toNanos(long d)   { return d; }
         public long toMicros(long d)  { return d/(C1/C0); }
@@ -80,6 +83,10 @@
         public long convert(long d, TimeUnit u) { return u.toNanos(d); }
         int excessNanos(long d, long m) { return (int)(d - (m*C2)); }
     },
+
+    /**
+     * Time unit representing one thousandth of a millisecond
+     */
     MICROSECONDS {
         public long toNanos(long d)   { return x(d, C1/C0, MAX/(C1/C0)); }
         public long toMicros(long d)  { return d; }
@@ -91,6 +98,10 @@
         public long convert(long d, TimeUnit u) { return u.toMicros(d); }
         int excessNanos(long d, long m) { return (int)((d*C1) - (m*C2)); }
     },
+
+    /**
+     * Time unit representing one thousandth of a second
+     */
     MILLISECONDS {
         public long toNanos(long d)   { return x(d, C2/C0, MAX/(C2/C0)); }
         public long toMicros(long d)  { return x(d, C2/C1, MAX/(C2/C1)); }
@@ -102,6 +113,10 @@
         public long convert(long d, TimeUnit u) { return u.toMillis(d); }
         int excessNanos(long d, long m) { return 0; }
     },
+
+    /**
+     * Time unit representing one second
+     */
     SECONDS {
         public long toNanos(long d)   { return x(d, C3/C0, MAX/(C3/C0)); }
         public long toMicros(long d)  { return x(d, C3/C1, MAX/(C3/C1)); }
@@ -113,6 +128,10 @@
         public long convert(long d, TimeUnit u) { return u.toSeconds(d); }
         int excessNanos(long d, long m) { return 0; }
     },
+
+    /**
+     * Time unit representing sixty seconds
+     */
     MINUTES {
         public long toNanos(long d)   { return x(d, C4/C0, MAX/(C4/C0)); }
         public long toMicros(long d)  { return x(d, C4/C1, MAX/(C4/C1)); }
@@ -124,6 +143,10 @@
         public long convert(long d, TimeUnit u) { return u.toMinutes(d); }
         int excessNanos(long d, long m) { return 0; }
     },
+
+    /**
+     * Time unit representing sixty minutes
+     */
     HOURS {
         public long toNanos(long d)   { return x(d, C5/C0, MAX/(C5/C0)); }
         public long toMicros(long d)  { return x(d, C5/C1, MAX/(C5/C1)); }
@@ -135,6 +158,10 @@
         public long convert(long d, TimeUnit u) { return u.toHours(d); }
         int excessNanos(long d, long m) { return 0; }
     },
+
+    /**
+     * Time unit representing twenty four hours
+     */
     DAYS {
         public long toNanos(long d)   { return x(d, C6/C0, MAX/(C6/C0)); }
         public long toMicros(long d)  { return x(d, C6/C1, MAX/(C6/C1)); }
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Tue Aug 06 16:54:56 2013 -0700
@@ -71,6 +71,7 @@
      *
      * @param tclass the class of the objects holding the field
      * @param fieldName the name of the field to be updated
+     * @param <U> the type of instances of tclass
      * @return the updater
      * @throws IllegalArgumentException if the field is not a
      * volatile integer type
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Tue Aug 06 16:54:56 2013 -0700
@@ -71,6 +71,7 @@
      *
      * @param tclass the class of the objects holding the field
      * @param fieldName the name of the field to be updated
+     * @param <U> the type of instances of tclass
      * @return the updater
      * @throws IllegalArgumentException if the field is not a
      * volatile long type
--- a/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Tue Aug 06 16:54:56 2013 -0700
@@ -91,6 +91,8 @@
      * @param tclass the class of the objects holding the field
      * @param vclass the class of the field
      * @param fieldName the name of the field to be updated
+     * @param <U> the type of instances of tclass
+     * @param <W> the type of instances of vclass
      * @return the updater
      * @throws ClassCastException if the field is of the wrong type
      * @throws IllegalArgumentException if the field is not volatile
--- a/jdk/src/share/classes/java/util/function/BiConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/BiConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,13 +27,16 @@
 import java.util.Objects;
 
 /**
- * An operation which accepts two input arguments and returns no result. This is
- * the two-arity specialization of {@link Consumer}. Unlike most other
- * functional interfaces, {@code BiConsumer} is expected to operate via
- * side-effects.
+ * Represents an operation that accepts two input arguments and returns no
+ * result.  This is the two-arity specialization of {@link Consumer}.
+ * Unlike most other functional interfaces, {@code BiConsumer} is expected
+ * to operate via side-effects.
  *
- * @param <T> the type of the first argument to the {@code accept} operation
- * @param <U> the type of the second argument to the {@code accept} operation
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(Object, Object)}.
+ *
+ * @param <T> the type of the first argument to the operation
+ * @param <U> the type of the second argument to the operation
  *
  * @see Consumer
  * @since 1.8
@@ -42,35 +45,31 @@
 public interface BiConsumer<T, U> {
 
     /**
-     * Performs operations upon the provided objects which may modify those
-     * objects and/or external state.
+     * Performs this operation on the given arguments.
      *
-     * @param t an input object
-     * @param u an input object
+     * @param t the first input argument
+     * @param u the second input argument
      */
     void accept(T t, U u);
 
     /**
-     * Returns a {@code BiConsumer} which performs, in sequence, the operation
-     * represented by this object followed by the operation represented by
-     * the other {@code BiConsumer}.
-     *
-     * <p>Any exceptions thrown by either {@code accept} method are relayed
-     * to the caller; if performing this operation throws an exception, the
-     * other operation will not be performed.
+     * Returns a composed {@code BiConsumer} that performs, in sequence, this
+     * operation followed by the {@code after} operation. If performing either
+     * operation throws an exception, it is relayed to the caller of the
+     * composed operation.  If performing this operation throws an exception,
+     * the {@code after} operation will not be performed.
      *
-     * @param other a BiConsumer which will be chained after this BiConsumer
-     * @return a BiConsumer which performs in sequence the {@code accept} method
-     * of this BiConsumer and the {@code accept} method of the specified
-     * BiConsumer operation
-     * @throws NullPointerException if other is null
+     * @param after the operation to perform after this operation
+     * @return a composed {@code BiConsumer} that performs in sequence this
+     * operation followed by the {@code after} operation
+     * @throws NullPointerException if {@code after} is null
      */
-    default BiConsumer<T, U> chain(BiConsumer<? super T, ? super U> other) {
-        Objects.requireNonNull(other);
+    default BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> after) {
+        Objects.requireNonNull(after);
 
         return (l, r) -> {
             accept(l, r);
-            other.accept(l, r);
+            after.accept(l, r);
         };
     }
 }
--- a/jdk/src/share/classes/java/util/function/BiFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/BiFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,14 +27,15 @@
 import java.util.Objects;
 
 /**
- * Apply a function to the input arguments, yielding an appropriate result. This
- * is the two-arity specialization of {@link Function}. A function may
- * variously provide a mapping between types, object instances or keys and
- * values or any other form of transformation upon the input.
+ * Represents a function that accepts two arguments and produces a result.
+ * This is the two-arity specialization of {@link Function}.
  *
- * @param <T> the type of the first argument to the {@code apply} operation
- * @param <U> the type of the second argument to the {@code apply} operation
- * @param <R> the type of results returned by the {@code apply} operation
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(Object, Object)}.
+ *
+ * @param <T> the type of the first argument to the function
+ * @param <U> the type of the second argument to the function
+ * @param <R> the type of the result of the function
  *
  * @see Function
  * @since 1.8
@@ -43,25 +44,25 @@
 public interface BiFunction<T, U, R> {
 
     /**
-     * Compute the result of applying the function to the input arguments
+     * Applies this function to the given arguments.
      *
-     * @param t an input object
-     * @param u an input object
+     * @param t the first function argument
+     * @param u the second function argument
      * @return the function result
      */
     R apply(T t, U u);
 
     /**
-     * Returns a new function which applies this function followed by the
-     * provided function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed function that first applies this function to
+     * its input, and then applies the {@code after} function to the result.
+     * If evaluation of either function throws an exception, it is relayed to
+     * the caller of the composed function.
      *
-     * @param <V> Type of output objects to the combined function. May be the
-     * same type as {@code <T>}, {@code <U>} or {@code <R>}
-     * @param after An additional function to be applied after this function is
-     * applied
-     * @return A function which performs this function followed by the provided
-     * function
+     * @param <V> the type of output of the {@code after} function, and of the
+     *           composed function
+     * @param after the function to apply after this function is applied
+     * @return a composed function that first applies this function and then
+     * applies the {@code after} function
      * @throws NullPointerException if after is null
      */
     default <V> BiFunction<T, U, V> andThen(Function<? super R, ? extends V> after) {
--- a/jdk/src/share/classes/java/util/function/BiPredicate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/BiPredicate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,11 +27,14 @@
 import java.util.Objects;
 
 /**
- * Determines if the input objects match some criteria. This is the two-arity
- * specialization of {@link Predicate}.
+ * Represents a predicate (boolean-valued function) of two arguments.  This is
+ * the two-arity specialization of {@link Predicate}.
  *
- * @param <T> the type of the first argument to {@code test}
- * @param <U> the type of the second argument to {@code test}
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #test(Object, Object)}.
+ *
+ * @param <T> the type of the first argument to the predicate
+ * @param <U> the type of the second argument the predicate
  *
  * @see Predicate
  * @since 1.8
@@ -40,34 +43,41 @@
 public interface BiPredicate<T, U> {
 
     /**
-     * Return {@code true} if the inputs match some criteria.
+     * Evaluates this predicate on the given arguments.
      *
-     * @param t an input object
-     * @param u an input object
-     * @return {@code true} if the inputs match some criteria
+     * @param t the first input argument
+     * @param u the second input argument
+     * @return {@code true} if the input arguments match the predicate,
+     * otherwise {@code false}
      */
     boolean test(T t, U u);
 
     /**
-     * Returns a predicate which evaluates to {@code true} only if this
-     * predicate and the provided predicate both evaluate to {@code true}. If
-     * this predicate returns {@code false} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * AND of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code false}, then the {@code other}
+     * predicate is not evaluated.
+     *
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ANDed with this predicate
-     * @return a new predicate which returns {@code true} only if both
-     * predicates return {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ANDed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * AND of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default BiPredicate<T, U> and(BiPredicate<? super T, ? super U> p) {
-        Objects.requireNonNull(p);
-        return (T t, U u) -> test(t, u) && p.test(t, u);
+    default BiPredicate<T, U> and(BiPredicate<? super T, ? super U> other) {
+        Objects.requireNonNull(other);
+        return (T t, U u) -> test(t, u) && other.test(t, u);
     }
 
     /**
-     * Returns a predicate which negates the result of this predicate.
+     * Returns a predicate that represents the logical negation of this
+     * predicate.
      *
-     * @return a new predicate who's result is always the opposite of this
+     * @return a predicate that represents the logical negation of this
      * predicate
      */
     default BiPredicate<T, U> negate() {
@@ -75,18 +85,23 @@
     }
 
     /**
-     * Returns a predicate which evaluates to {@code true} if either this
-     * predicate or the provided predicate evaluates to {@code true}. If this
-     * predicate returns {@code true} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * OR of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code true}, then the {@code other}
+     * predicate is not evaluated.
+     *
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ORed with this predicate
-     * @return a new predicate which returns {@code true} if either predicate
-     * returns {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ORed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * OR of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default BiPredicate<T, U> or(BiPredicate<? super T, ? super U> p) {
-        Objects.requireNonNull(p);
-        return (T t, U u) -> test(t, u) || p.test(t, u);
+    default BiPredicate<T, U> or(BiPredicate<? super T, ? super U> other) {
+        Objects.requireNonNull(other);
+        return (T t, U u) -> test(t, u) || other.test(t, u);
     }
 }
--- a/jdk/src/share/classes/java/util/function/BinaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/BinaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -28,42 +28,48 @@
 import java.util.Comparator;
 
 /**
- * An operation upon two operands yielding a result. This is a specialization of
- * {@code BiFunction} where the operands and the result are all of the same type.
+ * Represents an operation upon two operands of the same type, producing a result
+ * of the same type as the operands.  This is a specialization of
+ * {@link BiFunction} for the case where the operands and the result are all of
+ * the same type.
  *
- * @param <T> the type of operands to {@code apply} and of the result
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(Object, Object)}.
+ *
+ * @param <T> the type of the operands and result of the operator
  *
  * @see BiFunction
+ * @see UnaryOperator
  * @since 1.8
  */
 @FunctionalInterface
 public interface BinaryOperator<T> extends BiFunction<T,T,T> {
     /**
      * Returns a {@link BinaryOperator} which returns the lesser of two elements
-     * according to the specified {@code Comparator}
+     * according to the specified {@code Comparator}.
      *
-     * @param <T> the type of values to be compared and returned
-     * @param  comparator a {@code Comparator} for comparing the two values
+     * @param <T> the type of the input arguments of the comparator
+     * @param comparator a {@code Comparator} for comparing the two values
      * @return a {@code BinaryOperator} which returns the lesser of its operands,
      *         according to the supplied {@code Comparator}
      * @throws NullPointerException if the argument is null
      */
-    public static<T> BinaryOperator<T> minBy(Comparator<? super T> comparator) {
+    public static <T> BinaryOperator<T> minBy(Comparator<? super T> comparator) {
         Objects.requireNonNull(comparator);
         return (a, b) -> comparator.compare(a, b) <= 0 ? a : b;
     }
 
     /**
      * Returns a {@link BinaryOperator} which returns the greater of two elements
-     * according to the specified {@code Comparator}
+     * according to the specified {@code Comparator}.
      *
-     * @param <T> the type of values to be compared and returned
-     * @param  comparator a {@code Comparator} for comparing the two values
+     * @param <T> the type of the input arguments of the comparator
+     * @param comparator a {@code Comparator} for comparing the two values
      * @return a {@code BinaryOperator} which returns the greater of its operands,
      *         according to the supplied {@code Comparator}
      * @throws NullPointerException if the argument is null
      */
-    public static<T> BinaryOperator<T> maxBy(Comparator<? super T> comparator) {
+    public static <T> BinaryOperator<T> maxBy(Comparator<? super T> comparator) {
         Objects.requireNonNull(comparator);
         return (a, b) -> comparator.compare(a, b) >= 0 ? a : b;
     }
--- a/jdk/src/share/classes/java/util/function/BooleanSupplier.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/BooleanSupplier.java	Tue Aug 06 16:54:56 2013 -0700
@@ -26,8 +26,14 @@
 
 
 /**
- * A supplier of {@code boolean} values. This is the {@code boolean}-providing
- * primitive specialization of {@link Supplier}.
+ * Represents a supplier of {@code boolean}-valued results.  This is the
+ * {@code boolean}-producing primitive specialization of {@link Supplier}.
+ *
+ * <p>There is no requirement that a new or distinct result be returned each
+ * time the supplier is invoked.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #getAsBoolean()}.
  *
  * @see Supplier
  * @since 1.8
@@ -36,9 +42,9 @@
 public interface BooleanSupplier {
 
     /**
-     * Returns a {@code boolean} value.
+     * Gets a result.
      *
-     * @return a {@code boolean} value
+     * @return a result
      */
     boolean getAsBoolean();
 }
--- a/jdk/src/share/classes/java/util/function/Consumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/Consumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,11 +27,14 @@
 import java.util.Objects;
 
 /**
- * An operation which accepts a single input argument and returns no result.
- * Unlike most other functional interfaces, {@code Consumer} is expected to
- * operate via side-effects.
+ * Represents an operation that accepts a single input argument and returns no
+ * result. Unlike most other functional interfaces, {@code Consumer} is expected
+ * to operate via side-effects.
  *
- * @param <T> The type of input objects to {@code accept}
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(Object)}.
+ *
+ * @param <T> the type of the input to the operation
  *
  * @since 1.8
  */
@@ -39,29 +42,26 @@
 public interface Consumer<T> {
 
     /**
-     * Accept an input value.
+     * Performs this operation on the given argument.
      *
-     * @param t the input object
+     * @param t the input argument
      */
     void accept(T t);
 
     /**
-     * Returns a {@code Consumer} which performs, in sequence, the operation
-     * represented by this object followed by the operation represented by
-     * the other {@code Consumer}.
-     *
-     * <p>Any exceptions thrown by either {@code accept} method are relayed
-     * to the caller; if performing this operation throws an exception, the
-     * other operation will not be performed.
+     * Returns a composed {@code Consumer} that performs, in sequence, this
+     * operation followed by the {@code after} operation. If performing either
+     * operation throws an exception, it is relayed to the caller of the
+     * composed operation.  If performing this operation throws an exception,
+     * the {@code after} operation will not be performed.
      *
-     * @param other a Consumer which will be chained after this Consumer
-     * @return a Consumer which performs in sequence the {@code accept} method
-     * of this Consumer and the {@code accept} method of the specified Consumer
-     * operation
-     * @throws NullPointerException if other is null
+     * @param after the operation to perform after this operation
+     * @return a composed {@code Consumer} that performs in sequence this
+     * operation followed by the {@code after} operation
+     * @throws NullPointerException if {@code after} is null
      */
-    default Consumer<T> chain(Consumer<? super T> other) {
-        Objects.requireNonNull(other);
-        return (T t) -> { accept(t); other.accept(t); };
+    default Consumer<T> andThen(Consumer<? super T> after) {
+        Objects.requireNonNull(after);
+        return (T t) -> { accept(t); after.accept(t); };
     }
 }
--- a/jdk/src/share/classes/java/util/function/DoubleBinaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleBinaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,23 +25,25 @@
 package java.util.function;
 
 /**
- * An operation on two {@code double} operands yielding a {@code double} result.
- * This is the primitive type specialization of {@link BinaryOperator} for
- * {@code double}.
+ * Represents an operation upon two {@code double}-valued operands and producing a
+ * {@code double}-valued result.   This is the primitive type specialization of
+ * {@link BinaryOperator} for {@code double}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsDouble(double, double)}.
  *
  * @see BinaryOperator
+ * @see DoubleUnaryOperator
  * @since 1.8
  */
 @FunctionalInterface
 public interface DoubleBinaryOperator {
     /**
-     * Returns the {@code double} result of the operation upon the
-     * {@code double} operands. The parameters are named {@code left} and
-     * {@code right} for operations where the order of parameters matters.
+     * Applies this operator to the given operands.
      *
-     * @param left the left operand value
-     * @param right the right operand value
-     * @return the result of the operation
+     * @param left the first operand
+     * @param right the second operand
+     * @return the operator result
      */
     double applyAsDouble(double left, double right);
 }
--- a/jdk/src/share/classes/java/util/function/DoubleConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,11 +27,14 @@
 import java.util.Objects;
 
 /**
- * An operation which accepts a single double argument and returns no result.
- * This is the primitive type specialization of {@link Consumer} for
- * {@code double}. Unlike most other functional interfaces,
+ * Represents an operation that accepts a single {@code double}-valued argument and
+ * returns no result.  This is the primitive type specialization of
+ * {@link Consumer} for {@code double}.  Unlike most other functional interfaces,
  * {@code DoubleConsumer} is expected to operate via side-effects.
  *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(double)}.
+ *
  * @see Consumer
  * @since 1.8
  */
@@ -39,30 +42,26 @@
 public interface DoubleConsumer {
 
     /**
-     * Accept an input value.
+     * Performs this operation on the given argument.
      *
-     * @param value the input value
+     * @param value the input argument
      */
     void accept(double value);
 
     /**
-     * Returns a {@code DoubleConsumer} which performs, in sequence, the operation
-     * represented by this object followed by the operation represented by
-     * another {@code DoubleConsumer}.
-     *
-     * <p>Any exceptions thrown by either {@code accept} method are relayed
-     * to the caller; if performing this operation throws an exception, the
-     * other operation will not be performed.
+     * Returns a composed {@code DoubleConsumer} that performs, in sequence, this
+     * operation followed by the {@code after} operation. If performing either
+     * operation throws an exception, it is relayed to the caller of the
+     * composed operation.  If performing this operation throws an exception,
+     * the {@code after} operation will not be performed.
      *
-     * @param other a DoubleConsumer which will be chained after this
-     * DoubleConsumer
-     * @return an DoubleConsumer which performs in sequence the {@code accept} method
-     * of this DoubleConsumer and the {@code accept} method of the specified IntConsumer
-     * operation
-     * @throws NullPointerException if other is null
+     * @param after the operation to perform after this operation
+     * @return a composed {@code DoubleConsumer} that performs in sequence this
+     * operation followed by the {@code after} operation
+     * @throws NullPointerException if {@code after} is null
      */
-    default DoubleConsumer chain(DoubleConsumer other) {
-        Objects.requireNonNull(other);
-        return (double t) -> { accept(t); other.accept(t); };
+    default DoubleConsumer andThen(DoubleConsumer after) {
+        Objects.requireNonNull(after);
+        return (double t) -> { accept(t); after.accept(t); };
     }
 }
--- a/jdk/src/share/classes/java/util/function/DoubleFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,11 +25,14 @@
 package java.util.function;
 
 /**
- * Apply a function to the double-valued input argument, yielding an appropriate
- * result. This is the {@code double}-consuming primitive specialization for
+ * Represents a function that accepts a double-valued argument and produces a
+ * result.  This is the {@code double}-consuming primitive specialization for
  * {@link Function}.
  *
- * @param <R> the type of output objects from the function
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(double)}.
+ *
+ * @param <R> the type of the result of the function
  *
  * @see Function
  * @since 1.8
@@ -38,9 +41,9 @@
 public interface DoubleFunction<R> {
 
     /**
-     * Compute the result of applying the function to the input argument
+     * Applies this function to the given argument.
      *
-     * @param value the input value
+     * @param value the function argument
      * @return the function result
      */
     R apply(double value);
--- a/jdk/src/share/classes/java/util/function/DoublePredicate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoublePredicate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,9 +27,12 @@
 import java.util.Objects;
 
 /**
- * Determines if the {@code double} input value matches some criteria. This is
- * the {@code double}-consuming primitive type specialization of
- * {@link Predicate}.
+ * Represents a predicate (boolean-valued function) of one {@code double}-valued
+ * argument. This is the {@code double}-consuming primitive type specialization
+ * of {@link Predicate}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #test(double)}.
  *
  * @see Predicate
  * @since 1.8
@@ -38,38 +41,40 @@
 public interface DoublePredicate {
 
     /**
-     * Returns {@code true} if the input value matches some criteria.
+     * Evaluates this predicate on the given argument.
      *
-     * @param value the value to be tested
-     * @return {@code true} if the input value matches some criteria, otherwise
-     * {@code false}
+     * @param value the input argument
+     * @return {@code true} if the input argument matches the predicate,
+     * otherwise {@code false}
      */
     boolean test(double value);
 
     /**
-     * Returns a predicate which evaluates to {@code true} only if this
-     * predicate and the provided predicate both evaluate to {@code true}. If
-     * this predicate returns {@code false} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * AND of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code false}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ANDed with this predicate
-     * @return a new predicate which returns {@code true} only if both
-     * predicates return {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ANDed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * AND of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default DoublePredicate and(DoublePredicate p) {
-        Objects.requireNonNull(p);
-        return (value) -> test(value) && p.test(value);
+    default DoublePredicate and(DoublePredicate other) {
+        Objects.requireNonNull(other);
+        return (value) -> test(value) && other.test(value);
     }
 
     /**
-     * Returns a predicate which negates the result of this predicate.
+     * Returns a predicate that represents the logical negation of this
+     * predicate.
      *
-     * @return a new predicate who's result is always the opposite of this
+     * @return a predicate that represents the logical negation of this
      * predicate
      */
     default DoublePredicate negate() {
@@ -77,22 +82,23 @@
     }
 
     /**
-     * Returns a predicate which evaluates to {@code true} if either this
-     * predicate or the provided predicate evaluates to {@code true}. If this
-     * predicate returns {@code true} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * OR of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code true}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ANDed with this predicate
-     * @return a new predicate which returns {@code true} if either predicate
-     * returns {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ORed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * OR of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default DoublePredicate or(DoublePredicate p) {
-        Objects.requireNonNull(p);
-        return (value) -> test(value) || p.test(value);
+    default DoublePredicate or(DoublePredicate other) {
+        Objects.requireNonNull(other);
+        return (value) -> test(value) || other.test(value);
     }
 }
--- a/jdk/src/share/classes/java/util/function/DoubleSupplier.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleSupplier.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,8 +25,14 @@
 package java.util.function;
 
 /**
- * A supplier of {@code double} values. This is the {@code double}-providing
- * primitive specialization of {@link Supplier}.
+ * Represents a supplier of {@code double}-valued results.  This is the
+ * {@code double}-producing primitive specialization of {@link Supplier}.
+ *
+ * <p>There is no requirement that a distinct result be returned each
+ * time the supplier is invoked.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #getAsDouble()}.
  *
  * @see Supplier
  * @since 1.8
@@ -35,9 +41,9 @@
 public interface DoubleSupplier {
 
     /**
-     * Returns a {@code double} value.
+     * Gets a result.
      *
-     * @return a {@code double} value
+     * @return a result
      */
     double getAsDouble();
 }
--- a/jdk/src/share/classes/java/util/function/DoubleToIntFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleToIntFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,22 +25,24 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code double}-to-{@code int} specialization for {@link Function}.
+ * Represents a function that accepts a double-valued argument and produces an
+ * int-valued result.  This is the {@code double}-to-{@code int} primitive
+ * specialization for {@link Function}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsInt(double)}.
  *
  * @see Function
- * @see IntToDoubleFunction
- * @see LongToIntFunction
  * @since 1.8
  */
 @FunctionalInterface
 public interface DoubleToIntFunction {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param value the input value
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
     int applyAsInt(double value);
 }
--- a/jdk/src/share/classes/java/util/function/DoubleToLongFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleToLongFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,22 +25,24 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code double}-to-{@code long} specialization for {@link Function}.
+ * Represents a function that accepts a double-valued argument and produces a
+ * long-valued result.  This is the {@code double}-to-{@code long} primitive
+ * specialization for {@link Function}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsLong(double)}.
  *
  * @see Function
- * @see LongToDoubleFunction
- * @see IntToLongFunction
  * @since 1.8
  */
 @FunctionalInterface
 public interface DoubleToLongFunction {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param value the input value
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
     long applyAsLong(double value);
 }
--- a/jdk/src/share/classes/java/util/function/DoubleUnaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/DoubleUnaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,9 +27,12 @@
 import java.util.Objects;
 
 /**
- * An operation on a {@code double} operand yielding a {@code double}
- * result. This is the primitive type specialization of {@link UnaryOperator}
- * for {@code double}.
+ * Represents an operation on a single {@code double}-valued operand that produces
+ * a {@code double}-valued result.  This is the primitive type specialization of
+ * {@link UnaryOperator} for {@code double}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsDouble(double)}.
  *
  * @see UnaryOperator
  * @since 1.8
@@ -38,24 +41,25 @@
 public interface DoubleUnaryOperator {
 
     /**
-     * Returns the {@code double} result of the operation upon the
-     * {@code double} operand.
+     * Applies this operator to the given operand.
      *
-     * @param operand the operand value
-     * @return the operation result value
+     * @param operand the operand
+     * @return the operator result
      */
     double applyAsDouble(double operand);
 
     /**
-     * Compose a new function which applies the provided function followed by
-     * this function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed operator that first applies the {@code before}
+     * operator to its input, and then applies this operator to the result.
+     * If evaluation of either operator throws an exception, it is relayed to
+     * the caller of the composed operator.
      *
-     * @param before An additional function to be applied before this function
-     * is applied
-     * @return A function which performs the provided function followed by this
-     * function
+     * @param before the operator to apply before this operator is applied
+     * @return a composed operator that first applies the {@code before}
+     * operator and then applies this operator
      * @throws NullPointerException if before is null
+     *
+     * @see #andThen(DoubleUnaryOperator)
      */
     default DoubleUnaryOperator compose(DoubleUnaryOperator before) {
         Objects.requireNonNull(before);
@@ -63,15 +67,17 @@
     }
 
     /**
-     * Compose a new function which applies this function followed by the
-     * provided function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed operator that first applies this operator to
+     * its input, and then applies the {@code after} operator to the result.
+     * If evaluation of either operator throws an exception, it is relayed to
+     * the caller of the composed operator.
      *
-     * @param after An additional function to be applied after this function is
-     * applied
-     * @return A function which performs this function followed by the provided
-     * function followed
+     * @param after the operator to apply after this operator is applied
+     * @return a composed operator that first applies this operator and then
+     * applies the {@code after} operator
      * @throws NullPointerException if after is null
+     *
+     * @see #compose(DoubleUnaryOperator)
      */
     default DoubleUnaryOperator andThen(DoubleUnaryOperator after) {
         Objects.requireNonNull(after);
@@ -79,9 +85,9 @@
     }
 
     /**
-     * Returns a unary operator that provides its input value as the result.
+     * Returns a unary operator that always returns its input argument.
      *
-     * @return a unary operator that provides its input value as the result
+     * @return a unary operator that always returns its input argument
      */
     static DoubleUnaryOperator identity() {
         return t -> t;
--- a/jdk/src/share/classes/java/util/function/Function.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/Function.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,12 +27,13 @@
 import java.util.Objects;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.  A
- * function may variously provide a mapping between types, object instances or
- * keys and values or any other form of transformation upon the input.
+ * Represents a function that accepts one argument and produces a result.
  *
- * @param <T> the type of the input to the {@code apply} operation
- * @param <R> the type of the result of the {@code apply} operation
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(Object)}.
+ *
+ * @param <T> the type of the input to the function
+ * @param <R> the type of the result of the function
  *
  * @since 1.8
  */
@@ -40,25 +41,27 @@
 public interface Function<T, R> {
 
     /**
-     * Compute the result of applying the function to the input argument
+     * Applies this function to the given argument.
      *
-     * @param t the input object
+     * @param t the function argument
      * @return the function result
      */
     R apply(T t);
 
     /**
-     * Returns a new function which applies the provided function followed by
-     * this function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed function that first applies the {@code before}
+     * function to its input, and then applies this function to the result.
+     * If evaluation of either function throws an exception, it is relayed to
+     * the caller of the composed function.
      *
-     * @param <V> type of input objects to the combined function. May be the
-     * same type as {@code <T>} or {@code <R>}
-     * @param before an additional function to be applied before this function
-     * is applied
-     * @return a function which performs the provided function followed by this
-     * function
+     * @param <V> the type of input to the {@code before} function, and to the
+     *           composed function
+     * @param before the function to apply before this function is applied
+     * @return a composed function that first applies the {@code before}
+     * function and then applies this function
      * @throws NullPointerException if before is null
+     *
+     * @see #andThen(Function)
      */
     default <V> Function<V, R> compose(Function<? super V, ? extends T> before) {
         Objects.requireNonNull(before);
@@ -66,17 +69,19 @@
     }
 
     /**
-     * Returns a new function which applies this function followed by the
-     * provided function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed function that first applies this function to
+     * its input, and then applies the {@code after} function to the result.
+     * If evaluation of either function throws an exception, it is relayed to
+     * the caller of the composed function.
      *
-     * @param <V> type of output objects to the combined function. May be the
-     * same type as {@code <T>} or {@code <R>}
-     * @param after an additional function to be applied after this function is
-     * applied
-     * @return a function which performs this function followed by the provided
-     * function
+     * @param <V> the type of output of the {@code after} function, and of the
+     *           composed function
+     * @param after the function to apply after this function is applied
+     * @return a composed function that first applies this function and then
+     * applies the {@code after} function
      * @throws NullPointerException if after is null
+     *
+     * @see #compose(Function)
      */
     default <V> Function<T, V> andThen(Function<? super R, ? extends V> after) {
         Objects.requireNonNull(after);
@@ -84,10 +89,10 @@
     }
 
     /**
-     * Returns a {@code Function} whose {@code apply} method returns its input.
+     * Returns a function that always returns its input argument.
      *
      * @param <T> the type of the input and output objects to the function
-     * @return a {@code Function} whose {@code apply} method returns its input
+     * @return a function that always returns its input argument
      */
     static <T> Function<T, T> identity() {
         return t -> t;
--- a/jdk/src/share/classes/java/util/function/IntBinaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntBinaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,24 +25,26 @@
 package java.util.function;
 
 /**
- * An operation on two {@code int} operands yielding an {@code int} result.
- * This is the primitive type specialization of {@link BinaryOperator} for
- * {@code int}.
+ * Represents an operation upon two {@code int}-valued operands and producing an
+ * {@code int}-valued result.   This is the primitive type specialization of
+ * {@link BinaryOperator} for {@code int}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsInt(int, int)}.
  *
  * @see BinaryOperator
+ * @see IntUnaryOperator
  * @since 1.8
  */
 @FunctionalInterface
 public interface IntBinaryOperator {
 
     /**
-     * Returns the {@code int} result of the operation upon the {@code int}
-     * operands. The parameters are named {@code left} and {@code right} for
-     * operations where the order of parameters matters.
+     * Applies this operator to the given operands.
      *
-     * @param left the left operand value
-     * @param right  the right operand value
-     * @return the result of the operation
+     * @param left the first operand
+     * @param right the second operand
+     * @return the operator result
      */
     int applyAsInt(int left, int right);
 }
--- a/jdk/src/share/classes/java/util/function/IntConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,10 +27,13 @@
 import java.util.Objects;
 
 /**
- * An operation which accepts a single integer argument and returns no result.
- * This is the primitive type specialization of {@link Consumer} for {@code int}.
- * Unlike most other functional interfaces, {@code IntConsumer} is expected to
- * operate via side-effects.
+ * Represents an operation that accepts a single {@code int}-valued argument and
+ * returns no result.  This is the primitive type specialization of
+ * {@link Consumer} for {@code int}.  Unlike most other functional interfaces,
+ * {@code IntConsumer} is expected to operate via side-effects.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(int)}.
  *
  * @see Consumer
  * @since 1.8
@@ -39,30 +42,26 @@
 public interface IntConsumer {
 
     /**
-     * Accept an input value.
+     * Performs this operation on the given argument.
      *
-     * @param value the input value
+     * @param value the input argument
      */
     void accept(int value);
 
     /**
-     * Returns an {@code IntConsumer} which performs, in sequence, the operation
-     * represented by this object followed by the operation represented by
-     * another {@code IntConsumer}.
-     *
-     * <p>Any exceptions thrown by either {@code accept} method are relayed
-     * to the caller; if performing this operation throws an exception, the
-     * other operation will not be performed.
+     * Returns a composed {@code IntConsumer} that performs, in sequence, this
+     * operation followed by the {@code after} operation. If performing either
+     * operation throws an exception, it is relayed to the caller of the
+     * composed operation.  If performing this operation throws an exception,
+     * the {@code after} operation will not be performed.
      *
-     * @param other an IntConsumer which will be chained after this
-     * IntConsumer
-     * @return an IntConsumer which performs in sequence the {@code accept} method
-     * of this IntConsumer and the {@code accept} method of the specified IntConsumer
-     * operation
-     * @throws NullPointerException if other is null
+     * @param after the operation to perform after this operation
+     * @return a composed {@code IntConsumer} that performs in sequence this
+     * operation followed by the {@code after} operation
+     * @throws NullPointerException if {@code after} is null
      */
-    default IntConsumer chain(IntConsumer other) {
-        Objects.requireNonNull(other);
-        return (int t) -> { accept(t); other.accept(t); };
+    default IntConsumer andThen(IntConsumer after) {
+        Objects.requireNonNull(after);
+        return (int t) -> { accept(t); after.accept(t); };
     }
 }
--- a/jdk/src/share/classes/java/util/function/IntFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,11 +25,14 @@
 package java.util.function;
 
 /**
- * Apply a function to the integer-valued input argument, yielding an
- * appropriate result. This is the {@code int}-consuming primitive
- * specialization for {@link Function}.
+ * Represents a function that accepts an int-valued argument and produces a
+ * result.  This is the {@code int}-consuming primitive specialization for
+ * {@link Function}.
  *
- * @param <R> the type of output objects from the function
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(int)}.
+ *
+ * @param <R> the type of the result of the function
  *
  * @see Function
  * @since 1.8
@@ -38,9 +41,9 @@
 public interface IntFunction<R> {
 
     /**
-     * Compute the result of applying the function to the input argument
+     * Applies this function to the given argument.
      *
-     * @param value the input value
+     * @param value the function argument
      * @return the function result
      */
     R apply(int value);
--- a/jdk/src/share/classes/java/util/function/IntPredicate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntPredicate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,8 +27,12 @@
 import java.util.Objects;
 
 /**
- * Determines if the {@code int} input value matches some criteria. This is the
- * {@code int}-consuming primitive type specialization of {@link Predicate}.
+ * Represents a predicate (boolean-valued function) of one {@code int}-valued
+ * argument. This is the {@code int}-consuming primitive type specialization of
+ * {@link Predicate}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #test(int)}.
  *
  * @see Predicate
  * @since 1.8
@@ -37,38 +41,40 @@
 public interface IntPredicate {
 
     /**
-     * Returns {@code true} if the input value matches some criteria.
+     * Evaluates this predicate on the given argument.
      *
-     * @param value the value to be tested
-     * @return {@code true} if the input value matches some criteria, otherwise
-     * {@code false}
+     * @param value the input argument
+     * @return {@code true} if the input argument matches the predicate,
+     * otherwise {@code false}
      */
     boolean test(int value);
 
     /**
-     * Returns a predicate which evaluates to {@code true} only if this
-     * predicate and the provided predicate both evaluate to {@code true}. If
-     * this predicate returns {@code false} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * AND of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code false}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ANDed with this predicate
-     * @return a new predicate which returns {@code true} only if both
-     * predicates return {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ANDed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * AND of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default IntPredicate and(IntPredicate p) {
-        Objects.requireNonNull(p);
-        return (value) -> test(value) && p.test(value);
+    default IntPredicate and(IntPredicate other) {
+        Objects.requireNonNull(other);
+        return (value) -> test(value) && other.test(value);
     }
 
     /**
-     * Returns a predicate which negates the result of this predicate.
+     * Returns a predicate that represents the logical negation of this
+     * predicate.
      *
-     * @return a new predicate who's result is always the opposite of this
+     * @return a predicate that represents the logical negation of this
      * predicate
      */
     default IntPredicate negate() {
@@ -76,22 +82,23 @@
     }
 
     /**
-     * Returns a predicate which evaluates to {@code true} if either this
-     * predicate or the provided predicate evaluates to {@code true}. If this
-     * predicate returns {@code true} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * OR of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code true}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ORed with this predicate
-     * @return a new predicate which returns {@code true} if either predicate
-     * returns {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ORed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * OR of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default IntPredicate or(IntPredicate p) {
-        Objects.requireNonNull(p);
-        return (value) -> test(value) || p.test(value);
+    default IntPredicate or(IntPredicate other) {
+        Objects.requireNonNull(other);
+        return (value) -> test(value) || other.test(value);
     }
 }
--- a/jdk/src/share/classes/java/util/function/IntSupplier.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntSupplier.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,8 +25,14 @@
 package java.util.function;
 
 /**
- * A supplier of {@code int} values. This is the {@code int}-providing
- * primitive specialization of {@link Supplier}.
+ * Represents a supplier of {@code int}-valued results.  This is the
+ * {@code int}-producing primitive specialization of {@link Supplier}.
+ *
+ * <p>There is no requirement that a distinct result be returned each
+ * time the supplier is invoked.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #getAsInt()}.
  *
  * @see Supplier
  * @since 1.8
@@ -35,9 +41,9 @@
 public interface IntSupplier {
 
     /**
-     * Returns an {@code int} value.
+     * Gets a result.
      *
-     * @return an {@code int} value
+     * @return a result
      */
     int getAsInt();
 }
--- a/jdk/src/share/classes/java/util/function/IntToDoubleFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntToDoubleFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,22 +25,24 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code int}-to-{@code double} specialization for {@link Function}.
+ * Represents a function that accepts an int-valued argument and produces a
+ * double-valued result.  This is the {@code int}-to-{@code double} primitive
+ * specialization for {@link Function}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsDouble(int)}.
  *
  * @see Function
- * @see DoubleToIntFunction
- * @see LongToDoubleFunction
  * @since 1.8
  */
 @FunctionalInterface
 public interface IntToDoubleFunction {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param value the input value
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
     double applyAsDouble(int value);
 }
--- a/jdk/src/share/classes/java/util/function/IntToLongFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntToLongFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,22 +25,24 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code int}-to-{@code long} specialization for {@link Function}.
+ * Represents a function that accepts an int-valued argument and produces a
+ * long-valued result.  This is the {@code int}-to-{@code long} primitive
+ * specialization for {@link Function}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsLong(int)}.
  *
  * @see Function
- * @see LongToIntFunction
- * @see DoubleToLongFunction
  * @since 1.8
  */
 @FunctionalInterface
 public interface IntToLongFunction {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param value the input value
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
     long applyAsLong(int value);
 }
--- a/jdk/src/share/classes/java/util/function/IntUnaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/IntUnaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,9 +27,12 @@
 import java.util.Objects;
 
 /**
- * An operation on a single {@code int} operand yielding an {@code int} result.
- * This is the primitive type specialization of {@link UnaryOperator} for
- * {@code int}.
+ * Represents an operation on a single {@code int}-valued operand that produces
+ * an {@code int}-valued result.  This is the primitive type specialization of
+ * {@link UnaryOperator} for {@code int}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsInt(int)}.
  *
  * @see UnaryOperator
  * @since 1.8
@@ -38,24 +41,25 @@
 public interface IntUnaryOperator {
 
     /**
-     * Returns the {@code int} value result of the operation upon the
-     * {@code int} operand.
+     * Applies this operator to the given operand.
      *
-     * @param operand the operand value
-     * @return the operation result value
+     * @param operand the operand
+     * @return the operator result
      */
     int applyAsInt(int operand);
 
     /**
-     * Compose a new function which applies the provided function followed by
-     * this function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed operator that first applies the {@code before}
+     * operator to its input, and then applies this operator to the result.
+     * If evaluation of either operator throws an exception, it is relayed to
+     * the caller of the composed operator.
      *
-     * @param before an additional function to be applied before this function
-     * is applied
-     * @return a function which performs the provided function followed by this
-     * function
+     * @param before the operator to apply before this operator is applied
+     * @return a composed operator that first applies the {@code before}
+     * operator and then applies this operator
      * @throws NullPointerException if before is null
+     *
+     * @see #andThen(IntUnaryOperator)
      */
     default IntUnaryOperator compose(IntUnaryOperator before) {
         Objects.requireNonNull(before);
@@ -63,15 +67,17 @@
     }
 
     /**
-     * Compose a new function which applies this function followed by the
-     * provided function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed operator that first applies this operator to
+     * its input, and then applies the {@code after} operator to the result.
+     * If evaluation of either operator throws an exception, it is relayed to
+     * the caller of the composed operator.
      *
-     * @param after an additional function to be applied after this function is
-     * applied
-     * @return a function which performs this function followed by the provided
-     * function followed
+     * @param after the operator to apply after this operator is applied
+     * @return a composed operator that first applies this operator and then
+     * applies the {@code after} operator
      * @throws NullPointerException if after is null
+     *
+     * @see #compose(IntUnaryOperator)
      */
     default IntUnaryOperator andThen(IntUnaryOperator after) {
         Objects.requireNonNull(after);
@@ -79,9 +85,9 @@
     }
 
     /**
-     * Returns a unary operator that provides its input value as the result.
+     * Returns a unary operator that always returns its input argument.
      *
-     * @return a unary operator that provides its input value as the result
+     * @return a unary operator that always returns its input argument
      */
     static IntUnaryOperator identity() {
         return t -> t;
--- a/jdk/src/share/classes/java/util/function/LongBinaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongBinaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,24 +25,26 @@
 package java.util.function;
 
 /**
- * An operation on two {@code long} operands yielding a {@code long} result.
- * This is the primitive type specialization of {@link BinaryOperator} for
- * {@code long}.
+ * Represents an operation upon two {@code long}-valued operands and producing a
+ * {@code long}-valued result.   This is the primitive type specialization of
+ * {@link BinaryOperator} for {@code long}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsLong(long, long)}.
  *
  * @see BinaryOperator
+ * @see LongUnaryOperator
  * @since 1.8
  */
 @FunctionalInterface
 public interface LongBinaryOperator {
 
     /**
-     * Returns the {@code long} result of the operation upon the {@code long}
-     * operands. The parameters are named {@code left} and {@code right} for
-     * operations where the order of parameters matters.
+     * Applies this operator to the given operands.
      *
-     * @param left the left operand value
-     * @param right  the right operand value
-     * @return the result of the operation
+     * @param left the first operand
+     * @param right the second operand
+     * @return the operator result
      */
     long applyAsLong(long left, long right);
 }
--- a/jdk/src/share/classes/java/util/function/LongConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,10 +27,13 @@
 import java.util.Objects;
 
 /**
- * An operation which accepts a single long argument and returns no result.
- * This is the {@code long}-consuming primitive type specialization of
- * {@link Consumer}. Unlike most other functional interfaces, {@code LongConsumer}
- * is expected to operate via side-effects.
+ * Represents an operation that accepts a single {@code long}-valued argument and
+ * returns no result.  This is the primitive type specialization of
+ * {@link Consumer} for {@code long}.  Unlike most other functional interfaces,
+ * {@code LongConsumer} is expected to operate via side-effects.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(long)}.
  *
  * @see Consumer
  * @since 1.8
@@ -39,30 +42,26 @@
 public interface LongConsumer {
 
     /**
-     * Accept an input value.
+     * Performs this operation on the given argument.
      *
-     * @param value the input value
+     * @param value the input argument
      */
     void accept(long value);
 
     /**
-     * Returns a {@code LongConsumer} which performs, in sequence, the operation
-     * represented by this object followed by the operation represented by
-     * another {@code LongConsumer}.
-     *
-     * <p>Any exceptions thrown by either {@code accept} method are relayed
-     * to the caller; if performing this operation throws an exception, the
-     * other operation will not be performed.
+     * Returns a composed {@code LongConsumer} that performs, in sequence, this
+     * operation followed by the {@code after} operation. If performing either
+     * operation throws an exception, it is relayed to the caller of the
+     * composed operation.  If performing this operation throws an exception,
+     * the {@code after} operation will not be performed.
      *
-     * @param other a LongConsumer which will be chained after this
-     * LongConsumer
-     * @return a LongConsumer which performs in sequence the {@code accept} method
-     * of this LongConsumer and the {@code accept} method of the specified LongConsumer
-     * operation
-     * @throws NullPointerException if other is null
+     * @param after the operation to perform after this operation
+     * @return a composed {@code LongConsumer} that performs in sequence this
+     * operation followed by the {@code after} operation
+     * @throws NullPointerException if {@code after} is null
      */
-    default LongConsumer chain(LongConsumer other) {
-        Objects.requireNonNull(other);
-        return (long t) -> { accept(t); other.accept(t); };
+    default LongConsumer andThen(LongConsumer after) {
+        Objects.requireNonNull(after);
+        return (long t) -> { accept(t); after.accept(t); };
     }
 }
--- a/jdk/src/share/classes/java/util/function/LongFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,11 +25,14 @@
 package java.util.function;
 
 /**
- * Apply a function to the long-valued input argument, yielding an appropriate
- * result. This is the {@code long}-consuming primitive specialization for
+ * Represents a function that accepts a long-valued argument and produces a
+ * result.  This is the {@code long}-consuming primitive specialization for
  * {@link Function}.
  *
- * @param <R> the type of output objects from the function
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(long)}.
+ *
+ * @param <R> the type of the result of the function
  *
  * @see Function
  * @since 1.8
@@ -38,9 +41,9 @@
 public interface LongFunction<R> {
 
     /**
-     * Compute the result of applying the function to the input argument
+     * Applies this function to the given argument.
      *
-     * @param value the input value
+     * @param value the function argument
      * @return the function result
      */
     R apply(long value);
--- a/jdk/src/share/classes/java/util/function/LongPredicate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongPredicate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,8 +27,12 @@
 import java.util.Objects;
 
 /**
- * Determines if the {@code long} input value matches some criteria. This is the
- * {@code long}-consuming primitive type specialization of {@link Predicate}.
+ * Represents a predicate (boolean-valued function) of one {@code long}-valued
+ * argument. This is the {@code long}-consuming primitive type specialization of
+ * {@link Predicate}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #test(long)}.
  *
  * @see Predicate
  * @since 1.8
@@ -37,37 +41,40 @@
 public interface LongPredicate {
 
     /**
-     * Returns {@code true} if the input value matches some criteria.
+     * Evaluates this predicate on the given argument.
      *
-     * @param value the value to be tested
-     * @return {@code true} if the input value matches some criteria, otherwise
-     * {@code false}
+     * @param value the input argument
+     * @return {@code true} if the input argument matches the predicate,
+     * otherwise {@code false}
      */
     boolean test(long value);
 
     /**
-     * Returns a predicate which evaluates to {@code true} only if this
-     * predicate and the provided predicate both evaluate to {@code true}. If
-     * this predicate returns {@code false} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * AND of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code false}, then the {@code other}
+     * predicate is not evaluated.
+     *
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
-     *
-     * @param p a predicate which will be logically-ANDed with this predicate
-     * @return a new predicate which returns {@code true} only if both
-     * predicates return {@code true}
+     * @param other a predicate that will be logically-ANDed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * AND of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default LongPredicate and(LongPredicate p) {
-        Objects.requireNonNull(p);
-        return (value) -> test(value) && p.test(value);
+    default LongPredicate and(LongPredicate other) {
+        Objects.requireNonNull(other);
+        return (value) -> test(value) && other.test(value);
     }
 
     /**
-     * Returns a predicate which negates the result of this predicate.
+     * Returns a predicate that represents the logical negation of this
+     * predicate.
      *
-     * @return a new predicate who's result is always the opposite of this
+     * @return a predicate that represents the logical negation of this
      * predicate
      */
     default LongPredicate negate() {
@@ -75,22 +82,23 @@
     }
 
     /**
-     * Returns a predicate which evaluates to {@code true} if either this
-     * predicate or the provided predicate evaluates to {@code true}. If this
-     * predicate returns {@code true} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * OR of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code true}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ORed with this predicate
-     * @return a new predicate which returns {@code true} if either predicate
-     * returns {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ORed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * OR of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default LongPredicate or(LongPredicate p) {
-        Objects.requireNonNull(p);
-        return (value) -> test(value) || p.test(value);
+    default LongPredicate or(LongPredicate other) {
+        Objects.requireNonNull(other);
+        return (value) -> test(value) || other.test(value);
     }
 }
--- a/jdk/src/share/classes/java/util/function/LongSupplier.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongSupplier.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,8 +25,14 @@
 package java.util.function;
 
 /**
- * A supplier of {@code long} values. This is the {@code long}-providing
- * primitive specialization of {@link Supplier}.
+ * Represents a supplier of {@code long}-valued results.  This is the
+ * {@code long}-producing primitive specialization of {@link Supplier}.
+ *
+ * <p>There is no requirement that a distinct result be returned each
+ * time the supplier is invoked.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #getAsLong()}.
  *
  * @see Supplier
  * @since 1.8
@@ -35,9 +41,9 @@
 public interface LongSupplier {
 
     /**
-     * Returns a {@code long} value.
+     * Gets a result.
      *
-     * @return a {@code long} value
+     * @return a result
      */
     long getAsLong();
 }
--- a/jdk/src/share/classes/java/util/function/LongToDoubleFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongToDoubleFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,22 +25,24 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code long}-to-{@code double} specialization for {@link Function}.
+ * Represents a function that accepts a long-valued argument and produces a
+ * double-valued result.  This is the {@code long}-to-{@code double} primitive
+ * specialization for {@link Function}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsDouble(long)}.
  *
  * @see Function
- * @see DoubleToLongFunction
- * @see IntToDoubleFunction
  * @since 1.8
  */
 @FunctionalInterface
 public interface LongToDoubleFunction {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param value the input value
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
     double applyAsDouble(long value);
 }
--- a/jdk/src/share/classes/java/util/function/LongToIntFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongToIntFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,22 +25,24 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code long}-to-{@code int} specialization for {@link Function}.
+ * Represents a function that accepts a long-valued argument and produces an
+ * int-valued result.  This is the {@code long}-to-{@code int} primitive
+ * specialization for {@link Function}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsInt(long)}.
  *
  * @see Function
- * @see IntToLongFunction
- * @see DoubleToIntFunction
  * @since 1.8
  */
 @FunctionalInterface
 public interface LongToIntFunction {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param value the input value
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
     int applyAsInt(long value);
 }
--- a/jdk/src/share/classes/java/util/function/LongUnaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/LongUnaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,9 +27,12 @@
 import java.util.Objects;
 
 /**
- * An operation on a single {@code long} operand yielding a {@code long} result.
- * This is the primitive type specialization of {@link UnaryOperator} for
- * {@code long}.
+ * Represents an operation on a single {@code long}-valued operand that produces
+ * a {@code long}-valued result.  This is the primitive type specialization of
+ * {@link UnaryOperator} for {@code long}.
+ *
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsLong(long)}.
  *
  * @see UnaryOperator
  * @since 1.8
@@ -38,24 +41,25 @@
 public interface LongUnaryOperator {
 
     /**
-     * Returns the {@code long} result of the operation upon the {@code long}
-     * operand.
+     * Applies this operator to the given operand.
      *
-     * @param operand the operand value
-     * @return the operation result value
+     * @param operand the operand
+     * @return the operator result
      */
     long applyAsLong(long operand);
 
     /**
-     * Compose a new function which applies the provided function followed by
-     * this function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed operator that first applies the {@code before}
+     * operator to its input, and then applies this operator to the result.
+     * If evaluation of either operator throws an exception, it is relayed to
+     * the caller of the composed operator.
      *
-     * @param before An additional function to be applied before this function
-     * is applied
-     * @return A function which performs the provided function followed by this
-     * function
+     * @param before the operator to apply before this operator is applied
+     * @return a composed operator that first applies the {@code before}
+     * operator and then applies this operator
      * @throws NullPointerException if before is null
+     *
+     * @see #andThen(LongUnaryOperator)
      */
     default LongUnaryOperator compose(LongUnaryOperator before) {
         Objects.requireNonNull(before);
@@ -63,15 +67,17 @@
     }
 
     /**
-     * Compose a new function which applies this function followed by the
-     * provided function.  If either function throws an exception, it is relayed
-     * to the caller.
+     * Returns a composed operator that first applies this operator to
+     * its input, and then applies the {@code after} operator to the result.
+     * If evaluation of either operator throws an exception, it is relayed to
+     * the caller of the composed operator.
      *
-     * @param after An additional function to be applied after this function is
-     * applied
-     * @return A function which performs this function followed by the provided
-     * function followed
+     * @param after the operator to apply after this operator is applied
+     * @return a composed operator that first applies this operator and then
+     * applies the {@code after} operator
      * @throws NullPointerException if after is null
+     *
+     * @see #compose(LongUnaryOperator)
      */
     default LongUnaryOperator andThen(LongUnaryOperator after) {
         Objects.requireNonNull(after);
@@ -79,9 +85,9 @@
     }
 
     /**
-     * Returns a unary operator that provides its input value as the result.
+     * Returns a unary operator that always returns its input argument.
      *
-     * @return a unary operator that provides its input value as the result
+     * @return a unary operator that always returns its input argument
      */
     static LongUnaryOperator identity() {
         return t -> t;
--- a/jdk/src/share/classes/java/util/function/ObjDoubleConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ObjDoubleConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,12 +25,16 @@
 package java.util.function;
 
 /**
- * An operation which accepts an object reference and a double, and returns no
- * result. This is the {@code (reference, double)} specialization of
- * {@link BiConsumer}. Unlike most other functional interfaces,
- * {@code ObjDoubleConsumer} is expected to operate via side-effects.
+ * Represents an operation that accepts an object-valued and a
+ * {@code double}-valued argument, and returns no result.  This is the
+ * {@code (reference, double)} specialization of {@link BiConsumer}.
+ * Unlike most other functional interfaces, {@code ObjDoubleConsumer} is
+ * expected to operate via side-effects.
  *
- * @param <T> Type of reference argument to {@code accept()}.
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(Object, double)}.
+ *
+ * @param <T> the type of the object argument to the operation
  *
  * @see BiConsumer
  * @since 1.8
@@ -39,10 +43,10 @@
 public interface ObjDoubleConsumer<T> {
 
     /**
-     * Accept a set of input values.
+     * Performs this operation on the given arguments.
      *
-     * @param t an input object
-     * @param value an input value
+     * @param t the first input argument
+     * @param value the second input argument
      */
     void accept(T t, double value);
 }
--- a/jdk/src/share/classes/java/util/function/ObjIntConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ObjIntConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,12 +25,16 @@
 package java.util.function;
 
 /**
- * An operation which accepts an object reference and an int, and returns no
- * result. This is the {@code (reference, int)} specialization of
- * {@link BiConsumer}. Unlike most other functional interfaces,
- * {@code ObjIntConsumer} is expected to operate via side-effects.
+ * Represents an operation that accepts an object-valued and a
+ * {@code int}-valued argument, and returns no result.  This is the
+ * {@code (reference, int)} specialization of {@link BiConsumer}.
+ * Unlike most other functional interfaces, {@code ObjIntConsumer} is
+ * expected to operate via side-effects.
  *
- * @param <T> Type of reference argument to {@code accept()}
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(Object, int)}.
+ *
+ * @param <T> the type of the object argument to the operation
  *
  * @see BiConsumer
  * @since 1.8
@@ -39,10 +43,10 @@
 public interface ObjIntConsumer<T> {
 
     /**
-     * Accept a set of input values.
+     * Performs this operation on the given arguments.
      *
-     * @param t an input object
-     * @param value an input value
+     * @param t the first input argument
+     * @param value the second input argument
      */
     void accept(T t, int value);
 }
--- a/jdk/src/share/classes/java/util/function/ObjLongConsumer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ObjLongConsumer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,12 +25,16 @@
 package java.util.function;
 
 /**
- * An operation which accepts an object reference and a long, and returns no
- * result. This is the {@code (reference, long)} specialization of
- * {@link BiConsumer}. Unlike most other functional interfaces,
- * {@code ObjLongConsumer} is expected to operate via side-effects.
+ * Represents an operation that accepts an object-valued and a
+ * {@code long}-valued argument, and returns no result.  This is the
+ * {@code (reference, long)} specialization of {@link BiConsumer}.
+ * Unlike most other functional interfaces, {@code ObjLongConsumer} is
+ * expected to operate via side-effects.
  *
- * @param <T> Type of reference argument to {@code accept()}
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #accept(Object, long)}.
+ *
+ * @param <T> the type of the object argument to the operation
  *
  * @see BiConsumer
  * @since 1.8
@@ -39,10 +43,10 @@
 public interface ObjLongConsumer<T> {
 
     /**
-     * Accept a set of input values.
+     * Performs this operation on the given arguments.
      *
-     * @param t an input object
-     * @param value an input value
+     * @param t the first input argument
+     * @param value the second input argument
      */
     void accept(T t, long value);
 }
--- a/jdk/src/share/classes/java/util/function/Predicate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/Predicate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -27,9 +27,12 @@
 import java.util.Objects;
 
 /**
- * Determines if the input object matches some criteria.
+ * Represents a predicate (boolean-valued function) of one argument.
  *
- * @param <T> the type of argument to {@code test}
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #test(Object)}.
+ *
+ * @param <T> the type of the input to the predicate
  *
  * @since 1.8
  */
@@ -37,76 +40,80 @@
 public interface Predicate<T> {
 
     /**
-     * Returns {@code true} if the input object matches some criteria.
+     * Evaluates this predicate on the given argument.
      *
-     * @param t the input object
-     * @return {@code true} if the input object matches some criteria, otherwise
-     * {@code false}
+     * @param t the input argument
+     * @return {@code true} if the input argument matches the predicate,
+     * otherwise {@code false}
      */
     boolean test(T t);
 
     /**
-     * Returns a predicate which evaluates to {@code true} only if this
-     * predicate and the provided predicate both evaluate to {@code true}. If
-     * this predicate returns {@code false} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * AND of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code false}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ANDed with this predicate
-     * @return a new predicate which returns {@code true} only if both
-     * predicates return {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ANDed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * AND of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default Predicate<T> and(Predicate<? super T> p) {
-        Objects.requireNonNull(p);
-        return (t) -> test(t) && p.test(t);
+    default Predicate<T> and(Predicate<? super T> other) {
+        Objects.requireNonNull(other);
+        return (t) -> test(t) && other.test(t);
     }
 
     /**
-     * Returns a predicate which negates the result of this predicate.
+     * Returns a predicate that represents the logical negation of this
+     * predicate.
      *
-     * @return a new predicate who's result is always the opposite of this
-     * predicate.
+     * @return a predicate that represents the logical negation of this
+     * predicate
      */
     default Predicate<T> negate() {
         return (t) -> !test(t);
     }
 
     /**
-     * Returns a predicate which evaluates to {@code true} if either this
-     * predicate or the provided predicate evaluates to {@code true}. If this
-     * predicate returns {@code true} then the remaining predicate is not
-     * evaluated.
+     * Returns a composed predicate that represents a short-circuiting logical
+     * OR of this predicate and another.  When evaluating the composed
+     * predicate, if this predicate is {@code true}, then the {@code other}
+     * predicate is not evaluated.
      *
-     * <p>Any exceptions thrown by either {@code test} method are relayed
-     * to the caller; if performing first operation throws an exception, the
-     * second operation will not be performed.
+     * <p>Any exceptions thrown during evaluation of either predicate are relayed
+     * to the caller; if evaluation of this predicate throws an exception, the
+     * {@code other} predicate will not be evaluated.
      *
-     * @param p a predicate which will be logically-ORed with this predicate
-     * @return a new predicate which returns {@code true} if either predicate
-     * returns {@code true}
-     * @throws NullPointerException if p is null
+     * @param other a predicate that will be logically-ORed with this
+     *              predicate
+     * @return a composed predicate that represents the short-circuiting logical
+     * OR of this predicate and the {@code other} predicate
+     * @throws NullPointerException if other is null
      */
-    default Predicate<T> or(Predicate<? super T> p) {
-        Objects.requireNonNull(p);
-        return (t) -> test(t) || p.test(t);
+    default Predicate<T> or(Predicate<? super T> other) {
+        Objects.requireNonNull(other);
+        return (t) -> test(t) || other.test(t);
     }
 
     /**
-     * Returns a predicate who's result matches
-     * {@code Objects.equals(target, t)}.
+     * Returns a predicate that tests if two arguments are equal according
+     * to {@link Objects#equals(Object, Object)}.
      *
-     * @param <T> the type of values evaluated by the predicate
-     * @param target the target value to be compared for equality
-     * @return a predicate who's result matches
-     * {@code Objects.equals(target, t)}
+     * @param <T> the type of arguments to the predicate
+     * @param targetRef the object reference with which to compare for equality,
+     *               which may be {@code null}
+     * @return a predicate that tests if two arguments are equal according
+     * to {@link Objects#equals(Object, Object)}
      */
-    static <T> Predicate<T> isEqual(Object target) {
-        return (null == target)
+    static <T> Predicate<T> isEqual(Object targetRef) {
+        return (null == targetRef)
                 ? Objects::isNull
-                : object -> target.equals(object);
+                : object -> targetRef.equals(object);
     }
 }
--- a/jdk/src/share/classes/java/util/function/Supplier.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/Supplier.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,10 +25,15 @@
 package java.util.function;
 
 /**
- * A supplier of objects. The result objects are either created during the
- * invocation of {@link #get} or by some prior action.
+ * Represents a supplier of results.
+ *
+ * <p>There is no requirement that a new or distinct result be returned each
+ * time the supplier is invoked.
  *
- * @param <T> The type of objects returned by {@code get}
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #get()}.
+ *
+ * @param <T> the type of results supplied by this supplier
  *
  * @since 1.8
  */
@@ -36,9 +41,9 @@
 public interface Supplier<T> {
 
     /**
-     * Returns an object.
+     * Gets a result.
      *
-     * @return an object
+     * @return a result
      */
     T get();
 }
--- a/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ToDoubleBiFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,13 +25,15 @@
 package java.util.function;
 
 /**
- * Apply a function to the input arguments, yielding an appropriate result.
- * This is the {@code double}-bearing specialization for {@link BiFunction}.
+ * Represents a function that accepts two arguments and produces a double-valued
+ * result.  This is the {@code double}-producing primitive specialization for
+ * {@link BiFunction}.
  *
- * @param <T> the type of the first argument to the {@code applyAsDouble}
- * operation.
- * @param <U> the type of the second argument to the {@code applyAsDouble}
- * operation.
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsDouble(Object, Object)}.
+ *
+ * @param <T> the type of the first argument to the function
+ * @param <U> the type of the second argument to the function
  *
  * @see BiFunction
  * @since 1.8
@@ -40,11 +42,11 @@
 public interface ToDoubleBiFunction<T, U> {
 
     /**
-     * Compute the result of applying the function to the input arguments
+     * Applies this function to the given arguments.
      *
-     * @param t an input object
-     * @param u an input object
-     * @return the function result value
+     * @param t the first function argument
+     * @param u the second function argument
+     * @return the function result
      */
     double applyAsDouble(T t, U u);
 }
--- a/jdk/src/share/classes/java/util/function/ToDoubleFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ToDoubleFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,10 +25,13 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code double}-bearing specialization for {@link Function}.
+ * Represents a function that produces a double-valued result.  This is the
+ * {@code double}-producing primitive specialization for {@link Function}.
  *
- * @param <T> the type of input objects to the function
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsDouble(Object)}.
+ *
+ * @param <T> the type of the input to the function
  *
  * @see Function
  * @since 1.8
@@ -37,10 +40,10 @@
 public interface ToDoubleFunction<T> {
 
     /**
-     * Compute the result of applying the function to the input argument
+     * Applies this function to the given argument.
      *
-     * @param t the input object
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
-    double applyAsDouble(T t);
+    double applyAsDouble(T value);
 }
--- a/jdk/src/share/classes/java/util/function/ToIntBiFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ToIntBiFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,13 +25,15 @@
 package java.util.function;
 
 /**
- * Apply a function to the input arguments, yielding an appropriate result.
- * This is the {@code int}-bearing specialization for {@link BiFunction}.
+ * Represents a function that accepts two arguments and produces an int-valued
+ * result.  This is the {@code int}-producing primitive specialization for
+ * {@link BiFunction}.
  *
- * @param <T> the type of the first argument to the {@code applyAsInt}
- * operation
- * @param <U> the type of the second argument to the {@code applyAsInt}
- * operation
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsInt(Object, Object)}.
+ *
+ * @param <T> the type of the first argument to the function
+ * @param <U> the type of the second argument to the function
  *
  * @see BiFunction
  * @since 1.8
@@ -40,11 +42,11 @@
 public interface ToIntBiFunction<T, U> {
 
     /**
-     * Compute the result of applying the function to the input arguments
+     * Applies this function to the given arguments.
      *
-     * @param t an input object
-     * @param u an input object
-     * @return the function result value
+     * @param t the first function argument
+     * @param u the second function argument
+     * @return the function result
      */
     int applyAsInt(T t, U u);
 }
--- a/jdk/src/share/classes/java/util/function/ToIntFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ToIntFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,10 +25,13 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code int}-bearing specialization for {@link Function}.
+ * Represents a function that produces an int-valued result.  This is the
+ * {@code int}-producing primitive specialization for {@link Function}.
  *
- * @param <T> the type of input objects to the function
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsInt(Object)}.
+ *
+ * @param <T> the type of the input to the function
  *
  * @see Function
  * @since 1.8
@@ -37,10 +40,10 @@
 public interface ToIntFunction<T> {
 
     /**
-     * Compute the result of applying the function to the input arguments
+     * Applies this function to the given argument.
      *
-     * @param t the input object
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
-    int applyAsInt(T t);
+    int applyAsInt(T value);
 }
--- a/jdk/src/share/classes/java/util/function/ToLongBiFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ToLongBiFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,13 +25,15 @@
 package java.util.function;
 
 /**
- * Apply a function to the input arguments, yielding an appropriate result.
- * This is the {@code long}-bearing specialization for {@link BiFunction}.
+ * Represents a function that accepts two arguments and produces a long-valued
+ * result.  This is the {@code long}-producing primitive specialization for
+ * {@link BiFunction}.
  *
- * @param <T> the type of the first argument to the {@code applyAsLong}
- * operation.
- * @param <U> the type of the second argument to the {@code applyAsLong}
- * operation.
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsLong(Object, Object)}.
+ *
+ * @param <T> the type of the first argument to the function
+ * @param <U> the type of the second argument to the function
  *
  * @see BiFunction
  * @since 1.8
@@ -40,11 +42,11 @@
 public interface ToLongBiFunction<T, U> {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given arguments.
      *
-     * @param t an input object
-     * @param u an input object
-     * @return the function result value
+     * @param t the first function argument
+     * @param u the second function argument
+     * @return the function result
      */
     long applyAsLong(T t, U u);
 }
--- a/jdk/src/share/classes/java/util/function/ToLongFunction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/ToLongFunction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,10 +25,13 @@
 package java.util.function;
 
 /**
- * Apply a function to the input argument, yielding an appropriate result.
- * This is the {@code long}-bearing specialization for {@link Function}.
+ * Represents a function that produces a long-valued result.  This is the
+ * {@code long}-producing primitive specialization for {@link Function}.
  *
- * @param <T> the type of input objects to the function
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #applyAsLong(Object)}.
+ *
+ * @param <T> the type of the input to the function
  *
  * @see Function
  * @since 1.8
@@ -37,10 +40,10 @@
 public interface ToLongFunction<T> {
 
     /**
-     * Compute the result of applying the function to the input arguments.
+     * Applies this function to the given argument.
      *
-     * @param t the input object
-     * @return the function result value
+     * @param value the function argument
+     * @return the function result
      */
-    long applyAsLong(T t);
+    long applyAsLong(T value);
 }
--- a/jdk/src/share/classes/java/util/function/UnaryOperator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/UnaryOperator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,11 +25,14 @@
 package java.util.function;
 
 /**
- * An operation upon a single operand yielding a result. The operand and the
- * result are of the same type. This is a specialization of {@code Function} for
+ * Represents an operation on a single operand that produces a result of the
+ * same type as its operand.  This is a specialization of {@code Function} for
  * the case where the operand and result are of the same type.
  *
- * @param <T> the type of operand to {@code apply} and of the result
+ * <p>This is a <a href="package-summary.html">functional interface</a>
+ * whose functional method is {@link #apply(Object)}.
+ *
+ * @param <T> the type of the operand and result of the operator
  *
  * @see Function
  * @since 1.8
@@ -38,10 +41,10 @@
 public interface UnaryOperator<T> extends Function<T, T> {
 
     /**
-     * Returns a unary operator that provides its input value as the result.
+     * Returns a unary operator that always returns its input argument.
      *
-     * @param <T> the type of the input and output objects to the function
-     * @return a unary operator that provides its input value as the result
+     * @param <T> the type of the input and output of the operator
+     * @return a unary operator that always returns its input argument
      */
     static <T> UnaryOperator<T> identity() {
         return t -> t;
--- a/jdk/src/share/classes/java/util/function/package-info.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/function/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,56 +25,82 @@
 
 /**
  * <em>Functional interfaces</em> provide target types for lambda expressions
- * and method references.  Each functional interface has a single abstract method
+ * and method references.  Each functional interface has a single abstract
+ * method, called the <em>functional method</em> for that functional interface,
  * to which the lambda expression's parameter and return types are matched or
- * adapted.  Functional interfaces can provide a target type in multiple contexts,
- * such as assignment context, method invocation, or cast context:
+ * adapted.  Functional interfaces can provide a target type in multiple
+ * contexts, such as assignment context, method invocation, or cast context:
  *
- * <pre>
- *     Predicate&lt;String> p = String::isEmpty;
+ * <pre>{@code
+ *     // Assignment context
+ *     Predicate<String> p = String::isEmpty;
  *
+ *     // Method invocation context
  *     stream.filter(e -> e.getSize() > 10)...
  *
+ *     // Cast context
  *     stream.map((ToIntFunction) e -> e.getSize())...
- * </pre>
+ * }</pre>
  *
- * <p>The interfaces in this package are functional interfaces used by the JDK,
- * and are available to be used by user code as well.  While they do not identify
- * a complete set of function shapes to which lambda expressions might be adapted,
- * they provide enough to cover common requirements.
+ * <p>The interfaces in this package are general purpose functional interfaces
+ * used by the JDK, and are available to be used by user code as well.  While
+ * they do not identify a complete set of function shapes to which lambda
+ * expressions might be adapted, they provide enough to cover common
+ * requirements. Other functional interfaces provided for specific purposes,
+ * such as {@link java.io.FileFilter}, are defined in the packages where they
+ * are used.
  *
- * <p>The interfaces in this package are annotated with @{link FunctionalInterface}.
- * This annotation is not a requirement for the compiler to recognize an interface
- * as a functional interface, but merely an aid to capture design intent and enlist the
- * help of the compiler in identifying accidental violations of design intent.
+ * <p>The interfaces in this package are annotated with
+ * {@link java.lang.FunctionalInterface}. This annotation is not a requirement
+ * for the compiler to recognize an interface as a functional interface, but
+ * merely an aid to capture design intent and enlist the help of the compiler in
+ * identifying accidental violations of design intent.
  *
- * <p>The functional interfaces in this package follow an extensible naming convention,
- * as follows:
+ * <p>Functional interfaces often represent abstract concepts like functions,
+ * actions, or predicates.  In documenting functional interfaces, or referring
+ * to variables typed as functional interfaces, it is common to refer directly
+ * to those abstract concepts, for example using "this function" instead of
+ * "the function represented by this object".
+ *
+ * <p>The functional interfaces in this package follow an extensible naming
+ * convention, as follows:
  *
  * <ul>
- *     <li>There are several basic function shapes, including {@link java.util.function.Function} ({@code T -> R}),
- *     {@link java.util.function.Consumer} ({@code T -> void}),
- *     {@link java.util.function.Predicate} ({@code T -> boolean}),
- *     and {@link java.util.function.Supplier} ({@code () -> T}).
+ *     <li>There are several basic function shapes, including
+ *     {@link java.util.function.Function} (unary function from {@code T} to {@code R}),
+ *     {@link java.util.function.Consumer} (unary function from {@code T} to {@code void}),
+ *     {@link java.util.function.Predicate} (unary function from {@code T} to {@code boolean}),
+ *     and {@link java.util.function.Supplier} (nilary function to {@code R}).
  *     </li>
- *     <li>Function shapes have a natural arity based on how they are most commonly used.
- *     The basic shapes can be modified by an arity prefix to indicate a different arity,
- *     such as {@link java.util.function.BiFunction} ({@code (T, U) -> R}).
+ *
+ *     <li>Function shapes have a natural arity based on how they are most
+ *     commonly used.  The basic shapes can be modified by an arity prefix to
+ *     indicate a different arity, such as
+ *     {@link java.util.function.BiFunction} (binary function from {@code T} and
+ *     {@code U} to {@code R}).
  *     </li>
- *     <li>There are additional derived function shapes which extend the basic function
- *     shapes, including {@link java.util.function.UnaryOperator} (extends {@code Function}) and
- *     {@link java.util.function.BinaryOperator} (extends {@code BiFunction}).
+ *
+ *     <li>There are additional derived function shapes which extend the basic
+ *     function shapes, including {@link java.util.function.UnaryOperator}
+ *     (extends {@code Function}) and {@link java.util.function.BinaryOperator}
+ *     (extends {@code BiFunction}).
  *     </li>
- *     <li>Type parameters of functional interfaces can be specialized to primitives with
- *     additional type prefixes.  To specialize the return type for a type that has both
- *     generic return type and generic arguments, we prefix {@code ToXxx}, as in
- *     {@link java.util.function.ToIntFunction}.  Otherwise, type arguments are specialized left-to-right,
- *     as in {@link java.util.function.DoubleConsumer} or {@link java.util.function.ObjIntConsumer}.
- *     (The type prefix {@code Obj} is used to indicate that we don't want to specialize this parameter,
- *     but want to move on to the next parameter.)  These schemes can be combined as in {@code IntToDoubleFunction}.
+ *
+ *     <li>Type parameters of functional interfaces can be specialized to
+ *     primitives with additional type prefixes.  To specialize the return type
+ *     for a type that has both generic return type and generic arguments, we
+ *     prefix {@code ToXxx}, as in {@link java.util.function.ToIntFunction}.
+ *     Otherwise, type arguments are specialized left-to-right, as in
+ *     {@link java.util.function.DoubleConsumer}
+ *     or {@link java.util.function.ObjIntConsumer}.
+ *     (The type prefix {@code Obj} is used to indicate that we don't want to
+ *     specialize this parameter, but want to move on to the next parameter,
+ *     as in {@link java.util.function.ObjIntConsumer}.)
+ *     These schemes can be combined, as in {@code IntToDoubleFunction}.
  *     </li>
- *     <li>If there are specialization prefixes for all arguments, the arity prefix may be left
- *     out (as in {@link java.util.function.ObjIntConsumer}).
+ *
+ *     <li>If there are specialization prefixes for all arguments, the arity
+ *     prefix may be left out (as in {@link java.util.function.ObjIntConsumer}).
  *     </li>
  * </ul>
  *
--- a/jdk/src/share/classes/java/util/jar/Attributes.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/jar/Attributes.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -527,7 +527,7 @@
          * <code>Name</code> object for <code>Manifest-Version</code>
          * manifest attribute. This attribute indicates the version number
          * of the manifest standard to which a JAR file's manifest conforms.
-         * @see <a href="../../../../technotes/guides/jar/jar.html#JAR Manifest">
+         * @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
          *      Manifest and Signature Specification</a>
          */
         public static final Name MANIFEST_VERSION = new Name("Manifest-Version");
@@ -535,7 +535,7 @@
         /**
          * <code>Name</code> object for <code>Signature-Version</code>
          * manifest attribute used when signing JAR files.
-         * @see <a href="../../../../technotes/guides/jar/jar.html#JAR Manifest">
+         * @see <a href="../../../../technotes/guides/jar/jar.html#JAR_Manifest">
          *      Manifest and Signature Specification</a>
          */
         public static final Name SIGNATURE_VERSION = new Name("Signature-Version");
--- a/jdk/src/share/classes/java/util/jar/JarEntry.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/jar/JarEntry.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -81,6 +81,7 @@
      *
      * @return the <code>Manifest</code> <code>Attributes</code> for this
      * entry, or <code>null</code> if none
+     * @throws IOException  if an I/O error has occurred
      */
     public Attributes getAttributes() throws IOException {
         return attr;
--- a/jdk/src/share/classes/java/util/jar/JarFile.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/jar/JarFile.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -168,6 +168,7 @@
      *
      * @throws IllegalStateException
      *         may be thrown if the jar file has been closed
+     * @throws IOException  if an I/O error has occurred
      */
     public Manifest getManifest() throws IOException {
         return getManifestFromReference();
--- a/jdk/src/share/classes/java/util/stream/StreamSupport.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/stream/StreamSupport.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -96,6 +96,7 @@
      * <a href="package-summary.html#Non-Interference">Non-Interference</a> for
      * more details.
      *
+     * @param <T> the type of stream elements
      * @param supplier a {@code Supplier} of a {@code Spliterator}
      * @param characteristics Spliterator characteristics of the supplied
      *        {@code Spliterator}.  The characteristics must be equal to
--- a/jdk/src/share/classes/java/util/stream/Streams.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/java/util/stream/Streams.java	Tue Aug 06 16:54:56 2013 -0700
@@ -681,11 +681,9 @@
             this.aSpliterator = aSpliterator;
             this.bSpliterator = bSpliterator;
             beforeSplit = true;
-            // The spliterator is unsized before splitting if a and b are
-            // sized and the sum of the estimates overflows
-            unsized = aSpliterator.hasCharacteristics(SIZED)
-                      && aSpliterator.hasCharacteristics(SIZED)
-                      && aSpliterator.estimateSize() + bSpliterator.estimateSize() < 0;
+            // The spliterator is known to be unsized before splitting if the
+            // sum of the estimates overflows.
+            unsized = aSpliterator.estimateSize() + bSpliterator.estimateSize() < 0;
         }
 
         @Override
--- a/jdk/src/share/classes/javax/swing/JFileChooser.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/JFileChooser.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1149,9 +1149,10 @@
         int index = filters.indexOf(f);
         if (index >= 0) {
             if(getFileFilter() == f) {
-                if (isAcceptAllFileFilterUsed()) {
+                FileFilter aaff = getAcceptAllFileFilter();
+                if (isAcceptAllFileFilterUsed() && (aaff != f)) {
                     // choose default filter if it is used
-                    setFileFilter(getAcceptAllFileFilter());
+                    setFileFilter(aaff);
                 }
                 else if (index > 0) {
                     // choose the first filter, because it is not removed
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java	Tue Aug 06 16:54:56 2013 -0700
@@ -344,7 +344,8 @@
             configureRenderer(cellContext);
             while (!done && paintingEnumerator.hasMoreElements()) {
                 path = (TreePath)paintingEnumerator.nextElement();
-                if (path != null) {
+                bounds = getPathBounds(tree, path);
+                if ((path != null) && (bounds != null)) {
                     isLeaf = treeModel.isLeaf(path.getLastPathComponent());
                     if (isLeaf) {
                         isExpanded = hasBeenExpanded = false;
@@ -353,7 +354,6 @@
                         isExpanded = treeState.getExpandedState(path);
                         hasBeenExpanded = tree.hasBeenExpanded(path);
                     }
-                    bounds = getPathBounds(tree, path);
                     rowBounds.y = bounds.y;
                     rowBounds.height = bounds.height;
                     paintRow(renderer, dtcr, context, cellContext, g,
@@ -383,7 +383,8 @@
             paintingEnumerator = treeState.getVisiblePathsFrom(initialPath);
             while (!done && paintingEnumerator.hasMoreElements()) {
                 path = (TreePath)paintingEnumerator.nextElement();
-                if (path != null) {
+                bounds = getPathBounds(tree, path);
+                if ((path != null) && (bounds != null)) {
                     isLeaf = treeModel.isLeaf(path.getLastPathComponent());
                     if (isLeaf) {
                         isExpanded = hasBeenExpanded = false;
@@ -392,7 +393,6 @@
                         isExpanded = treeState.getExpandedState(path);
                         hasBeenExpanded = tree.hasBeenExpanded(path);
                     }
-                    bounds = getPathBounds(tree, path);
                     // See if the vertical line to the parent has been drawn.
                     parentPath = path.getParentPath();
                     if (parentPath != null) {
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java	Tue Aug 06 16:54:56 2013 -0700
@@ -218,9 +218,11 @@
                         ("unable to create RSA KeyFactory: " + e.getMessage());
                 }
             }
-            Element modulusElem = DOMUtils.getFirstChildElement(kvtElem);
+            Element modulusElem = DOMUtils.getFirstChildElement(kvtElem,
+                                                                "Modulus");
             modulus = new DOMCryptoBinary(modulusElem.getFirstChild());
-            Element exponentElem = DOMUtils.getNextSiblingElement(modulusElem);
+            Element exponentElem = DOMUtils.getNextSiblingElement(modulusElem,
+                                                                  "Exponent");
             exponent = new DOMCryptoBinary(exponentElem.getFirstChild());
             RSAPublicKeySpec spec = new RSAPublicKeySpec(modulus.getBigNum(),
                                                          exponent.getBigNum());
@@ -289,13 +291,13 @@
             // check for P and Q
             if (curElem.getLocalName().equals("P")) {
                 p = new DOMCryptoBinary(curElem.getFirstChild());
-                curElem = DOMUtils.getNextSiblingElement(curElem);
+                curElem = DOMUtils.getNextSiblingElement(curElem, "Q");
                 q = new DOMCryptoBinary(curElem.getFirstChild());
                 curElem = DOMUtils.getNextSiblingElement(curElem);
             }
             if (curElem.getLocalName().equals("G")) {
                 g = new DOMCryptoBinary(curElem.getFirstChild());
-                curElem = DOMUtils.getNextSiblingElement(curElem);
+                curElem = DOMUtils.getNextSiblingElement(curElem, "Y");
             }
             y = new DOMCryptoBinary(curElem.getFirstChild());
             curElem = DOMUtils.getNextSiblingElement(curElem);
@@ -460,7 +462,7 @@
             } else {
                 throw new MarshalException("Invalid ECKeyValue");
             }
-            curElem = DOMUtils.getNextSiblingElement(curElem);
+            curElem = DOMUtils.getNextSiblingElement(curElem, "PublicKey");
             ECPoint ecPoint = null;
             try {
                 Object[] args = new Object[] { Base64.decode(curElem),
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -101,20 +101,24 @@
 
         boolean secVal = Utils.secureValidation(context);
 
-        Element refElem = DOMUtils.getFirstChildElement(manElem);
+        Element refElem = DOMUtils.getFirstChildElement(manElem, "Reference");
         List<Reference> refs = new ArrayList<Reference>();
+        refs.add(new DOMReference(refElem, context, provider));
 
-        int refCount = 0;
+        refElem = DOMUtils.getNextSiblingElement(refElem);
         while (refElem != null) {
+            String localName = refElem.getLocalName();
+            if (!localName.equals("Reference")) {
+                throw new MarshalException("Invalid element name: " +
+                                           localName + ", expected Reference");
+            }
             refs.add(new DOMReference(refElem, context, provider));
-            refElem = DOMUtils.getNextSiblingElement(refElem);
-
-            refCount++;
-            if (secVal && (refCount > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
+            if (secVal && (refs.size() > DOMSignedInfo.MAXIMUM_REFERENCE_COUNT)) {
                 String error = "A maxiumum of " + DOMSignedInfo.MAXIMUM_REFERENCE_COUNT + " "
                     + "references per Manifest are allowed with secure validation";
                 throw new MarshalException(error);
             }
+            refElem = DOMUtils.getNextSiblingElement(refElem);
         }
         this.references = Collections.unmodifiableList(refs);
     }
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java	Tue Aug 06 16:54:56 2013 -0700
@@ -204,23 +204,33 @@
         Element nextSibling = DOMUtils.getFirstChildElement(refElem);
         List<Transform> transforms = new ArrayList<Transform>(5);
         if (nextSibling.getLocalName().equals("Transforms")) {
-            Element transformElem = DOMUtils.getFirstChildElement(nextSibling);
-
-            int transformCount = 0;
+            Element transformElem = DOMUtils.getFirstChildElement(nextSibling,
+                                                                  "Transform");
+            transforms.add(new DOMTransform(transformElem, context, provider));
+            transformElem = DOMUtils.getNextSiblingElement(transformElem);
             while (transformElem != null) {
+                String localName = transformElem.getLocalName();
+                if (!localName.equals("Transform")) {
+                    throw new MarshalException(
+                        "Invalid element name: " + localName +
+                        ", expected Transform");
+                }
                 transforms.add
                     (new DOMTransform(transformElem, context, provider));
-                transformElem = DOMUtils.getNextSiblingElement(transformElem);
-
-                transformCount++;
-                if (secVal && (transformCount > MAXIMUM_TRANSFORM_COUNT)) {
+                if (secVal && (transforms.size() > MAXIMUM_TRANSFORM_COUNT)) {
                     String error = "A maxiumum of " + MAXIMUM_TRANSFORM_COUNT + " "
                         + "transforms per Reference are allowed with secure validation";
                     throw new MarshalException(error);
                 }
+                transformElem = DOMUtils.getNextSiblingElement(transformElem);
             }
             nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
         }
+        if (!nextSibling.getLocalName().equals("DigestMethod")) {
+            throw new MarshalException("Invalid element name: " +
+                                       nextSibling.getLocalName() +
+                                       ", expected DigestMethod");
+        }
 
         // unmarshal DigestMethod
         Element dmElem = nextSibling;
@@ -234,13 +244,19 @@
         }
 
         // unmarshal DigestValue
+        Element dvElem = DOMUtils.getNextSiblingElement(dmElem, "DigestValue");
         try {
-            Element dvElem = DOMUtils.getNextSiblingElement(dmElem);
             this.digestValue = Base64.decode(dvElem);
         } catch (Base64DecodingException bde) {
             throw new MarshalException(bde);
         }
 
+        // check for extra elements
+        if (DOMUtils.getNextSiblingElement(dvElem) != null) {
+            throw new MarshalException(
+                "Unexpected element after DigestValue element");
+        }
+
         // unmarshal attributes
         this.uri = DOMUtils.getAttributeValue(refElem, "URI");
 
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java	Tue Aug 06 16:54:56 2013 -0700
@@ -136,21 +136,30 @@
         List<Transform> transforms = new ArrayList<Transform>();
         Element transformsElem = DOMUtils.getFirstChildElement(rmElem);
 
-        int transformCount = 0;
         if (transformsElem != null) {
+            String localName = transformsElem.getLocalName();
+            if (!localName.equals("Transforms")) {
+                throw new MarshalException("Invalid element name: " +
+                                           localName + ", expected Transforms");
+            }
             Element transformElem =
-                DOMUtils.getFirstChildElement(transformsElem);
+                DOMUtils.getFirstChildElement(transformsElem, "Transform");
+            transforms.add(new DOMTransform(transformElem, context, provider));
+            transformElem = DOMUtils.getNextSiblingElement(transformElem);
             while (transformElem != null) {
+                String name = transformElem.getLocalName();
+                if (!name.equals("Transform")) {
+                    throw new MarshalException("Invalid element name: " +
+                                               name + ", expected Transform");
+                }
                 transforms.add
                     (new DOMTransform(transformElem, context, provider));
-                transformElem = DOMUtils.getNextSiblingElement(transformElem);
-
-                transformCount++;
-                if (secVal && (transformCount > DOMReference.MAXIMUM_TRANSFORM_COUNT)) {
+                if (secVal && (transforms.size() > DOMReference.MAXIMUM_TRANSFORM_COUNT)) {
                     String error = "A maxiumum of " + DOMReference.MAXIMUM_TRANSFORM_COUNT + " "
                         + "transforms per Reference are allowed with secure validation";
                     throw new MarshalException(error);
                 }
+                transformElem = DOMUtils.getNextSiblingElement(transformElem);
             }
         }
         if (transforms.isEmpty()) {
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java	Tue Aug 06 16:54:56 2013 -0700
@@ -109,6 +109,11 @@
         for (int i = 0; i < length; i++) {
             Node child = nodes.item(i);
             if (child.getNodeType() == Node.ELEMENT_NODE) {
+                String name = child.getLocalName();
+                if (!name.equals("SignatureProperty")) {
+                    throw new MarshalException("Invalid element name: " + name +
+                                               ", expected SignatureProperty");
+                }
                 properties.add(new DOMSignatureProperty((Element)child,
                                                         context));
             }
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java	Tue Aug 06 16:54:56 2013 -0700
@@ -150,11 +150,14 @@
         id = DOMUtils.getAttributeValue(siElem, "Id");
 
         // unmarshal CanonicalizationMethod
-        Element cmElem = DOMUtils.getFirstChildElement(siElem);
-        canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context, provider);
+        Element cmElem = DOMUtils.getFirstChildElement(siElem,
+                                                       "CanonicalizationMethod");
+        canonicalizationMethod = new DOMCanonicalizationMethod(cmElem, context,
+                                                               provider);
 
         // unmarshal SignatureMethod
-        Element smElem = DOMUtils.getNextSiblingElement(cmElem);
+        Element smElem = DOMUtils.getNextSiblingElement(cmElem,
+                                                        "SignatureMethod");
         signatureMethod = DOMSignatureMethod.unmarshal(smElem);
 
         boolean secVal = Utils.secureValidation(context);
@@ -169,19 +172,24 @@
 
         // unmarshal References
         ArrayList<Reference> refList = new ArrayList<Reference>(5);
-        Element refElem = DOMUtils.getNextSiblingElement(smElem);
+        Element refElem = DOMUtils.getNextSiblingElement(smElem, "Reference");
+        refList.add(new DOMReference(refElem, context, provider));
 
-        int refCount = 0;
+        refElem = DOMUtils.getNextSiblingElement(refElem);
         while (refElem != null) {
+            String name = refElem.getLocalName();
+            if (!name.equals("Reference")) {
+                throw new MarshalException("Invalid element name: " +
+                                           name + ", expected Reference");
+            }
             refList.add(new DOMReference(refElem, context, provider));
-            refElem = DOMUtils.getNextSiblingElement(refElem);
 
-            refCount++;
-            if (secVal && (refCount > MAXIMUM_REFERENCE_COUNT)) {
+            if (secVal && (refList.size() > MAXIMUM_REFERENCE_COUNT)) {
                 String error = "A maxiumum of " + MAXIMUM_REFERENCE_COUNT + " "
                     + "references per Manifest are allowed with secure validation";
                 throw new MarshalException(error);
             }
+            refElem = DOMUtils.getNextSiblingElement(refElem);
         }
         references = Collections.unmodifiableList(refList);
     }
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java	Tue Aug 06 16:54:56 2013 -0700
@@ -132,6 +132,36 @@
     }
 
     /**
+     * Returns the first child element of the specified node and checks that
+     * the local name is equal to {@code localName}.
+     *
+     * @param node the node
+     * @return the first child element of the specified node
+     * @throws NullPointerException if {@code node == null}
+     * @throws MarshalException if no such element or the local name is not
+     *    equal to {@code localName}
+     */
+    public static Element getFirstChildElement(Node node, String localName)
+        throws MarshalException
+    {
+        return verifyElement(getFirstChildElement(node), localName);
+    }
+
+    private static Element verifyElement(Element elem, String localName)
+        throws MarshalException
+    {
+        if (elem == null) {
+            throw new MarshalException("Missing " + localName + " element");
+        }
+        String name = elem.getLocalName();
+        if (!name.equals(localName)) {
+            throw new MarshalException("Invalid element name: " +
+                                       name + ", expected " + localName);
+        }
+        return elem;
+    }
+
+    /**
      * Returns the last child element of the specified node, or null if there
      * is no such element.
      *
@@ -166,6 +196,22 @@
     }
 
     /**
+     * Returns the next sibling element of the specified node and checks that
+     * the local name is equal to {@code localName}.
+     *
+     * @param node the node
+     * @return the next sibling element of the specified node
+     * @throws NullPointerException if {@code node == null}
+     * @throws MarshalException if no such element or the local name is not
+     *    equal to {@code localName}
+     */
+    public static Element getNextSiblingElement(Node node, String localName)
+        throws MarshalException
+    {
+        return verifyElement(getNextSiblingElement(node), localName);
+    }
+
+    /**
      * Returns the attribute value for the attribute with the specified name.
      * Returns null if there is no such attribute, or
      * the empty string if the attribute value is empty.
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509IssuerSerial.java	Tue Aug 06 16:54:56 2013 -0700
@@ -80,9 +80,11 @@
      *
      * @param isElem an X509IssuerSerial element
      */
-    public DOMX509IssuerSerial(Element isElem) {
-        Element iNElem = DOMUtils.getFirstChildElement(isElem);
-        Element sNElem = DOMUtils.getNextSiblingElement(iNElem);
+    public DOMX509IssuerSerial(Element isElem) throws MarshalException {
+        Element iNElem = DOMUtils.getFirstChildElement(isElem,
+                                                       "X509IssuerName");
+        Element sNElem = DOMUtils.getNextSiblingElement(iNElem,
+                                                        "X509SerialNumber");
         issuerName = iNElem.getFirstChild().getNodeValue();
         serialNumber = new BigInteger(sNElem.getFirstChild().getNodeValue());
     }
--- a/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java	Tue Aug 06 16:54:56 2013 -0700
@@ -141,11 +141,13 @@
         id = DOMUtils.getAttributeValue(localSigElem, "Id");
 
         // unmarshal SignedInfo
-        Element siElem = DOMUtils.getFirstChildElement(localSigElem);
+        Element siElem = DOMUtils.getFirstChildElement(localSigElem,
+                                                       "SignedInfo");
         si = new DOMSignedInfo(siElem, context, provider);
 
         // unmarshal SignatureValue
-        Element sigValElem = DOMUtils.getNextSiblingElement(siElem);
+        Element sigValElem = DOMUtils.getNextSiblingElement(siElem,
+                                                            "SignatureValue");
         sv = new DOMSignatureValue(sigValElem, context);
 
         // unmarshal KeyInfo, if specified
@@ -161,6 +163,11 @@
         } else {
             List<XMLObject> tempObjects = new ArrayList<XMLObject>();
             while (nextSibling != null) {
+                String name = nextSibling.getLocalName();
+                if (!name.equals("Object")) {
+                    throw new MarshalException("Invalid element name: " + name +
+                                               ", expected KeyInfo or Object");
+                }
                 tempObjects.add(new DOMXMLObject(nextSibling,
                                                  context, provider));
                 nextSibling = DOMUtils.getNextSiblingElement(nextSibling);
--- a/jdk/src/share/classes/sun/font/TrueTypeFont.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/font/TrueTypeFont.java	Tue Aug 06 16:54:56 2013 -0700
@@ -547,6 +547,17 @@
                     throw new FontFormatException("bad table, tag="+table.tag);
                 }
             }
+
+            if (getDirectoryEntry(headTag) == null) {
+                throw new FontFormatException("missing head table");
+            }
+            if (getDirectoryEntry(maxpTag) == null) {
+                throw new FontFormatException("missing maxp table");
+            }
+            if (getDirectoryEntry(hmtxTag) != null
+                    && getDirectoryEntry(hheaTag) == null) {
+                throw new FontFormatException("missing hhea table");
+            }
             initNames();
         } catch (Exception e) {
             if (FontUtilities.isLogging()) {
--- a/jdk/src/share/classes/sun/print/PSPrinterJob.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java	Tue Aug 06 16:54:56 2013 -0700
@@ -59,6 +59,8 @@
 import javax.print.StreamPrintService;
 import javax.print.attribute.HashPrintRequestAttributeSet;
 import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.PrintServiceAttributeSet;
+import javax.print.attribute.standard.PrinterName;
 import javax.print.attribute.standard.Chromaticity;
 import javax.print.attribute.standard.Copies;
 import javax.print.attribute.standard.Destination;
@@ -766,8 +768,9 @@
             }
         }
         if (mDestType == RasterPrinterJob.PRINTER) {
-            if (getPrintService() != null) {
-                mDestination = getPrintService().getName();
+            PrintService pServ = getPrintService();
+            if (pServ != null) {
+                mDestination = pServ.getName();
             }
             PrinterSpooler spooler = new PrinterSpooler();
             java.security.AccessController.doPrivileged(spooler);
--- a/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/pkcs/PKCS9Attribute.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -310,7 +310,8 @@
     private static final Byte[][] PKCS9_VALUE_TAGS = {
         null,
         {new Byte(DerValue.tag_IA5String)},   // EMailAddress
-        {new Byte(DerValue.tag_IA5String)},   // UnstructuredName
+        {new Byte(DerValue.tag_IA5String),   // UnstructuredName
+         new Byte(DerValue.tag_PrintableString)},
         {new Byte(DerValue.tag_ObjectId)},    // ContentType
         {new Byte(DerValue.tag_OctetString)}, // MessageDigest
         {new Byte(DerValue.tag_UtcTime)},     // SigningTime
--- a/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSP.java	Tue Aug 06 16:54:56 2013 -0700
@@ -255,7 +255,9 @@
             }
             response = Arrays.copyOf(response, total);
         } catch (IOException ioe) {
-            throw new NetworkFailureException(ioe);
+            throw new CertPathValidatorException(
+                "Unable to determine revocation status due to network error",
+                ioe, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
         } finally {
             if (in != null) {
                 try {
@@ -355,17 +357,4 @@
          */
         Map<String, Extension> getSingleExtensions();
     }
-
-    static class NetworkFailureException extends CertPathValidatorException {
-        private static final long serialVersionUID = 0l;
-
-        NetworkFailureException(Throwable t) {
-            super(t);
-        }
-
-        @Override
-        public CertPathValidatorException.Reason getReason() {
-            return BasicReason.UNDETERMINED_REVOCATION_STATUS;
-        }
-    }
 }
--- a/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/OCSPResponse.java	Tue Aug 06 16:54:56 2013 -0700
@@ -30,6 +30,7 @@
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateParsingException;
 import java.security.cert.CertPathValidatorException;
+import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.CRLReason;
 import java.security.cert.TrustAnchor;
 import java.security.cert.X509Certificate;
@@ -121,8 +122,8 @@
 
     public enum ResponseStatus {
         SUCCESSFUL,            // Response has valid confirmations
-        MALFORMED_REQUEST,     // Illegal confirmation request
-        INTERNAL_ERROR,        // Internal error in issuer
+        MALFORMED_REQUEST,     // Illegal request
+        INTERNAL_ERROR,        // Internal error in responder
         TRY_LATER,             // Try again later
         UNUSED,                // is not used
         SIG_REQUIRED,          // Must sign the request
@@ -381,9 +382,18 @@
                 Date date, byte[] nonce)
         throws CertPathValidatorException
     {
-        if (responseStatus != ResponseStatus.SUCCESSFUL) {
-            throw new CertPathValidatorException
-                ("OCSP response error: " + responseStatus);
+        switch (responseStatus) {
+            case SUCCESSFUL:
+                break;
+            case UNAUTHORIZED:
+            case TRY_LATER:
+            case INTERNAL_ERROR:
+                throw new CertPathValidatorException(
+                    "OCSP response error: " + responseStatus, null, null, -1,
+                    BasicReason.UNDETERMINED_REVOCATION_STATUS);
+            default:
+                throw new CertPathValidatorException("OCSP response error: " +
+                                                     responseStatus);
         }
 
         // Check that the response includes a response for all of the
--- a/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/PKIXCertPathValidator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -193,10 +193,15 @@
         List<PKIXCertPathChecker> checkers = params.certPathCheckers();
         for (PKIXCertPathChecker checker : checkers) {
             if (checker instanceof PKIXRevocationChecker) {
+                if (revCheckerAdded) {
+                    throw new CertPathValidatorException(
+                        "Only one PKIXRevocationChecker can be specified");
+                }
                 revCheckerAdded = true;
                 // if it's our own, initialize it
-                if (checker instanceof RevocationChecker)
+                if (checker instanceof RevocationChecker) {
                     ((RevocationChecker)checker).init(anchor, params);
+                }
             }
         }
         // only add a RevocationChecker if revocation is enabled and
--- a/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/ReverseState.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import java.security.cert.CertificateException;
 import java.security.cert.CertPathValidatorException;
 import java.security.cert.PKIXCertPathChecker;
+import java.security.cert.PKIXRevocationChecker;
 import java.security.cert.TrustAnchor;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
@@ -235,9 +236,16 @@
         for (PKIXCertPathChecker checker : userCheckers) {
             if (checker instanceof AlgorithmChecker) {
                 ((AlgorithmChecker)checker).trySetTrustAnchor(anchor);
-            } else if (checker instanceof RevocationChecker) {
-                ((RevocationChecker)checker).init(anchor, buildParams);
-                ((RevocationChecker)checker).init(false);
+            } else if (checker instanceof PKIXRevocationChecker) {
+                if (revCheckerAdded) {
+                    throw new CertPathValidatorException(
+                        "Only one PKIXRevocationChecker can be specified");
+                }
+                // if it's our own, initialize it
+                if (checker instanceof RevocationChecker) {
+                    ((RevocationChecker)checker).init(anchor, buildParams);
+                }
+                ((PKIXRevocationChecker)checker).init(false);
                 revCheckerAdded = true;
             }
         }
--- a/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/RevocationChecker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -38,14 +38,7 @@
 import java.security.cert.CertPathValidatorException.BasicReason;
 import java.security.cert.Extension;
 import java.security.cert.*;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 import javax.security.auth.x500.X500Principal;
 
 import static sun.security.provider.certpath.OCSP.*;
@@ -70,13 +63,16 @@
     private Map<X509Certificate, byte[]> ocspResponses;
     private List<Extension> ocspExtensions;
     private boolean legacy;
+    private LinkedList<CertPathValidatorException> softFailExceptions =
+        new LinkedList<>();
 
     // state variables
     private X509Certificate issuerCert;
     private PublicKey prevPubKey;
     private boolean crlSignFlag;
+    private int certIndex;
 
-    private enum Mode { PREFER_OCSP, PREFER_CRLS, ONLY_CRLS };
+    private enum Mode { PREFER_OCSP, PREFER_CRLS, ONLY_CRLS, ONLY_OCSP };
     private Mode mode = Mode.PREFER_OCSP;
 
     private static class RevocationProperties {
@@ -104,9 +100,9 @@
         throws CertPathValidatorException
     {
         RevocationProperties rp = getRevocationProperties();
-        URI uri = getOCSPResponder();
+        URI uri = getOcspResponder();
         responderURI = (uri == null) ? toURI(rp.ocspUrl) : uri;
-        X509Certificate cert = getOCSPResponderCert();
+        X509Certificate cert = getOcspResponderCert();
         responderCert = (cert == null)
                         ? getResponderCert(rp, params.trustAnchors(),
                                            params.certStores())
@@ -117,31 +113,38 @@
             case ONLY_END_ENTITY:
             case PREFER_CRLS:
             case SOFT_FAIL:
+            case NO_FALLBACK:
                 break;
             default:
                 throw new CertPathValidatorException(
                     "Unrecognized revocation parameter option: " + option);
             }
         }
+        softFail = options.contains(Option.SOFT_FAIL);
 
         // set mode, only end entity flag
         if (legacy) {
             mode = (rp.ocspEnabled) ? Mode.PREFER_OCSP : Mode.ONLY_CRLS;
             onlyEE = rp.onlyEE;
         } else {
-            if (options.contains(Option.PREFER_CRLS)) {
+            if (options.contains(Option.NO_FALLBACK)) {
+                if (options.contains(Option.PREFER_CRLS)) {
+                    mode = Mode.ONLY_CRLS;
+                } else {
+                    mode = Mode.ONLY_OCSP;
+                }
+            } else if (options.contains(Option.PREFER_CRLS)) {
                 mode = Mode.PREFER_CRLS;
             }
             onlyEE = options.contains(Option.ONLY_END_ENTITY);
         }
-        softFail = options.contains(Option.SOFT_FAIL);
         if (legacy) {
             crlDP = rp.crlDPEnabled;
         } else {
             crlDP = true;
         }
-        ocspResponses = getOCSPResponses();
-        ocspExtensions = getOCSPExtensions();
+        ocspResponses = getOcspResponses();
+        ocspExtensions = getOcspExtensions();
 
         this.anchor = anchor;
         this.params = params;
@@ -297,14 +300,19 @@
         if (forward) {
             throw new
                 CertPathValidatorException("forward checking not supported");
+        }
+        if (anchor != null) {
+            issuerCert = anchor.getTrustedCert();
+            prevPubKey = (issuerCert != null) ? issuerCert.getPublicKey()
+                                              : anchor.getCAPublicKey();
+        }
+        crlSignFlag = true;
+        if (params.certPath() != null) {
+            certIndex = params.certPath().getCertificates().size() - 1;
         } else {
-            if (anchor != null) {
-                issuerCert = anchor.getTrustedCert();
-                prevPubKey = (issuerCert != null) ? issuerCert.getPublicKey()
-                                                  : anchor.getCAPublicKey();
-            }
-            crlSignFlag = true;
+            certIndex = -1;
         }
+        softFailExceptions.clear();
     }
 
     @Override
@@ -318,27 +326,34 @@
     }
 
     @Override
+    public List<CertPathValidatorException> getSoftFailExceptions() {
+        return Collections.unmodifiableList(softFailExceptions);
+    }
+
+    @Override
     public void check(Certificate cert, Collection<String> unresolvedCritExts)
         throws CertPathValidatorException
     {
-        X509Certificate xcert = (X509Certificate)cert;
-        if (onlyEE && xcert.getBasicConstraints() != -1) {
-            if (debug != null) {
-                debug.println("Skipping revocation check, not end entity cert");
-            }
-        } else {
-            check(xcert, unresolvedCritExts, prevPubKey, crlSignFlag);
-        }
-        updateState(xcert);
+        check((X509Certificate)cert, unresolvedCritExts,
+              prevPubKey, crlSignFlag);
     }
 
-    void check(X509Certificate xcert, Collection<String> unresolvedCritExts,
-               PublicKey pubKey, boolean crlSignFlag)
+    private void check(X509Certificate xcert,
+                       Collection<String> unresolvedCritExts,
+                       PublicKey pubKey, boolean crlSignFlag)
         throws CertPathValidatorException
     {
         try {
+            if (onlyEE && xcert.getBasicConstraints() != -1) {
+                if (debug != null) {
+                    debug.println("Skipping revocation check, not end " +
+                                  "entity cert");
+                }
+                return;
+            }
             switch (mode) {
                 case PREFER_OCSP:
+                case ONLY_OCSP:
                     checkOCSP(xcert, unresolvedCritExts);
                     break;
                 case PREFER_CRLS:
@@ -351,14 +366,17 @@
             if (e.getReason() == BasicReason.REVOKED) {
                 throw e;
             }
-            CertPathValidatorException cause = e;
-            if (softFail && e instanceof NetworkFailureException) {
-                if (mode == Mode.ONLY_CRLS) return;
+            boolean eSoftFail = isSoftFailException(e);
+            if (eSoftFail) {
+                if (mode == Mode.ONLY_OCSP || mode == Mode.ONLY_CRLS) {
+                    return;
+                }
+            } else {
+                if (mode == Mode.ONLY_OCSP || mode == Mode.ONLY_CRLS) {
+                    throw e;
+                }
             }
-            // Rethrow the exception if ONLY_CRLS
-            if (mode == Mode.ONLY_CRLS) {
-                throw e;
-            }
+            CertPathValidatorException cause = e;
             // Otherwise, failover
             if (debug != null) {
                 debug.println("RevocationChecker.check() " + e.getMessage());
@@ -382,22 +400,35 @@
                 if (x.getReason() == BasicReason.REVOKED) {
                     throw x;
                 }
-                if (cause != null) {
-                    if (softFail && cause instanceof NetworkFailureException) {
-                        return;
-                    } else {
-                        cause.addSuppressed(x);
+                if (!isSoftFailException(x)) {
+                    cause.addSuppressed(x);
+                    throw cause;
+                } else {
+                    // only pass if both exceptions were soft failures
+                    if (!eSoftFail) {
                         throw cause;
                     }
                 }
-                if (softFail && x instanceof NetworkFailureException) {
-                    return;
-                }
-                throw x;
             }
+        } finally {
+            updateState(xcert);
         }
     }
 
+    private boolean isSoftFailException(CertPathValidatorException e) {
+        if (softFail &&
+            e.getReason() == BasicReason.UNDETERMINED_REVOCATION_STATUS)
+        {
+            // recreate exception with correct index
+            CertPathValidatorException e2 = new CertPathValidatorException(
+                e.getMessage(), e.getCause(), params.certPath(), certIndex,
+                e.getReason());
+            softFailExceptions.addFirst(e2);
+            return true;
+        }
+        return false;
+    }
+
     private void updateState(X509Certificate cert)
         throws CertPathValidatorException
     {
@@ -411,6 +442,9 @@
         }
         prevPubKey = pubKey;
         crlSignFlag = certCanSignCrl(cert);
+        if (certIndex > 0) {
+            certIndex--;
+        }
     }
 
     // Maximum clock skew in milliseconds (15 minutes) allowed when checking
@@ -446,8 +480,8 @@
                               " circular dependency");
             }
             throw new CertPathValidatorException
-                ("Could not determine revocation status", null, null, -1,
-                 BasicReason.UNDETERMINED_REVOCATION_STATUS);
+                 ("Could not determine revocation status", null, null, -1,
+                  BasicReason.UNDETERMINED_REVOCATION_STATUS);
         }
 
         Set<X509CRL> possibleCRLs = new HashSet<>();
@@ -457,7 +491,7 @@
         CertPathHelper.setDateAndTime(sel, params.date(), MAX_CLOCK_SKEW);
 
         // First, check user-specified CertStores
-        NetworkFailureException nfe = null;
+        CertPathValidatorException networkFailureException = null;
         for (CertStore store : certStores) {
             try {
                 for (CRL crl : store.getCRLs(sel)) {
@@ -468,10 +502,13 @@
                     debug.println("RevocationChecker.checkCRLs() " +
                                   "CertStoreException: " + e.getMessage());
                 }
-                if (softFail && nfe == null &&
+                if (networkFailureException == null &&
                     CertStoreHelper.isCausedByNetworkIssue(store.getType(),e)) {
                     // save this exception, we may need to throw it later
-                    nfe = new NetworkFailureException(e);
+                    networkFailureException = new CertPathValidatorException(
+                        "Unable to determine revocation status due to " +
+                        "network error", e, null, -1,
+                        BasicReason.UNDETERMINED_REVOCATION_STATUS);
                 }
             }
         }
@@ -508,14 +545,17 @@
                     approvedCRLs.addAll(DistributionPointFetcher.getCRLs(
                                         sel, signFlag, prevKey,
                                         params.sigProvider(), certStores,
-                                        reasonsMask, anchors, params.date()));
+                                        reasonsMask, anchors, null));
                 }
             } catch (CertStoreException e) {
-                if (softFail && e instanceof CertStoreTypeException) {
+                if (e instanceof CertStoreTypeException) {
                     CertStoreTypeException cste = (CertStoreTypeException)e;
                     if (CertStoreHelper.isCausedByNetworkIssue(cste.getType(),
                                                                e)) {
-                        throw new NetworkFailureException(e);
+                        throw new CertPathValidatorException(
+                            "Unable to determine revocation status due to " +
+                            "network error", e, null, -1,
+                            BasicReason.UNDETERMINED_REVOCATION_STATUS);
                     }
                 }
                 throw new CertPathValidatorException(e);
@@ -531,26 +571,26 @@
                                                      stackedCerts);
                         return;
                     } catch (CertPathValidatorException cpve) {
-                        if (nfe != null) {
+                        if (networkFailureException != null) {
                             // if a network issue previously prevented us from
                             // retrieving a CRL from one of the user-specified
-                            // CertStores and SOFT_FAIL is enabled, throw it now
-                            // so it can be handled appropriately
-                            throw nfe;
+                            // CertStores, throw it now so it can be handled
+                            // appropriately
+                            throw networkFailureException;
                         }
                         throw cpve;
                     }
                 } else {
-                    if (nfe != null) {
+                    if (networkFailureException != null) {
                         // if a network issue previously prevented us from
                         // retrieving a CRL from one of the user-specified
-                        // CertStores and SOFT_FAIL is enabled, throw it now
-                        // so it can be handled appropriately
-                        throw nfe;
+                        // CertStores, throw it now so it can be handled
+                        // appropriately
+                        throw networkFailureException;
                     }
-                    throw new CertPathValidatorException
-                    ("Could not determine revocation status", null, null, -1,
-                     BasicReason.UNDETERMINED_REVOCATION_STATUS);
+                    throw new CertPathValidatorException(
+                        "Could not determine revocation status", null, null, -1,
+                        BasicReason.UNDETERMINED_REVOCATION_STATUS);
                 }
             }
         }
@@ -595,14 +635,9 @@
                     unresCritExts.remove(ReasonCode_Id.toString());
                     unresCritExts.remove(CertificateIssuer_Id.toString());
                     if (!unresCritExts.isEmpty()) {
-                        if (debug != null) {
-                            debug.println("Unrecognized "
-                            + "critical extension(s) in revoked CRL entry: "
-                            + unresCritExts);
-                        }
-                        throw new CertPathValidatorException
-                        ("Could not determine revocation status", null, null,
-                         -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
+                        throw new CertPathValidatorException(
+                            "Unrecognized critical extension(s) in revoked " +
+                            "CRL entry");
                     }
                 }
 
@@ -610,11 +645,14 @@
                 if (reasonCode == null) {
                     reasonCode = CRLReason.UNSPECIFIED;
                 }
-                Throwable t = new CertificateRevokedException
-                    (entry.getRevocationDate(), reasonCode,
-                     crl.getIssuerX500Principal(), entry.getExtensions());
-                throw new CertPathValidatorException(t.getMessage(), t,
-                    null, -1, BasicReason.REVOKED);
+                Date revocationDate = entry.getRevocationDate();
+                if (revocationDate.before(params.date())) {
+                    Throwable t = new CertificateRevokedException(
+                        revocationDate, reasonCode,
+                        crl.getIssuerX500Principal(), entry.getExtensions());
+                    throw new CertPathValidatorException(
+                        t.getMessage(), t, null, -1, BasicReason.REVOKED);
+                }
             }
         }
     }
@@ -630,9 +668,6 @@
             throw new CertPathValidatorException(ce);
         }
 
-        URI responderURI = (this.responderURI != null)
-                           ? this.responderURI : getOCSPServerURI(currCert);
-
         X509Certificate respCert = (responderCert == null) ? issuerCert
                                                            : responderCert;
 
@@ -671,23 +706,38 @@
                                 params.date(), nonce);
 
             } else {
+                URI responderURI = (this.responderURI != null)
+                                   ? this.responderURI
+                                   : OCSP.getResponderURI(currCert);
+                if (responderURI == null) {
+                    throw new CertPathValidatorException(
+                        "Certificate does not specify OCSP responder", null,
+                        null, -1);
+                }
+
                 response = OCSP.check(Collections.singletonList(certId),
-                                      responderURI, respCert, params.date(),
+                                      responderURI, respCert, null,
                                       ocspExtensions);
             }
         } catch (IOException e) {
-            throw new CertPathValidatorException(e);
+            throw new CertPathValidatorException(
+                "Unable to determine revocation status due to network error",
+                e, null, -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
         }
 
         RevocationStatus rs =
             (RevocationStatus)response.getSingleResponse(certId);
         RevocationStatus.CertStatus certStatus = rs.getCertStatus();
         if (certStatus == RevocationStatus.CertStatus.REVOKED) {
-            Throwable t = new CertificateRevokedException(
-                rs.getRevocationTime(), rs.getRevocationReason(),
-                respCert.getSubjectX500Principal(), rs.getSingleExtensions());
-            throw new CertPathValidatorException(t.getMessage(), t, null,
-                                                 -1, BasicReason.REVOKED);
+            Date revocationTime = rs.getRevocationTime();
+            if (revocationTime.before(params.date())) {
+                Throwable t = new CertificateRevokedException(
+                    revocationTime, rs.getRevocationReason(),
+                    respCert.getSubjectX500Principal(),
+                    rs.getSingleExtensions());
+                throw new CertPathValidatorException(t.getMessage(), t, null,
+                                                     -1, BasicReason.REVOKED);
+            }
         } else if (certStatus == RevocationStatus.CertStatus.UNKNOWN) {
             throw new CertPathValidatorException(
                 "Certificate's revocation status is unknown", null,
@@ -711,34 +761,6 @@
         return hexNumber.toString();
     }
 
-    private static URI getOCSPServerURI(X509CertImpl cert)
-        throws CertPathValidatorException
-    {
-        // Examine the certificate's AuthorityInfoAccess extension
-        AuthorityInfoAccessExtension aia =
-            cert.getAuthorityInfoAccessExtension();
-        if (aia == null) {
-            throw new CertPathValidatorException(
-                "Must specify the location of an OCSP Responder");
-        }
-
-        List<AccessDescription> descriptions = aia.getAccessDescriptions();
-        for (AccessDescription description : descriptions) {
-            if (description.getAccessMethod().equals((Object)
-                AccessDescription.Ad_OCSP_Id)) {
-
-                GeneralName generalName = description.getAccessLocation();
-                if (generalName.getType() == GeneralNameInterface.NAME_URI) {
-                    URIName uri = (URIName)generalName.getName();
-                    return uri.getURI();
-                }
-            }
-        }
-
-        throw new CertPathValidatorException(
-            "Cannot find the location of the OCSP Responder");
-    }
-
     /**
      * Checks that a cert can be used to verify a CRL.
      *
@@ -870,8 +892,8 @@
                     " circular dependency");
             }
             throw new CertPathValidatorException
-                ("Could not determine revocation status", null, null,
-                 -1, BasicReason.UNDETERMINED_REVOCATION_STATUS);
+                ("Could not determine revocation status", null, null, -1,
+                 BasicReason.UNDETERMINED_REVOCATION_STATUS);
         }
 
         // Try to find another key that might be able to sign
@@ -1067,6 +1089,15 @@
         }
     }
 
+    @Override
+    public RevocationChecker clone() {
+        RevocationChecker copy = (RevocationChecker)super.clone();
+        // we don't deep-copy the exceptions, but that is ok because they
+        // are never modified after they are instantiated
+        copy.softFailExceptions = new LinkedList<>(softFailExceptions);
+        return copy;
+    }
+
     /*
      * This inner class extends the X509CertSelector to add an additional
      * check to make sure the subject public key isn't on a particular list.
--- a/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/provider/certpath/SunCertPathBuilder.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -422,7 +422,6 @@
                                         buildParams.anyPolicyInhibited(),
                                         buildParams.policyQualifiersRejected(),
                                         rootNode);
-
                 checkers.add(policyChecker);
 
                 // add the algorithm checker
@@ -455,11 +454,16 @@
                 List<PKIXCertPathChecker> ckrs = buildParams.certPathCheckers();
                 for (PKIXCertPathChecker ckr : ckrs) {
                     if (ckr instanceof PKIXRevocationChecker) {
+                        if (revCheckerAdded) {
+                            throw new CertPathValidatorException(
+                                "Only one PKIXRevocationChecker can be specified");
+                        }
                         revCheckerAdded = true;
                         // if it's our own, initialize it
-                        if (ckr instanceof RevocationChecker)
+                        if (ckr instanceof RevocationChecker) {
                             ((RevocationChecker)ckr).init(builder.trustAnchor,
                                                           buildParams);
+                        }
                     }
                 }
                 // only add a RevocationChecker if revocation is enabled and
--- a/jdk/src/share/classes/sun/security/tools/keytool/Main.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/security/tools/keytool/Main.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2198,8 +2198,15 @@
                     printExtensions(rb.getString("Extension.Request."), exts, out);
                 }
             } else {
-                out.println(attr.getAttributeId());
-                out.println(attr.getAttributeValue());
+                out.println("Attribute: " + attr.getAttributeId());
+                PKCS9Attribute pkcs9Attr =
+                        new PKCS9Attribute(attr.getAttributeId(),
+                                           attr.getAttributeValue());
+                out.print(pkcs9Attr.getName() + ": ");
+                Object attrVal = attr.getAttributeValue();
+                out.println(attrVal instanceof String[] ?
+                            Arrays.toString((String[]) attrVal) :
+                            attrVal);
             }
         }
         if (debug) {
--- a/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/swing/JLightweightFrame.java	Tue Aug 06 16:54:56 2013 -0700
@@ -29,12 +29,18 @@
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
+import java.awt.Dimension;
 import java.awt.EventQueue;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Rectangle;
+import java.awt.event.ComponentListener;
+import java.awt.event.ContainerEvent;
+import java.awt.event.ContainerListener;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBufferInt;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
 import java.security.AccessController;
 
 import javax.swing.JLayeredPane;
@@ -80,6 +86,8 @@
     private boolean copyBufferEnabled;
     private int[] copyBuffer;
 
+    private PropertyChangeListener layoutSizeListener;
+
     /**
      * Constructs a new, initially invisible {@code JLightweightFrame}
      * instance.
@@ -94,6 +102,23 @@
         if (getGraphicsConfiguration().isTranslucencyCapable()) {
             setBackground(new Color(0, 0, 0, 0));
         }
+
+        layoutSizeListener = new PropertyChangeListener() {
+            @Override
+            public void propertyChange(PropertyChangeEvent e) {
+                Dimension d = (Dimension)e.getNewValue();
+
+                if ("preferredSize".equals(e.getPropertyName())) {
+                    content.preferredSizeChanged(d.width, d.height);
+
+                } else if ("maximumSize".equals(e.getPropertyName())) {
+                    content.maximumSizeChanged(d.width, d.height);
+
+                } else if ("minimumSize".equals(e.getPropertyName())) {
+                    content.minimumSizeChanged(d.width, d.height);
+                }
+            }
+        };
     }
 
     /**
@@ -104,10 +129,23 @@
      *
      * @param content the {@link LightweightContent} instance
      */
-    public void setContent(LightweightContent content) {
+    public void setContent(final LightweightContent content) {
+        if (content == null) {
+            System.err.println("JLightweightFrame.setContent: content may not be null!");
+            return;
+        }
         this.content = content;
         this.component = content.getComponent();
 
+        Dimension d = this.component.getPreferredSize();
+        content.preferredSizeChanged(d.width, d.height);
+
+        d = this.component.getMaximumSize();
+        content.maximumSizeChanged(d.width, d.height);
+
+        d = this.component.getMinimumSize();
+        content.minimumSizeChanged(d.width, d.height);
+
         initInterior();
     }
 
@@ -202,6 +240,25 @@
         contentPane.setLayout(new BorderLayout());
         contentPane.add(component);
         setContentPane(contentPane);
+
+        contentPane.addContainerListener(new ContainerListener() {
+            @Override
+            public void componentAdded(ContainerEvent e) {
+                Component c = JLightweightFrame.this.component;
+                if (e.getChild() == c) {
+                    c.addPropertyChangeListener("preferredSize", layoutSizeListener);
+                    c.addPropertyChangeListener("maximumSize", layoutSizeListener);
+                    c.addPropertyChangeListener("minimumSize", layoutSizeListener);
+                }
+            }
+            @Override
+            public void componentRemoved(ContainerEvent e) {
+                Component c = JLightweightFrame.this.component;
+                if (e.getChild() == c) {
+                    c.removePropertyChangeListener(layoutSizeListener);
+                }
+            }
+        });
     }
 
     @SuppressWarnings("deprecation")
--- a/jdk/src/share/classes/sun/swing/LightweightContent.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/classes/sun/swing/LightweightContent.java	Tue Aug 06 16:54:56 2013 -0700
@@ -161,4 +161,22 @@
      * application that the frame has ungrabbed focus.
      */
     public void focusUngrabbed();
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content preferred size has changed.
+     */
+    public void preferredSizeChanged(int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content maximum size has changed.
+     */
+    public void maximumSizeChanged(int width, int height);
+
+    /**
+     * {@code JLightweightFrame} calls this method to notify the client
+     * application that the content minimum size has changed.
+     */
+    public void minimumSizeChanged(int width, int height);
 }
--- a/jdk/src/share/lib/hijrah-config-umalqura.properties	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/lib/hijrah-config-umalqura.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -1,58 +1,369 @@
-#
-# hijrah-config-umalqura.properties
-#
-#
-# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
-#
-# This properties file defines a Hijrah calendar variant.
-#
-# Fields:
-#
-#       <version> ::= 'version' '=' <version string>
-#            <id> ::= 'id' '=' <id string>
-#          <type> ::= 'type' '=' <type string>
-#     <iso-start> ::= 'iso-start' '=' <start date in the ISO calendar>
-#          <year> ::= <yyyy> '=' <nn nn nn nn nn nn nn nn nn nn nn nn>
-#
-# version ... (Required)
-#
-# id ... (Required)
-#    Identifies the Java Chronology
-#
-# type ... (Required)
-#    Identifies the type of calendar in the standard calendar ID scheme
-# iso-start ... (Required)
-#    Specifies the corresponding ISO date to the first Hijrah day
-#    in the defined range of dates
-#
-# year ... (Required)
-#    Number of days for each month of a Hijrah year
-#    * Each line defines a year. The years must be in the chronological
-#      order and no gap is allowed.
-#    * Each line is in the form indicated above. <yyyy> is a Hijrah year and
-#      nn is the number of days for a month listed in the order of the months.
-#    * Each year must have 12 months.
-#    * Each month should be 29 or 30 days long.
-#    * There must be one or more space characters between the months.
-#
-
-# indicates the version of this definition
-version=1.8.0_1
-
-# Java chronology ID
-id=Hijrah-umalqura
-
-# Standard calendar type specification
-type=islamic-umalqura
-
-# defines the corresponding ISO date to the earliest Hijrah date
-iso-start=2010-12-07
-
-#
-# the data section; defines the dates with the number of days for each month
-#
-# Placeholder data until full Umm alQura data can be validated
-1432=29 30 30 30 29 30 29 30 29 30 29 29
-1433=30 29 30 30 29 30 30 29 30 29 30 29
-1434=29 30 29 30 29 30 30 29 30 30 29 29
-1435=30 29 30 29 30 29 30 29 30 30 29 30
+# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+# This properties file defines a Hijrah calendar variant.
+#
+# Fields:
+#
+#       <version> ::= 'version' '=' <version string>
+#            <id> ::= 'id' '=' <id string>
+#          <type> ::= 'type' '=' <type string>
+#     <iso-start> ::= 'iso-start' '=' <start date in the ISO calendar>
+#          <year> ::= <yyyy> '=' <nn nn nn nn nn nn nn nn nn nn nn nn>
+#
+# version ... (Required)
+#
+# id ... (Required)
+#    Identifies the Java Chronology
+#
+# type ... (Required)
+#    Identifies the type of calendar in the standard calendar ID scheme
+# iso-start ... (Required)
+#    Specifies the corresponding ISO date to the first Hijrah day
+#    in the defined range of dates
+#
+# year ... (Required)
+#    Number of days for each month of a Hijrah year
+#    * Each line defines a year. The years must be in chronological
+#      order and no gap is allowed.
+#    * Each line is in the form indicated above. <yyyy> is a Hijrah year and
+#      nn is the number of days for a month listed in the order of the months.
+#    * Each year must have 12 months.
+#    * Each month should be 29 or 30 days long.
+#    * There must be one or more space characters between the months.
+#
+
+# Version of this definition
+version=1.8.0_1
+
+# Java chronology ID
+id=Hijrah-umalqura
+
+# Standard calendar type specification
+type=islamic-umalqura
+
+# defines the corresponding ISO date to the earliest Hijrah date
+iso-start=1882-11-12
+
+#     1  2  3  4  5  6  7  8  9 10 11 12
+1300=30 29 30 29 30 29 30 29 30 29 30 29
+1301=30 30 29 30 29 30 29 30 29 30 29 29
+1302=30 30 30 29 30 30 29 29 30 29 29 30
+1303=29 30 30 29 30 30 29 30 29 30 29 29
+1304=29 30 30 29 30 30 30 29 30 29 30 29
+1305=29 29 30 30 29 30 30 29 30 30 29 29
+1306=30 29 30 29 30 29 30 29 30 30 29 30
+1307=29 30 29 30 29 30 29 30 29 30 29 30
+1308=29 30 30 29 30 29 30 29 30 29 29 30
+1309=29 30 30 30 30 29 29 30 29 29 30 29
+1310=30 29 30 30 30 29 30 29 30 29 29 30
+1311=29 30 29 30 30 30 29 30 29 30 29 29
+1312=30 29 30 29 30 30 29 30 30 29 30 29
+1313=29 30 29 30 29 30 29 30 30 30 29 29
+1314=30 30 29 30 29 29 30 29 30 30 29 30
+1315=29 30 30 29 30 29 29 30 29 30 29 30
+1316=29 30 30 30 29 30 29 29 30 29 30 29
+1317=30 29 30 30 29 30 29 30 29 30 29 29
+1318=30 29 30 30 29 30 30 29 30 29 30 29
+1319=29 30 29 30 30 29 30 29 30 30 29 30
+1320=29 30 29 29 30 29 30 29 30 30 30 29
+1321=30 29 30 29 29 30 29 29 30 30 30 30
+1322=29 30 29 30 29 29 29 30 29 30 30 30
+1323=29 30 30 29 30 29 29 29 30 29 30 30
+1324=29 30 30 29 30 29 30 29 29 30 29 30
+1325=30 29 30 29 30 30 29 30 29 30 29 30
+1326=29 29 30 29 30 30 29 30 29 30 30 29
+1327=30 29 29 30 29 30 29 30 30 29 30 30
+1328=29 30 29 29 30 29 29 30 30 30 29 30
+1329=30 29 30 29 29 30 29 29 30 30 29 30
+1330=30 30 29 30 29 29 30 29 29 30 30 29
+1331=30 30 29 30 30 29 29 30 29 30 29 30
+1332=29 30 29 30 30 29 30 29 30 30 29 29
+1333=30 29 29 30 30 29 30 30 29 30 30 29
+1334=29 29 30 29 30 29 30 30 30 29 30 29
+1335=30 29 30 29 29 30 29 30 30 29 30 30
+1336=29 30 29 30 29 29 30 29 30 29 30 30
+1337=30 29 30 29 30 29 29 30 29 30 29 30
+1338=29 30 30 29 30 30 29 29 30 29 30 29
+1339=30 29 30 29 30 30 30 29 30 29 29 30
+1340=29 29 30 29 30 30 30 30 29 30 29 29
+1341=30 29 29 30 29 30 30 30 29 30 30 29
+1342=29 29 30 29 30 29 30 30 29 30 30 29
+1343=30 29 29 30 29 30 29 30 29 30 30 29
+1344=30 29 30 29 30 30 29 29 30 29 30 29
+1345=30 29 30 30 30 29 30 29 29 30 29 29
+1346=30 29 30 30 30 30 29 30 29 29 30 29
+1347=29 30 29 30 30 30 29 30 30 29 29 30
+1348=29 29 30 29 30 30 29 30 30 30 29 29
+1349=30 29 29 30 29 30 30 29 30 30 29 30
+1350=29 30 29 30 29 30 29 29 30 30 29 30
+1351=30 29 30 29 30 29 30 29 29 30 29 30
+1352=30 29 30 30 29 30 29 30 29 29 30 29
+1353=30 29 30 30 30 29 30 29 29 30 29 30
+1354=29 30 29 30 30 29 30 30 29 30 29 29
+1355=30 29 29 30 30 29 30 30 29 30 30 29
+1356=29 30 29 30 29 30 29 30 29 30 30 30
+1357=29 29 30 29 30 29 29 30 29 30 30 30
+1358=29 30 29 30 29 30 29 29 30 29 30 30
+1359=29 30 30 29 30 29 30 29 29 29 30 30
+1360=29 30 30 30 29 30 29 30 29 29 30 29
+1361=30 29 30 30 29 30 30 29 29 30 29 30
+1362=29 30 29 30 29 30 30 29 30 29 30 29
+1363=30 29 30 29 30 29 30 29 30 29 30 30
+1364=29 30 29 30 29 29 30 29 30 29 30 30
+1365=30 30 29 29 30 29 29 30 29 30 29 30
+1366=30 30 29 30 29 30 29 29 30 29 30 29
+1367=30 30 29 30 30 29 30 29 29 30 29 30
+1368=29 30 29 30 30 30 29 29 30 29 30 29
+1369=30 29 30 29 30 30 29 30 29 30 30 29
+1370=30 29 29 30 29 30 29 30 29 30 30 30
+1371=29 30 29 29 30 29 30 29 30 29 30 30
+1372=30 29 29 30 29 30 29 29 30 29 30 30
+1373=30 29 30 29 30 29 30 29 29 30 29 30
+1374=30 29 30 30 29 30 29 30 29 29 30 29
+1375=30 29 30 30 29 30 30 29 30 29 30 29
+1376=29 30 29 30 29 30 30 30 29 30 29 30
+1377=29 29 30 29 29 30 30 30 29 30 30 29
+1378=30 29 29 29 30 29 30 30 29 30 30 30
+1379=29 30 29 29 29 30 29 30 30 29 30 30
+1380=29 30 29 30 29 30 29 30 29 30 29 30
+1381=29 30 29 30 30 29 30 29 30 29 29 30
+1382=29 30 29 30 30 29 30 30 29 30 29 29
+1383=30 29 29 30 30 30 29 30 30 29 30 29
+1384=29 30 29 29 30 30 29 30 30 30 29 30
+1385=29 29 30 29 29 30 30 29 30 30 30 29
+1386=30 29 29 30 29 29 30 30 29 30 30 29
+1387=30 29 30 29 30 29 30 29 30 29 30 29
+1388=30 30 29 30 29 30 29 30 29 30 29 29
+1389=30 30 29 30 30 29 30 30 29 29 30 29
+1390=29 30 29 30 30 30 29 30 29 30 29 30
+1391=29 29 30 29 30 30 29 30 30 29 30 29
+1392=30 29 29 30 29 30 29 30 30 29 30 30
+1393=29 30 29 29 30 29 30 29 30 29 30 30
+1394=30 29 30 29 29 30 29 30 29 30 29 30
+1395=30 29 30 30 29 30 29 29 30 29 29 30
+1396=30 29 30 30 29 30 30 29 29 30 29 29
+1397=30 29 30 30 29 30 30 30 29 29 29 30
+1398=29 30 29 30 30 29 30 30 29 30 29 29
+1399=30 29 30 29 30 29 30 30 29 30 29 30
+1400=30 29 30 29 29 30 29 30 29 30 29 30
+1401=30 30 29 30 29 29 30 29 29 30 29 30
+1402=30 30 30 29 30 29 29 30 29 29 30 29
+1403=30 30 30 29 30 30 29 29 30 29 29 30
+1404=29 30 30 29 30 30 29 30 29 30 29 29
+1405=30 29 30 29 30 30 30 29 30 29 29 30
+1406=30 29 29 30 29 30 30 29 30 29 30 30
+1407=29 30 29 29 30 29 30 29 30 29 30 30
+1408=30 29 30 29 30 29 29 30 29 29 30 30
+1409=30 30 29 30 29 30 29 29 30 29 29 30
+1410=30 30 29 30 30 29 30 29 29 30 29 29
+1411=30 30 29 30 30 29 30 30 29 29 30 29
+1412=30 29 30 29 30 29 30 30 30 29 29 30
+1413=29 30 29 29 30 29 30 30 30 29 30 29
+1414=30 29 30 29 29 30 29 30 30 29 30 30
+1415=29 30 29 30 29 29 30 29 30 29 30 30
+1416=30 29 30 29 30 29 29 30 29 30 29 30
+1417=30 29 30 30 29 29 30 29 30 29 30 29
+1418=30 29 30 30 29 30 29 30 29 30 29 30
+1419=29 30 29 30 29 30 29 30 30 30 29 29
+1420=29 30 29 29 30 29 30 30 30 30 29 30
+1421=29 29 30 29 29 29 30 30 30 30 29 30
+1422=30 29 29 30 29 29 29 30 30 30 29 30
+1423=30 29 30 29 30 29 29 30 29 30 29 30
+1424=30 29 30 30 29 30 29 29 30 29 30 29
+1425=30 29 30 30 29 30 29 30 30 29 30 29
+1426=29 30 29 30 29 30 30 29 30 30 29 30
+1427=29 29 30 29 30 29 30 30 29 30 30 29
+1428=30 29 29 30 29 29 30 30 30 29 30 30
+1429=29 30 29 29 30 29 29 30 30 29 30 30
+1430=29 30 30 29 29 30 29 30 29 30 29 30
+1431=29 30 30 29 30 29 30 29 30 29 29 30
+1432=29 30 30 30 29 30 29 30 29 30 29 29
+1433=30 29 30 30 29 30 30 29 30 29 30 29
+1434=29 30 29 30 29 30 30 29 30 30 29 29
+1435=30 29 30 29 30 29 30 29 30 30 29 30
+1436=29 30 29 30 29 30 29 30 29 30 29 30
+1437=30 29 30 30 29 29 30 29 30 29 29 30
+1438=30 29 30 30 30 29 29 30 29 29 30 29
+1439=30 29 30 30 30 29 30 29 30 29 29 30
+1440=29 30 29 30 30 30 29 30 29 30 29 29
+1441=30 29 30 29 30 30 29 30 30 29 30 29
+1442=29 30 29 30 29 30 29 30 30 29 30 29
+1443=30 29 30 29 30 29 30 29 30 29 30 30
+1444=29 30 29 30 30 29 29 30 29 30 29 30
+1445=29 30 30 30 29 30 29 29 30 29 29 30
+1446=29 30 30 30 29 30 30 29 29 30 29 29
+1447=30 29 30 30 30 29 30 29 30 29 30 29
+1448=29 30 29 30 30 29 30 30 29 30 29 30
+1449=29 29 30 29 30 29 30 30 29 30 30 29
+1450=30 29 30 29 29 30 29 30 29 30 30 29
+1451=30 30 30 29 29 30 29 29 30 30 29 30
+1452=30 29 30 30 29 29 30 29 29 30 29 30
+1453=30 29 30 30 29 30 29 30 29 29 30 29
+1454=30 29 30 30 29 30 30 29 30 29 30 29
+1455=29 30 29 30 30 29 30 29 30 30 29 30
+1456=29 29 30 29 30 29 30 29 30 30 30 29
+1457=30 29 29 30 29 29 30 29 30 30 30 30
+1458=29 30 29 29 30 29 29 30 29 30 30 30
+1459=29 30 30 29 29 30 29 29 30 29 30 30
+1460=29 30 30 29 30 29 30 29 29 30 29 30
+1461=29 30 30 29 30 29 30 29 30 30 29 29
+1462=30 29 30 29 30 30 29 30 29 30 30 29
+1463=29 30 29 30 29 30 29 30 30 30 29 30
+1464=29 30 29 29 30 29 29 30 30 30 29 30
+1465=30 29 30 29 29 30 29 29 30 30 29 30
+1466=30 30 29 30 29 29 29 30 29 30 30 29
+1467=30 30 29 30 30 29 29 30 29 30 29 30
+1468=29 30 29 30 30 29 30 29 30 29 30 29
+1469=29 30 29 30 30 29 30 30 29 30 29 30
+1470=29 29 30 29 30 30 29 30 30 29 30 29
+1471=30 29 29 30 29 30 29 30 30 29 30 30
+1472=29 30 29 29 30 29 30 29 30 30 29 30
+1473=29 30 29 30 30 29 29 30 29 30 29 30
+1474=29 30 30 29 30 30 29 29 30 29 30 29
+1475=29 30 30 29 30 30 30 29 29 30 29 29
+1476=30 29 30 29 30 30 30 29 30 29 30 29
+1477=29 30 29 29 30 30 30 30 29 30 29 30
+1478=29 29 30 29 30 29 30 30 29 30 30 29
+1479=30 29 29 30 29 30 29 30 29 30 30 29
+1480=30 29 30 29 30 29 30 29 30 29 30 29
+1481=30 29 30 30 29 30 29 30 29 30 29 29
+1482=30 29 30 30 30 30 29 30 29 29 30 29
+1483=29 30 29 30 30 30 29 30 30 29 29 30
+1484=29 29 30 29 30 30 30 29 30 29 30 29
+1485=30 29 29 30 29 30 30 29 30 30 29 30
+1486=29 30 29 29 30 29 30 29 30 30 29 30
+1487=30 29 30 29 30 29 29 30 29 30 29 30
+1488=30 29 30 30 29 30 29 29 30 29 30 29
+1489=30 29 30 30 30 29 30 29 29 30 29 30
+1490=29 30 29 30 30 29 30 30 29 29 30 29
+1491=30 29 29 30 30 29 30 30 29 30 29 30
+1492=29 30 29 29 30 30 29 30 29 30 30 29
+1493=30 29 30 29 30 29 29 30 29 30 30 30
+1494=29 30 29 30 29 30 29 29 29 30 30 30
+1495=29 30 30 29 30 29 29 30 29 29 30 30
+1496=29 30 30 30 29 30 29 29 30 29 29 30
+1497=30 29 30 30 29 30 29 30 29 30 29 30
+1498=29 30 29 30 29 30 30 29 30 29 30 29
+1499=30 29 30 29 29 30 30 29 30 29 30 30
+1500=29 30 29 30 29 29 30 29 30 29 30 30
+1501=30 29 30 29 30 29 29 29 30 29 30 30
+1502=30 30 29 30 29 30 29 29 29 30 30 29
+1503=30 30 29 30 30 29 30 29 29 29 30 30
+1504=29 30 29 30 30 30 29 29 30 29 30 29
+1505=30 29 30 29 30 30 29 30 29 30 30 29
+1506=29 30 29 29 30 30 29 30 30 29 30 30
+1507=29 29 30 29 29 30 30 29 30 29 30 30
+1508=30 29 29 30 29 30 29 29 30 29 30 30
+1509=30 29 30 29 30 29 30 29 29 30 29 30
+1510=30 29 30 30 29 30 29 30 29 29 30 29
+1511=30 29 30 30 29 30 30 29 30 29 29 30
+1512=29 30 29 30 29 30 30 30 29 30 29 30
+1513=29 29 29 30 29 30 30 30 29 30 30 29
+1514=30 29 29 29 30 29 30 30 29 30 30 30
+1515=29 29 30 29 29 30 29 30 30 29 30 30
+1516=29 30 29 30 29 29 30 29 30 29 30 30
+1517=29 30 29 30 29 30 30 29 29 30 29 30
+1518=29 30 29 30 30 29 30 30 29 30 29 29
+1519=30 29 29 30 30 30 29 30 30 29 30 29
+1520=29 30 29 29 30 30 30 29 30 30 29 30
+1521=29 29 29 30 29 30 30 29 30 30 29 30
+1522=30 29 29 29 30 29 30 30 29 30 30 29
+1523=30 29 30 29 30 29 30 29 29 30 30 29
+1524=30 30 29 30 29 30 29 30 29 29 30 29
+1525=30 30 29 30 30 29 30 29 30 29 29 30
+1526=29 30 29 30 30 30 29 30 29 30 29 29
+1527=30 29 30 29 30 30 29 30 30 29 30 29
+1528=30 29 29 30 29 30 29 30 30 29 30 30
+1529=29 30 29 29 30 29 30 29 30 29 30 30
+1530=29 30 30 29 29 30 29 30 29 29 30 30
+1531=29 30 30 30 29 29 30 29 30 29 29 30
+1532=29 30 30 30 29 30 30 29 29 29 30 29
+1533=30 29 30 30 30 29 30 29 30 29 29 30
+1534=29 30 29 30 30 29 30 30 29 29 30 29
+1535=30 29 30 29 30 29 30 30 29 30 29 30
+1536=29 30 29 30 29 30 29 30 29 30 29 30
+1537=30 29 30 30 29 29 30 29 29 30 29 30
+1538=30 30 29 30 30 29 29 30 29 29 30 29
+1539=30 30 30 29 30 30 29 29 30 29 29 30
+1540=29 30 30 29 30 30 29 30 29 29 30 29
+1541=30 29 30 29 30 30 30 29 30 29 29 30
+1542=29 30 29 30 29 30 30 29 30 29 30 30
+1543=29 30 29 29 30 29 30 29 30 29 30 30
+1544=30 29 30 29 29 30 29 30 29 30 29 30
+1545=30 30 29 30 29 29 30 29 30 29 29 30
+1546=30 30 29 30 29 30 29 30 29 30 29 29
+1547=30 30 29 30 30 29 30 29 30 29 30 29
+1548=30 29 29 30 30 29 30 30 29 30 29 30
+1549=29 30 29 29 30 29 30 30 30 29 30 29
+1550=30 29 30 29 29 29 30 30 30 29 30 30
+1551=29 30 29 29 30 29 29 30 30 29 30 30
+1552=30 29 30 29 29 30 29 29 30 30 29 30
+1553=30 29 30 29 30 29 30 29 30 29 30 29
+1554=30 29 30 29 30 30 29 30 29 30 29 30
+1555=29 29 30 29 30 30 29 30 30 29 30 29
+1556=30 29 29 30 29 30 29 30 30 30 29 30
+1557=29 30 29 29 29 30 29 30 30 30 30 29
+1558=30 29 30 29 29 29 30 29 30 30 30 29
+1559=30 30 29 29 30 29 29 30 30 29 30 29
+1560=30 30 29 30 29 30 29 30 29 30 29 30
+1561=29 30 30 29 30 29 30 30 29 29 30 29
+1562=29 30 30 29 30 29 30 30 30 29 29 30
+1563=29 30 29 29 30 29 30 30 30 29 30 29
+1564=30 29 30 29 29 30 29 30 30 30 29 30
+1565=29 30 29 30 29 29 30 29 30 30 29 30
+1566=30 29 30 29 30 29 29 30 29 30 29 30
+1567=30 29 30 30 29 30 29 30 29 29 30 29
+1568=30 29 30 30 30 29 30 29 30 29 29 29
+1569=30 29 30 30 30 29 30 30 29 30 29 29
+1570=29 30 29 30 30 29 30 30 30 29 29 30
+1571=29 29 30 29 30 30 29 30 30 29 30 29
+1572=30 29 29 30 29 30 29 30 30 29 30 29
+1573=30 29 30 30 29 30 29 29 30 29 30 29
+1574=30 30 29 30 30 29 30 29 29 30 29 29
+1575=30 30 30 29 30 30 29 30 29 29 29 30
+1576=29 30 30 29 30 30 30 29 30 29 29 29
+1577=30 29 30 30 29 30 30 29 30 29 30 29
+1578=29 30 29 30 29 30 30 29 30 30 29 30
+1579=29 30 29 30 29 29 30 30 29 30 29 30
+1580=29 30 30 29 30 29 29 30 29 30 29 30
+1581=30 30 29 30 29 30 29 29 30 29 30 29
+1582=30 30 29 30 30 29 30 29 30 29 29 29
+1583=30 30 29 30 30 30 29 30 29 30 29 29
+1584=29 30 30 29 30 30 29 30 30 29 30 29
+1585=29 30 29 30 29 30 29 30 30 29 30 30
+1586=29 29 30 29 30 29 29 30 30 30 29 30
+1587=29 30 30 29 29 29 30 29 30 29 30 30
+1588=30 29 30 30 29 29 29 30 29 30 29 30
+1589=30 29 30 30 29 30 29 29 30 29 30 29
+1590=30 29 30 30 30 29 29 30 29 30 29 30
+1591=29 30 29 30 30 29 30 29 30 29 30 29
+1592=30 29 30 29 30 29 30 29 30 30 30 29
+1593=30 29 29 30 29 29 30 29 30 30 30 29
+1594=30 30 29 29 30 29 29 29 30 30 30 30
+1595=29 30 29 30 29 29 30 29 29 30 30 30
+1596=29 30 30 29 30 29 29 30 29 30 29 30
+1597=29 30 30 29 30 29 30 29 30 29 30 29
+1598=30 29 30 29 30 30 29 30 29 30 30 29
+1599=29 30 29 30 29 30 29 30 30 30 29 30
+1600=29 29 30 29 30 29 29 30 30 30 29 30
--- a/jdk/src/share/native/java/io/io_util.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/native/java/io/io_util.c	Tue Aug 06 16:54:56 2013 -0700
@@ -211,7 +211,11 @@
 
     n = getLastErrorString(buf, sizeof(buf));
     if (n > 0) {
+#ifdef WIN32
+        why = (*env)->NewStringUTF(env, buf);
+#else
         why = JNU_NewStringPlatform(env, buf);
+#endif
     }
     x = JNU_NewObjectByName(env,
                             "java/io/FileNotFoundException",
--- a/jdk/src/share/native/java/net/net_util.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/native/java/net/net_util.c	Tue Aug 06 16:54:56 2013 -0700
@@ -75,7 +75,7 @@
 
 static int initialized = 0;
 
-void init(JNIEnv *env) {
+static void initInetAddrs(JNIEnv *env) {
     if (!initialized) {
         Java_java_net_InetAddress_init(env, 0);
         Java_java_net_Inet4Address_init(env, 0);
@@ -96,42 +96,43 @@
 
 void setInetAddress_addr(JNIEnv *env, jobject iaObj, int address) {
     jobject holder;
-    init(env);
+    initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     (*env)->SetIntField(env, holder, iac_addressID, address);
 }
 
 void setInetAddress_family(JNIEnv *env, jobject iaObj, int family) {
     jobject holder;
-    init(env);
+    initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     (*env)->SetIntField(env, holder, iac_familyID, family);
 }
 
 void setInetAddress_hostName(JNIEnv *env, jobject iaObj, jobject host) {
     jobject holder;
-    init(env);
+    initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     (*env)->SetObjectField(env, holder, iac_hostNameID, host);
 }
 
 int getInetAddress_addr(JNIEnv *env, jobject iaObj) {
     jobject holder;
-    init(env);
+    initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     return (*env)->GetIntField(env, holder, iac_addressID);
 }
 
 int getInetAddress_family(JNIEnv *env, jobject iaObj) {
     jobject holder;
-    init(env);
+
+    initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     return (*env)->GetIntField(env, holder, iac_familyID);
 }
 
 jobject getInetAddress_hostName(JNIEnv *env, jobject iaObj) {
     jobject holder;
-    init(env);
+    initInetAddrs(env);
     holder = (*env)->GetObjectField(env, iaObj, ia_holderID);
     return (*env)->GetObjectField(env, holder, iac_hostNameID);
 }
@@ -139,7 +140,7 @@
 JNIEXPORT jobject JNICALL
 NET_SockaddrToInetAddress(JNIEnv *env, struct sockaddr *him, int *port) {
     jobject iaObj;
-    init(env);
+    initInetAddrs(env);
 #ifdef AF_INET6
     if (him->sa_family == AF_INET6) {
         jbyteArray ipaddress;
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c	Tue Aug 06 16:54:56 2013 -0700
@@ -106,7 +106,7 @@
 /******************** StreamBuffer definition ************************/
 
 typedef struct streamBufferStruct {
-    jobject stream;            // ImageInputStream or ImageOutputStream
+    jweak ioRef;               // weak reference to a provider of I/O routines
     jbyteArray hstreamBuffer;  // Handle to a Java buffer for the stream
     JOCTET *buf;               // Pinned buffer pointer */
     size_t bufferOffset;          // holds offset between unpin and the next pin
@@ -125,6 +125,15 @@
  */
 #define STREAMBUF_SIZE 4096
 
+#define GET_IO_REF(io_name)                                            \
+    do {                                                               \
+        if ((*env)->IsSameObject(env, sb->ioRef, NULL) ||              \
+            ((io_name) = (*env)->NewLocalRef(env, sb->ioRef)) == NULL) \
+        {                                                              \
+            cinfo->err->error_exit((j_common_ptr) cinfo);              \
+        }                                                              \
+    } while (0)                                                        \
+
 /*
  * Used to signal that no data need be restored from an unpin to a pin.
  * I.e. the buffer is empty.
@@ -159,7 +168,7 @@
     }
 
 
-    sb->stream = NULL;
+    sb->ioRef = NULL;
 
     sb->buf = NULL;
 
@@ -191,9 +200,9 @@
  * All other state is reset.
  */
 static void resetStreamBuffer(JNIEnv *env, streamBufferPtr sb) {
-    if (sb->stream != NULL) {
-        (*env)->DeleteGlobalRef(env, sb->stream);
-        sb->stream = NULL;
+    if (sb->ioRef != NULL) {
+        (*env)->DeleteWeakGlobalRef(env, sb->ioRef);
+        sb->ioRef = NULL;
     }
     unpinStreamBuffer(env, sb, NULL);
     sb->bufferOffset = NO_DATA;
@@ -571,7 +580,7 @@
 static void imageio_set_stream(JNIEnv *env,
                                j_common_ptr cinfo,
                                imageIODataPtr data,
-                               jobject stream){
+                               jobject io){
     streamBufferPtr sb;
     sun_jpeg_error_ptr jerr;
 
@@ -579,13 +588,13 @@
 
     resetStreamBuffer(env, sb);  // Removes any old stream
 
-    /* Now we need a new global reference for the stream */
-    if (stream != NULL) { // Fix for 4411955
-        sb->stream = (*env)->NewGlobalRef(env, stream);
-        if (sb->stream == NULL) {
+    /* Now we need a new weak global reference for the I/O provider */
+    if (io != NULL) { // Fix for 4411955
+        sb->ioRef = (*env)->NewWeakGlobalRef(env, io);
+        if (sb->ioRef == NULL) {
             JNU_ThrowByName(env,
                             "java/lang/OutOfMemoryError",
-                            "Setting Stream");
+                            "Setting I/O provider");
             return;
         }
     }
@@ -895,6 +904,7 @@
     streamBufferPtr sb = &data->streamBuf;
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
     int ret;
+    jobject input = NULL;
 
     /* This is where input suspends */
     if (sb->suspendable) {
@@ -920,9 +930,11 @@
      * Now fill a complete buffer, or as much of one as the stream
      * will give us if we are near the end.
      */
+    GET_IO_REF(input);
+
     RELEASE_ARRAYS(env, data, src->next_input_byte);
     ret = (*env)->CallIntMethod(env,
-                                sb->stream,
+                                input,
                                 JPEGImageReader_readInputDataID,
                                 sb->hstreamBuffer, 0,
                                 sb->bufferLength);
@@ -982,6 +994,7 @@
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
     jint ret;
     size_t offset, buflen;
+    jobject input = NULL;
 
     /*
      * The original (jpegdecoder.c) had code here that called
@@ -1003,6 +1016,9 @@
     if (src->next_input_byte > sb->buf) {
         memcpy(sb->buf, src->next_input_byte, offset);
     }
+
+    GET_IO_REF(input);
+
     RELEASE_ARRAYS(env, data, src->next_input_byte);
     buflen = sb->bufferLength - offset;
     if (buflen <= 0) {
@@ -1012,7 +1028,7 @@
         return;
     }
 
-    ret = (*env)->CallIntMethod(env, sb->stream,
+    ret = (*env)->CallIntMethod(env, input,
                                 JPEGImageReader_readInputDataID,
                                 sb->hstreamBuffer,
                                 offset, buflen);
@@ -1075,6 +1091,7 @@
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
     jlong ret;
     jobject reader;
+    jobject input = NULL;
 
     if (num_bytes < 0) {
         return;
@@ -1104,9 +1121,11 @@
         return;
     }
 
+    GET_IO_REF(input);
+
     RELEASE_ARRAYS(env, data, src->next_input_byte);
     ret = (*env)->CallLongMethod(env,
-                                 sb->stream,
+                                 input,
                                  JPEGImageReader_skipInputBytesID,
                                  (jlong) num_bytes);
     if ((*env)->ExceptionOccurred(env)
@@ -2285,11 +2304,14 @@
     imageIODataPtr data = (imageIODataPtr) cinfo->client_data;
     streamBufferPtr sb = &data->streamBuf;
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+    jobject output = NULL;
+
+    GET_IO_REF(output);
 
     RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
 
     (*env)->CallVoidMethod(env,
-                           sb->stream,
+                           output,
                            JPEGImageWriter_writeOutputDataID,
                            sb->hstreamBuffer,
                            0,
@@ -2322,11 +2344,16 @@
     /* find out how much needs to be written */
     /* this conversion from size_t to jint is safe, because the lenght of the buffer is limited by jint */
     jint datacount = (jint)(sb->bufferLength - dest->free_in_buffer);
+
     if (datacount != 0) {
+        jobject output = NULL;
+
+        GET_IO_REF(output);
+
         RELEASE_ARRAYS(env, data, (const JOCTET *)(dest->next_output_byte));
 
         (*env)->CallVoidMethod(env,
-                               sb->stream,
+                               output,
                                JPEGImageWriter_writeOutputDataID,
                                sb->hstreamBuffer,
                                0,
--- a/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/native/sun/awt/medialib/awt_ImagingLib.c	Tue Aug 06 16:54:56 2013 -0700
@@ -2606,38 +2606,37 @@
 
 #define ERR_BAD_IMAGE_LAYOUT (-2)
 
-#define CHECK_DST_ARRAY(start_offset, elements_per_pixel)             \
-    do {                                                              \
-        int offset = (start_offset);                                  \
-        int lastScanOffset;                                           \
-                                                                      \
-        if (!SAFE_TO_MULT(rasterP->scanlineStride,                    \
-                          (rasterP->height - 1)))                     \
-        {                                                             \
-            return ERR_BAD_IMAGE_LAYOUT;                              \
-        }                                                             \
-        lastScanOffset = rasterP->scanlineStride *                    \
-            (rasterP->height - 1);                                    \
-                                                                      \
-        if (!SAFE_TO_ADD(offset, lastScanOffset)) {                   \
-            return ERR_BAD_IMAGE_LAYOUT;                              \
-        }                                                             \
-        lastScanOffset += offset;                                     \
-                                                                      \
-        if (!SAFE_TO_MULT((elements_per_pixel), rasterP->width)) {    \
-            return ERR_BAD_IMAGE_LAYOUT;                              \
-        }                                                             \
-        offset = (elements_per_pixel) * rasterP->width;               \
-                                                                      \
-        if (!SAFE_TO_ADD(offset, lastScanOffset)) {                   \
-            return ERR_BAD_IMAGE_LAYOUT;                              \
-        }                                                             \
-        lastScanOffset += offset;                                     \
-                                                                      \
-        if (dataArrayLength < lastScanOffset) {                       \
-            return ERR_BAD_IMAGE_LAYOUT;                              \
-        }                                                             \
-    } while(0);                                                       \
+#define CHECK_DST_ARRAY(start_offset, elements_per_scan, elements_per_pixel) \
+    do {                                                                     \
+        int offset = (start_offset);                                         \
+        int lastScanOffset;                                                  \
+                                                                             \
+        if (!SAFE_TO_MULT((elements_per_scan),                               \
+                          (rasterP->height - 1)))                            \
+        {                                                                    \
+            return ERR_BAD_IMAGE_LAYOUT;                                     \
+        }                                                                    \
+        lastScanOffset = (elements_per_scan) * (rasterP->height - 1);        \
+                                                                             \
+        if (!SAFE_TO_ADD(offset, lastScanOffset)) {                          \
+            return ERR_BAD_IMAGE_LAYOUT;                                     \
+        }                                                                    \
+        lastScanOffset += offset;                                            \
+                                                                             \
+        if (!SAFE_TO_MULT((elements_per_pixel), rasterP->width)) {           \
+            return ERR_BAD_IMAGE_LAYOUT;                                     \
+        }                                                                    \
+        offset = (elements_per_pixel) * rasterP->width;                      \
+                                                                             \
+        if (!SAFE_TO_ADD(offset, lastScanOffset)) {                          \
+            return ERR_BAD_IMAGE_LAYOUT;                                     \
+        }                                                                    \
+        lastScanOffset += offset;                                            \
+                                                                             \
+        if (dataArrayLength < lastScanOffset) {                              \
+            return ERR_BAD_IMAGE_LAYOUT;                                     \
+        }                                                                    \
+    } while(0);                                                              \
 
 static int
 storeImageArray(JNIEnv *env, BufImageS_t *srcP, BufImageS_t *dstP,
@@ -2665,39 +2664,33 @@
 
     if (hintP->packing == BYTE_INTERLEAVED) {
         /* Write it back to the destination */
-        CHECK_DST_ARRAY(hintP->channelOffset, hintP->numChans);
+        if (rasterP->dataType != BYTE_DATA_TYPE) {
+            /* We are working with a raster which was marked
+               as a byte interleaved due to performance reasons.
+               So, we have to convert the length of the data
+               array to bytes as well.
+            */
+            if (!SAFE_TO_MULT(rasterP->dataSize, dataArrayLength)) {
+                return ERR_BAD_IMAGE_LAYOUT;
+            }
+            dataArrayLength *= rasterP->dataSize;
+        }
+
+        CHECK_DST_ARRAY(hintP->dataOffset, hintP->sStride, hintP->numChans);
         cmDataP = (unsigned char *) mlib_ImageGetData(mlibImP);
         mStride = mlib_ImageGetStride(mlibImP);
         dataP = (unsigned char *)(*env)->GetPrimitiveArrayCritical(env,
                                                       rasterP->jdata, NULL);
         if (dataP == NULL) return 0;
-        cDataP = dataP + hintP->channelOffset;
+        cDataP = dataP + hintP->dataOffset;
         for (y=0; y < rasterP->height;
-             y++, cmDataP += mStride, cDataP += rasterP->scanlineStride)
+             y++, cmDataP += mStride, cDataP += hintP->sStride)
         {
             memcpy(cDataP, cmDataP, rasterP->width*hintP->numChans);
         }
         (*env)->ReleasePrimitiveArrayCritical(env, rasterP->jdata, dataP,
                                               JNI_ABORT);
     }
-    else if (hintP->packing == SHORT_INTERLEAVED) {
-        /* Write it back to the destination */
-        unsigned short *sdataP, *sDataP;
-        unsigned short *smDataP = (unsigned short *)mlib_ImageGetData(mlibImP);
-        CHECK_DST_ARRAY(hintP->channelOffset, hintP->numChans);
-        mStride = mlib_ImageGetStride(mlibImP);
-        sdataP = (unsigned short *)(*env)->GetPrimitiveArrayCritical(env,
-                                                      rasterP->jdata, NULL);
-        if (sdataP == NULL) return -1;
-        sDataP = sdataP + hintP->channelOffset;
-        for (y=0; y < rasterP->height;
-            y++, smDataP += mStride, sDataP += rasterP->scanlineStride)
-        {
-            memcpy(sDataP, smDataP, rasterP->width*hintP->numChans);
-        }
-        (*env)->ReleasePrimitiveArrayCritical(env, rasterP->jdata, sdataP,
-                                              JNI_ABORT);
-    }
     else if (dstP->cmodel.cmType == DIRECT_CM_TYPE) {
         /* Just need to move bits */
         if (mlibImP->type == MLIB_BYTE) {
@@ -3499,7 +3492,7 @@
     }
 
     dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
-    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
+    CHECK_DST_ARRAY(rasterP->chanOffsets[0], rasterP->scanlineStride, 1);
 
     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
     if (outDataP == NULL) {
@@ -3575,7 +3568,7 @@
     }
 
     dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
-    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
+    CHECK_DST_ARRAY(rasterP->chanOffsets[0], rasterP->scanlineStride, 1);
 
     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
     if (outDataP == NULL) {
@@ -3651,7 +3644,7 @@
     }
 
     dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
-    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
+    CHECK_DST_ARRAY(rasterP->chanOffsets[0], rasterP->scanlineStride, 1);
 
     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
     if (outDataP == NULL) {
@@ -3730,7 +3723,7 @@
     }
 
     dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
-    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
+    CHECK_DST_ARRAY(rasterP->chanOffsets[0], rasterP->scanlineStride, 1);
 
     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
     if (outDataP == NULL) {
@@ -3827,7 +3820,7 @@
         return -1;
     }
     dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
-    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
+    CHECK_DST_ARRAY(rasterP->chanOffsets[0], rasterP->scanlineStride, 1);
 
     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
     if (outDataP == NULL) {
@@ -3925,7 +3918,7 @@
     }
 
     dataArrayLength = (*env)->GetArrayLength(env, jOutDataP);
-    CHECK_DST_ARRAY(rasterP->chanOffsets[0], 1);
+    CHECK_DST_ARRAY(rasterP->chanOffsets[0], rasterP->scanlineStride, 1);
 
     outDataP = (*env)->GetPrimitiveArrayCritical(env, jOutDataP, 0);
     if (outDataP == NULL) {
--- a/jdk/src/share/native/sun/font/layout/CanonShaping.cpp	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/share/native/sun/font/layout/CanonShaping.cpp	Tue Aug 06 16:54:56 2013 -0700
@@ -66,6 +66,16 @@
     le_int32 *indices = LE_NEW_ARRAY(le_int32, charCount);
     le_int32 i;
 
+    if (combiningClasses == NULL || indices == NULL) {
+        if (combiningClasses != NULL) {
+            LE_DELETE_ARRAY(combiningClasses);
+        }
+        if (indices != NULL) {
+            LE_DELETE_ARRAY(indices);
+        }
+        return;
+    }
+
     for (i = 0; i < charCount; i += 1) {
       combiningClasses[i] = classTable->getGlyphClass(classTable, (LEGlyphID) inChars[i], success);
         indices[i] = i;
--- a/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/solaris/classes/sun/print/IPPPrintService.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1099,6 +1099,15 @@
 
         if (category == PrinterName.class) {
             return (T)(new PrinterName(printer, null));
+        } else if (category == PrinterInfo.class) {
+            PrinterInfo pInfo = new PrinterInfo(printer, null);
+            AttributeClass ac = (getAttMap != null) ?
+                (AttributeClass)getAttMap.get(pInfo.getName())
+                : null;
+            if (ac != null) {
+                return (T)(new PrinterInfo(ac.getStringValue(), null));
+            }
+            return (T)pInfo;
         } else if (category == QueuedJobCount.class) {
             QueuedJobCount qjc = new QueuedJobCount(0);
             AttributeClass ac = (getAttMap != null) ?
@@ -1566,7 +1575,24 @@
         }
     }
 
+    String getDest() {
+        return printer;
+    }
+
     public String getName() {
+        /*
+         * Mac is using printer-info IPP attribute for its human-readable printer
+         * name and is also the identifier used in NSPrintInfo:setPrinter.
+         */
+        if (UnixPrintServiceLookup.isMac()) {
+            PrintServiceAttributeSet psaSet = this.getAttributes();
+            if (psaSet != null) {
+                PrinterInfo pName = (PrinterInfo)psaSet.get(PrinterInfo.class);
+                if (pName != null) {
+                    return pName.toString();
+                }
+            }
+        }
         return printer;
     }
 
--- a/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintJob.java	Tue Aug 06 16:54:56 2013 -0700
@@ -65,6 +65,7 @@
 import javax.print.attribute.PrintJobAttributeSet;
 import javax.print.attribute.PrintRequestAttribute;
 import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.PrintServiceAttributeSet;
 import javax.print.attribute.standard.Copies;
 import javax.print.attribute.standard.Destination;
 import javax.print.attribute.standard.DocumentName;
@@ -76,6 +77,7 @@
 import javax.print.attribute.standard.MediaSize;
 import javax.print.attribute.standard.MediaSizeName;
 import javax.print.attribute.standard.OrientationRequested;
+import javax.print.attribute.standard.PrinterName;
 import javax.print.attribute.standard.RequestingUserName;
 import javax.print.attribute.standard.NumberUp;
 import javax.print.attribute.standard.Sides;
@@ -120,6 +122,9 @@
     UnixPrintJob(PrintService service) {
         this.service = service;
         mDestination = service.getName();
+        if (UnixPrintServiceLookup.isMac()) {
+            mDestination = ((IPPPrintService)service).getDest();
+        }
         mDestType = UnixPrintJob.DESTPRINTER;
     }
 
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c	Tue Aug 06 16:54:56 2013 -0700
@@ -926,6 +926,11 @@
     *shmExt = canUseShmExt = CANT_USE_MITSHM;
     *shmPixmaps = canUseShmExtPixmaps = CANT_USE_MITSHM;
 
+    if (awt_display == (Display *)NULL) {
+        AWT_NOFLUSH_UNLOCK();
+        return;
+    }
+
     /**
      * XShmQueryExtension returns False in remote server case.
      * Unfortunately it also returns True in ssh case, so
--- a/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/solaris/native/sun/java2d/x11/XRBackendNative.c	Tue Aug 06 16:54:56 2013 -0700
@@ -112,6 +112,25 @@
 #define PKGINFO_LINE_LEN_MAX 256
 #define PKGINFO_LINE_CNT_MAX 50
 
+/*
+ * X protocol uses (u_int16)length to specify the length in 4 bytes quantities
+ * of the whole request.  Both XRenderFillRectangles() and XFillRectangles()
+ * have provisions to fragment into several requests if the number of rectangles
+ * plus the current x request does not fit into 65535*4 bytes.  While
+ * XRenderCreateLinearGradient() and XRenderCreateRadialGradient() have
+ * provisions to gracefully degrade if the resulting request would exceed
+ * 65535*4 bytes.
+ *
+ * Below, we define a cap of 65535*4 bytes for the maximum X request payload
+ * allowed for Non-(XRenderFillRectangles() or XFillRectangles()) API calls,
+ * just to be conservative.  This is offset by the size of our maximum x*Req
+ * type in this compilation unit, which is xRenderCreateRadiaGradientReq.
+ *
+ * Note that sizeof(xRenderCreateRadiaGradientReq) = 36
+ */
+#define MAX_PAYLOAD (262140u - 36u)
+#define MAXUINT (0xffffffffu)
+
 static jboolean IsXRenderAvailable(jboolean verbose) {
 
     void *xrenderlib;
@@ -267,13 +286,19 @@
     char *maskData;
     XImage* defaultImg;
     jfieldID maskImgID;
-    jlong fmt8 =
-        ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardA8));
-    jlong fmt32 =
-       ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardARGB32));
+    jlong fmt8;
+    jlong fmt32;
+
     jfieldID a8ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_A8", "J");
     jfieldID argb32ID = (*env)->GetStaticFieldID(env, cls, "FMTPTR_ARGB32", "J");
 
+    if (awt_display == (Display *)NULL) {
+        return;
+    }
+
+    fmt8 = ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardA8));
+    fmt32 = ptr_to_jlong(XRenderFindStandardFormat(awt_display, PictStandardARGB32));
+
     (*env)->SetStaticLongField(env, cls, a8ID, fmt8);
     (*env)->SetStaticLongField(env, cls, argb32ID, fmt32);
 
@@ -404,6 +429,10 @@
     if (rectCnt <= 256) {
         xRects = &sRects[0];
     } else {
+        if (MAXUINT / sizeof(XRectangle) < (unsigned)rectCnt) {
+            /* rectCnt too big, integer overflow */
+            return;
+        }
         xRects = (XRectangle *) malloc(sizeof(XRectangle) * rectCnt);
         if (xRects == NULL) {
             return;
@@ -460,6 +489,12 @@
    XFixed *stops;
    XLinearGradient grad;
 
+   if (MAX_PAYLOAD / (sizeof(XRenderColor) + sizeof(XFixed))
+       < (unsigned)numStops) {
+       /* numStops too big, payload overflow */
+       return -1;
+   }
+
    if ((pixels = (jshort *)
         (*env)->GetPrimitiveArrayCritical(env, pixelsArray, NULL)) == NULL) {
        return -1;
@@ -480,6 +515,18 @@
     colors = (XRenderColor *) malloc(numStops * sizeof(XRenderColor));
     stops =  (XFixed *) malloc(numStops * sizeof(XFixed));
 
+    if (colors == NULL || stops == NULL) {
+        if (colors != NULL) {
+            free(colors);
+        }
+        if (stops != NULL) {
+            free(stops);
+        }
+        (*env)->ReleasePrimitiveArrayCritical(env, pixelsArray, pixels, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, fractions, JNI_ABORT);
+        return -1;
+    }
+
     for (i=0; i < numStops; i++) {
       stops[i] = XDoubleToFixed(fractions[i]);
       colors[i].alpha = pixels[i*4 + 0];
@@ -527,6 +574,11 @@
    XFixed *stops;
    XRadialGradient grad;
 
+   if (MAX_PAYLOAD / (sizeof(XRenderColor) + sizeof(XFixed))
+       < (unsigned)numStops) {
+       /* numStops too big, payload overflow */
+       return -1;
+   }
 
    if ((pixels =
        (jshort *)(*env)->GetPrimitiveArrayCritical(env, pixelsArray, NULL)) == NULL) {
@@ -550,6 +602,18 @@
     colors = (XRenderColor *) malloc(numStops * sizeof(XRenderColor));
     stops =  (XFixed *) malloc(numStops * sizeof(XFixed));
 
+    if (colors == NULL || stops == NULL) {
+        if (colors != NULL) {
+            free(colors);
+        }
+        if (stops != NULL) {
+            free(stops);
+        }
+        (*env)->ReleasePrimitiveArrayCritical(env, pixelsArray, pixels, JNI_ABORT);
+        (*env)->ReleasePrimitiveArrayCritical(env, fractionsArray, fractions, JNI_ABORT);
+        return -1;
+    }
+
     for (i=0; i < numStops; i++) {
       stops[i] = XDoubleToFixed(fractions[i]);
       colors[i].alpha = pixels[i*4 + 0];
@@ -708,6 +772,12 @@
     unsigned char *pixelData;
     int i;
 
+    if (MAX_PAYLOAD / (sizeof(XGlyphInfo) + sizeof(Glyph))
+        < (unsigned)glyphCnt) {
+        /* glyphCnt too big, payload overflow */
+        return;
+    }
+
     XGlyphInfo *xginfo = (XGlyphInfo *) malloc(sizeof(XGlyphInfo) * glyphCnt);
     Glyph *gid = (Glyph *) malloc(sizeof(Glyph) * glyphCnt);
 
@@ -770,6 +840,11 @@
 Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative
  (JNIEnv *env, jclass cls, jint glyphSet, jintArray gidArray, jint glyphCnt) {
 
+    if (MAX_PAYLOAD / sizeof(Glyph) < (unsigned)glyphCnt) {
+        /* glyphCnt too big, payload overflow */
+        return;
+    }
+
     /* The glyph ids are 32 bit but may be stored in a 64 bit long on
      * a 64 bit architecture. So optimise the 32 bit case to avoid
      * extra stack or heap allocations by directly referencing the
@@ -840,6 +915,15 @@
     unsigned int sids[256];
     int charCnt = 0;
 
+    if ((MAX_PAYLOAD / sizeof(XGlyphElt32) < (unsigned)eltCnt)
+        || (MAX_PAYLOAD / sizeof(unsigned int) < (unsigned)glyphCnt)
+        || ((MAX_PAYLOAD - sizeof(XGlyphElt32)*(unsigned)eltCnt) /
+            sizeof(unsigned int) < (unsigned)glyphCnt))
+    {
+        /* (eltCnt, glyphCnt) too big, payload overflow */
+        return;
+    }
+
     if (eltCnt <= 24) {
       xelts = &selts[0];
     }else {
@@ -938,6 +1022,11 @@
     if (rectCnt <= 256) {
       xRects = &sRects[0];
     } else {
+      if (MAXUINT / sizeof(XRectangle) < (unsigned)rectCnt) {
+        /* rectCnt too big, integer overflow */
+        return;
+      }
+
       xRects = (XRectangle *) malloc(sizeof(XRectangle) * rectCnt);
       if (xRects == NULL) {
         return;
--- a/jdk/src/windows/classes/sun/print/Win32PrintService.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/windows/classes/sun/print/Win32PrintService.java	Tue Aug 06 16:54:56 2013 -0700
@@ -445,7 +445,7 @@
 
         initMedia();
 
-        if ((mediaSizeNames == null) && (mediaSizeNames.length == 0)) {
+        if ((mediaSizeNames == null) || (mediaSizeNames.length == 0)) {
             return null;
         }
 
--- a/jdk/src/windows/native/java/io/io_util_md.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/windows/native/java/io/io_util_md.c	Tue Aug 06 16:54:56 2013 -0700
@@ -29,6 +29,7 @@
 #include "io_util.h"
 #include "io_util_md.h"
 #include <stdio.h>
+#include <windows.h>
 
 #include <wchar.h>
 #include <io.h>
@@ -40,6 +41,7 @@
 #include <limits.h>
 #include <wincon.h>
 
+
 static DWORD MAX_INPUT_EVENTS = 2000;
 
 /* If this returns NULL then an exception is pending */
@@ -569,42 +571,75 @@
 }
 
 size_t
-getLastErrorString(char *buf, size_t len)
+getLastErrorString(char *utf8_jvmErrorMsg, size_t cbErrorMsg)
 {
-    DWORD errval;
-    if (len > 0) {
-        if ((errval = GetLastError()) != 0) {
-            // DOS error
-            size_t n = (size_t)FormatMessage(
-                FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
-                NULL,
-                errval,
-                0,
-                buf,
-                (DWORD)len,
-                NULL);
-            if (n > 3) {
-                // Drop final '.', CR, LF
-                if (buf[n - 1] == '\n') n--;
-                if (buf[n - 1] == '\r') n--;
-                if (buf[n - 1] == '.') n--;
-                buf[n] = '\0';
+    size_t n = 0;
+    if (cbErrorMsg > 0) {
+        BOOLEAN noError = FALSE;
+        WCHAR *utf16_osErrorMsg = (WCHAR *)malloc(cbErrorMsg*sizeof(WCHAR));
+        if (utf16_osErrorMsg == NULL) {
+            // OOM accident
+            strncpy(utf8_jvmErrorMsg, "Out of memory", cbErrorMsg);
+            // truncate if too long
+            utf8_jvmErrorMsg[cbErrorMsg - 1] = '\0';
+            n = strlen(utf8_jvmErrorMsg);
+        } else {
+            DWORD errval = GetLastError();
+            if (errval != 0) {
+                // WIN32 error
+                n = (size_t)FormatMessageW(
+                    FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
+                    NULL,
+                    errval,
+                    0,
+                    utf16_osErrorMsg,
+                    (DWORD)cbErrorMsg,
+                    NULL);
+                if (n > 3) {
+                    // Drop final '.', CR, LF
+                    if (utf16_osErrorMsg[n - 1] == L'\n') --n;
+                    if (utf16_osErrorMsg[n - 1] == L'\r') --n;
+                    if (utf16_osErrorMsg[n - 1] == L'.') --n;
+                    utf16_osErrorMsg[n] = L'\0';
+                }
+            } else if (errno != 0) {
+                // C runtime error that has no corresponding WIN32 error code
+                const WCHAR *rtError = _wcserror(errno);
+                if (rtError != NULL) {
+                    wcsncpy(utf16_osErrorMsg, rtError, cbErrorMsg);
+                    // truncate if too long
+                    utf16_osErrorMsg[cbErrorMsg - 1] = L'\0';
+                    n = wcslen(utf16_osErrorMsg);
+                }
+            } else
+                noError = TRUE; //OS has no error to report
+
+            if (!noError) {
+                if (n > 0) {
+                    n = WideCharToMultiByte(
+                        CP_UTF8,
+                        0,
+                        utf16_osErrorMsg,
+                        n,
+                        utf8_jvmErrorMsg,
+                        cbErrorMsg,
+                        NULL,
+                        NULL);
+
+                    // no way to die
+                    if (n > 0)
+                        utf8_jvmErrorMsg[min(cbErrorMsg - 1, n)] = '\0';
+                }
+
+                if (n <= 0) {
+                    strncpy(utf8_jvmErrorMsg, "Secondary error while OS message extraction", cbErrorMsg);
+                    // truncate if too long
+                    utf8_jvmErrorMsg[cbErrorMsg - 1] = '\0';
+                    n = strlen(utf8_jvmErrorMsg);
+                }
             }
-            return n;
-        }
-
-        if (errno != 0) {
-            // C runtime error that has no corresponding DOS error code
-            const char *err = strerror(errno);
-            size_t n = strlen(err);
-            if (n >= len)
-                n = len - 1;
-
-            strncpy(buf, err, n);
-            buf[n] = '\0';
-            return n;
+            free(utf16_osErrorMsg);
         }
     }
-
-    return 0;
+    return n;
 }
--- a/jdk/src/windows/native/java/lang/ProcessImpl_md.c	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/src/windows/native/java/lang/ProcessImpl_md.c	Tue Aug 06 16:54:56 2013 -0700
@@ -40,20 +40,70 @@
  */
 #define PIPE_SIZE (4096+24)
 
+/* We have THREE locales in action:
+ * 1. Thread default locale - dictates UNICODE-to-8bit conversion
+ * 2. System locale that defines the message localization
+ * 3. The file name locale
+ * Each locale could be an extended locale, that means that text cannot be
+ * mapped to 8bit sequence without multibyte encoding.
+ * VM is ready for that, if text is UTF-8.
+ * Here we make the work right from the beginning.
+ */
+size_t os_error_message(int errnum, WCHAR* utf16_OSErrorMsg, size_t maxMsgLength) {
+    size_t n = (size_t)FormatMessageW(
+            FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
+            NULL,
+            (DWORD)errnum,
+            0,
+            utf16_OSErrorMsg,
+            (DWORD)maxMsgLength,
+            NULL);
+    if (n > 3) {
+        // Drop final '.', CR, LF
+        if (utf16_OSErrorMsg[n - 1] == L'\n') --n;
+        if (utf16_OSErrorMsg[n - 1] == L'\r') --n;
+        if (utf16_OSErrorMsg[n - 1] == L'.') --n;
+        utf16_OSErrorMsg[n] = L'\0';
+    }
+    return n;
+}
+
+#define MESSAGE_LENGTH (256 + 100)
+#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x))
+
 static void
-win32Error(JNIEnv *env, const char *functionName)
+win32Error(JNIEnv *env, const WCHAR *functionName)
 {
-    static const char * const format = "%s error=%d, %s";
-    static const char * const fallbackFormat = "%s failed, error=%d";
-    char buf[256];
-    char errmsg[sizeof(buf) + 100];
-    const int errnum = GetLastError();
-    const int n = JVM_GetLastErrorString(buf, sizeof(buf));
-    if (n > 0)
-        sprintf(errmsg, format, functionName, errnum, buf);
-    else
-        sprintf(errmsg, fallbackFormat, functionName, errnum);
-    JNU_ThrowIOException(env, errmsg);
+    WCHAR utf16_OSErrorMsg[MESSAGE_LENGTH - 100];
+    WCHAR utf16_javaMessage[MESSAGE_LENGTH];
+    /*Good suggestion about 2-bytes-per-symbol in localized error reports*/
+    char  utf8_javaMessage[MESSAGE_LENGTH*2];
+    const int errnum = (int)GetLastError();
+    int n = os_error_message(errnum, utf16_OSErrorMsg, ARRAY_SIZE(utf16_OSErrorMsg));
+    n = (n > 0)
+        ? swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s error=%d, %s", functionName, errnum, utf16_OSErrorMsg)
+        : swprintf(utf16_javaMessage, MESSAGE_LENGTH, L"%s failed, error=%d", functionName, errnum);
+
+    if (n > 0) /*terminate '\0' is not a part of conversion procedure*/
+        n = WideCharToMultiByte(
+            CP_UTF8,
+            0,
+            utf16_javaMessage,
+            n, /*by creation n <= MESSAGE_LENGTH*/
+            utf8_javaMessage,
+            MESSAGE_LENGTH*2,
+            NULL,
+            NULL);
+
+    /*no way to die*/
+    {
+        const char *errorMessage = "Secondary error while OS message extraction";
+        if (n > 0) {
+            utf8_javaMessage[min(MESSAGE_LENGTH*2 - 1, n)] = '\0';
+            errorMessage = utf8_javaMessage;
+        }
+        JNU_ThrowIOException(env, errorMessage);
+    }
 }
 
 static void
@@ -116,7 +166,7 @@
         handles[0] = (jlong) -1;
     } else {
         if (! CreatePipe(&inRead,  &inWrite,  &sa, PIPE_SIZE)) {
-            win32Error(env, "CreatePipe");
+            win32Error(env, L"CreatePipe");
             goto Catch;
         }
         si.hStdInput = inRead;
@@ -132,7 +182,7 @@
         handles[1] = (jlong) -1;
     } else {
         if (! CreatePipe(&outRead, &outWrite, &sa, PIPE_SIZE)) {
-            win32Error(env, "CreatePipe");
+            win32Error(env, L"CreatePipe");
             goto Catch;
         }
         si.hStdOutput = outWrite;
@@ -151,7 +201,7 @@
         handles[2] = (jlong) -1;
     } else {
         if (! CreatePipe(&errRead, &errWrite, &sa, PIPE_SIZE)) {
-            win32Error(env, "CreatePipe");
+            win32Error(env, L"CreatePipe");
             goto Catch;
         }
         si.hStdError = errWrite;
@@ -174,7 +224,7 @@
                          &si,              /* (in)  startup information */
                          &pi);             /* (out) process information */
     if (!ret) {
-        win32Error(env, "CreateProcess");
+        win32Error(env, L"CreateProcess");
         goto Catch;
     }
 
@@ -210,7 +260,7 @@
 {
     DWORD exit_code;
     if (GetExitCodeProcess((HANDLE) handle, &exit_code) == 0)
-        win32Error(env, "GetExitCodeProcess");
+        win32Error(env, L"GetExitCodeProcess");
     return exit_code;
 }
 
@@ -231,7 +281,7 @@
                                FALSE,    /* Wait for ANY event */
                                INFINITE)  /* Wait forever */
         == WAIT_FAILED)
-        win32Error(env, "WaitForMultipleObjects");
+        win32Error(env, L"WaitForMultipleObjects");
 }
 
 JNIEXPORT void JNICALL
@@ -250,7 +300,7 @@
                                     dwTimeout);  /* Wait for dwTimeout */
 
     if (result == WAIT_FAILED)
-        win32Error(env, "WaitForMultipleObjects");
+        win32Error(env, L"WaitForMultipleObjects");
 }
 
 JNIEXPORT void JNICALL
@@ -263,7 +313,7 @@
 Java_java_lang_ProcessImpl_isProcessAlive(JNIEnv *env, jclass ignored, jlong handle)
 {
     DWORD dwExitStatus;
-    GetExitCodeProcess(handle, &dwExitStatus);
+    GetExitCodeProcess((HANDLE) handle, &dwExitStatus);
     return dwExitStatus == STILL_ACTIVE;
 }
 
--- a/jdk/test/Makefile	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/Makefile	Tue Aug 06 16:54:56 2013 -0700
@@ -362,23 +362,6 @@
   TESTDIRS = demo
 endif
 
-# Agentvm settings (default is false)
-ifndef USE_JTREG_AGENTVM
-  USE_JTREG_AGENTVM=false
-endif
-# With agentvm, you cannot use -javaoptions?
-ifeq ($(USE_JTREG_AGENTVM),true)
-  JTREG_AGENTVM_OPTION = -agentvm
-  EXTRA_JTREG_OPTIONS += $(JTREG_AGENTVM_OPTION) $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%)
-  JTREG_TEST_OPTIONS = $(JAVA_VM_ARGS:%=-vmoption:%)
-else
-  JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
-endif
-
-ifdef CONCURRENCY
-  EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
-endif
-
 # Some tests annoy me and fail frequently
 PROBLEM_LIST=ProblemList.txt
 PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
@@ -414,13 +397,9 @@
 $(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
 endef
 # Running batches of tests with or without agentvm
-define RunAgentvmBatch
-$(ECHO) "Running tests in agentvm mode: $?"
-$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_AGENTVM=true  UNIQUE_DIR=$@ jtreg_tests
-endef
-define RunOthervmBatch
-$(ECHO) "Running tests in othervm mode: $?"
-$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_AGENTVM=false UNIQUE_DIR=$@ jtreg_tests
+define RunBatch
+$(ECHO) "Running tests: $?"
+$(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" UNIQUE_DIR=$@ jtreg_tests
 endef
 define SummaryInfo
 $(ECHO) "########################################################"
@@ -435,76 +414,60 @@
 JDK_DEFAULT_TARGETS =
 JDK_ALL_TARGETS =
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has problems, and doesn't help performance as much as others.
 JDK_ALL_TARGETS += jdk_awt
 jdk_awt: $(call TestDirs, com/sun/awt java/awt sun/awt \
          javax/imageio javax/print sun/pisces)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_beans1
 JDK_DEFAULT_TARGETS += jdk_beans1
 jdk_beans1: $(call TestDirs, \
             java/beans/beancontext java/beans/PropertyChangeSupport \
             java/beans/Introspector java/beans/Performance \
             java/beans/VetoableChangeSupport java/beans/Statement)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_beans2
 jdk_beans2: $(call TestDirs, \
             java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
             java/beans/PropertyEditor)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_beans3
 jdk_beans3: $(call TestDirs, java/beans/XMLEncoder)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
 # All beans tests
 jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
 	@$(SummaryInfo)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_io
 JDK_DEFAULT_TARGETS += jdk_io
 jdk_io: $(call TestDirs, java/io)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_lang
 JDK_DEFAULT_TARGETS += jdk_lang
 jdk_lang: $(call TestDirs, java/lang sun/invoke sun/misc sun/reflect vm)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_jmx
 jdk_jmx: $(call TestDirs, javax/management com/sun/jmx)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_management
 jdk_management: $(call TestDirs, com/sun/management sun/management)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_math
 JDK_DEFAULT_TARGETS += jdk_math
 jdk_math: $(call TestDirs, java/math)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (TestNG)
 JDK_DEFAULT_TARGETS += jdk_time
 jdk_time: $(call TestDirs, java/time)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_other
 JDK_DEFAULT_TARGETS += jdk_other
 jdk_other: $(call TestDirs, \
@@ -522,97 +485,79 @@
           com/sun/corba \
 	  com/sun/tracing \
 	  sun/usagetracker)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_net
 JDK_DEFAULT_TARGETS += jdk_net
 jdk_net: $(call TestDirs, com/sun/net java/net sun/net com/oracle/net)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 jdk_nio: $(call TestDirs, java/nio sun/nio com/oracle/nio)
 	$(call SharedLibraryPermissions,java/nio/channels)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 jdk_sctp: $(call TestDirs, com/sun/nio/sctp)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_rmi
 jdk_rmi: $(call TestDirs, java/rmi sun/rmi javax/rmi/ssl)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_security1
 JDK_DEFAULT_TARGETS += jdk_security1
 jdk_security1: $(call TestDirs, java/security)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_security2
 jdk_security2: $(call TestDirs, javax/crypto javax/xml/crypto com/sun/crypto)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_security3
 jdk_security3: $(call TestDirs, com/sun/security lib/security javax/security \
         sun/security com/sun/org/apache/xml/internal/security \
         com/oracle/security)
 	$(call SharedLibraryPermissions,sun/security)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
 # All security tests
 jdk_security: jdk_security1 jdk_security2 jdk_security3
 	@$(SummaryInfo)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_sound
 jdk_sound: $(call TestDirs, javax/sound)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has problems, and doesn't help performance as much as others.
 JDK_ALL_TARGETS += jdk_swing
 jdk_swing: $(call TestDirs, javax/swing sun/java2d \
            demo/jfc com/sun/java/swing)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_text
 JDK_DEFAULT_TARGETS += jdk_text
 jdk_text: $(call TestDirs, java/text sun/text)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_jdi
 jdk_jdi: $(call TestDirs, com/sun/jdi)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 JDK_ALL_TARGETS += jdk_tools
 jdk_tools: $(call TestDirs, com/sun/tools sun/jvmstat sun/tools tools)
 	$(call SharedLibraryPermissions,tools/launcher)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
-# Stable othervm testruns (minus items from PROBLEM_LIST)
-#   Using agentvm has serious problems with these tests
 ifdef OPENJDK
 jdk_jfr:
 else
 JDK_ALL_TARGETS += jdk_jfr
 jdk_jfr: $(call TestDirs, com/oracle/jfr)
-	$(call RunOthervmBatch)
+	$(call RunBatch)
 endif
 
-# Stable agentvm testruns (minus items from PROBLEM_LIST)
 JDK_ALL_TARGETS += jdk_util
 JDK_DEFAULT_TARGETS += jdk_util
 jdk_util: $(call TestDirs, java/util sun/util)
-	$(call RunAgentvmBatch)
+	$(call RunBatch)
 
 # ------------------------------------------------------------------
 
@@ -638,10 +583,14 @@
 
 # ------------------------------------------------------------------
 
+ifdef CONCURRENCY
+  EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
+endif
+
 # Default JTREG to run (win32 script works for everybody)
 JTREG = $(JT_HOME)/win32/bin/jtreg
-# Add any extra options (agentvm etc.)
-JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
+# run in agentvm mode
+JTREG_BASIC_OPTIONS += -agentvm
 # Only run automatic tests
 JTREG_BASIC_OPTIONS += -a
 # Always turn on assertions
@@ -660,6 +609,13 @@
 # Set the max memory for jtreg control vm
 JTREG_MEMORY_OPTION = -J-Xmx512m
 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
+# Add any extra options
+JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
+# Set other vm and test options
+JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
+# Set the GC options for test vms
+#JTREG_GC_OPTION = -vmoption:-XX:+UseSerialGC
+#JTREG_TEST_OPTIONS += $(JTREG_GC_OPTION)
 # Set the max memory for jtreg target test vms
 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
--- a/jdk/test/ProblemList.txt	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/ProblemList.txt	Tue Aug 06 16:54:56 2013 -0700
@@ -131,12 +131,14 @@
 # 7196801
 java/lang/management/MemoryMXBean/LowMemoryTest2.sh		generic-all
 
-# 8008200
-java/lang/Class/asSubclass/BasicUnit.java                       generic-all
-
 # 8015780
 java/lang/reflect/Method/GenericStringTest.java			generic-all
 
+# 8019845 due to memleak not related to the tested fix
+java/lang/instrument/RedefineBigClass.sh                        linux-x64
+java/lang/instrument/RetransformBigClass.sh                     linux-x64
+
+
 ############################################################################
 
 # jdk_management
@@ -165,6 +167,9 @@
 # 7027502
 demo/jvmti/hprof/MonitorTest.java                               generic-all
 
+# 8021186
+jdk/lambda/vm/DefaultMethodsTest.java                           generic-all 
+
 ############################################################################
 
 # jdk_net
@@ -250,15 +255,12 @@
 
 # jdk_security
 
+# 7157786
+sun/security/pkcs11/ec/TestKeyFactory.java                      generic-all
+
 # 7164518: no PortUnreachableException on Mac
 sun/security/krb5/auto/Unreachable.java                         macosx-all
 
-# 7193793
-sun/security/pkcs11/ec/TestECDH.java				linux-all
-
-# 7198198: the test also fails on SuSE Linux
-sun/security/pkcs11/ec/ReadCertificates.java                    linux-all
-
 # 7147060
 com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java	generic-all
 
@@ -268,9 +270,6 @@
 sun/security/pkcs11/ec/ReadPKCS12.java                          solaris-all
 sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java            solaris-all
 
-# 8005247
-sun/security/pkcs11/ec/TestECDSA.java				solaris-all
-
 # 8009438
 sun/security/pkcs11/Secmod/AddPrivateKey.java			linux-all
 sun/security/pkcs11/Secmod/TrustAnchors.java 			linux-all
@@ -297,9 +296,6 @@
 # 7194428
 sun/security/mscapi/ShortRSAKey1024.sh                          windows-all
 
-# 7144048, performance issue
-sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLEngineImpl/SSLEngineDeadlock.java generic-all
-
 ############################################################################
 
 # jdk_sound
@@ -371,6 +367,9 @@
 # Filed 6772009
 java/util/concurrent/locks/ReentrantLock/CancelledLockLoops.java generic-all
 
+# 8020435
+java/util/concurrent/CompletableFuture/Basic.java                generic-all
+
 # 7041639, Solaris DSA keypair generation bug
 java/util/TimeZone/TimeZoneDatePermissionCheck.sh               solaris-all
 
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanDoubleInvocationTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,25 +25,15 @@
  * @test
  * @bug     7150256
  * @summary Basic Test for the DiagnosticCommandMBean
- * @author  Frederic Parain
+ * @author  Frederic Parain, Shanliang JIANG
  *
- * @run main/othervm -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8125 DcmdMBeanDoubleInvocationTest
+ * @run main/othervm DcmdMBeanDoubleInvocationTest
  */
 
 
-import java.io.IOException;
 import java.lang.management.ManagementFactory;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.management.Descriptor;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
 import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 import javax.management.*;
 import javax.management.remote.*;
 
@@ -52,39 +42,42 @@
     private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
         "com.sun.management:type=DiagnosticCommand";
 
-    public static void main(String[] args) {
-        MBeanServerConnection mbs = null;
-        try {
-            JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8125/jmxrmi");
-            JMXConnector connector = JMXConnectorFactory.connect(url);
-            mbs = connector.getMBeanServerConnection();
-        } catch(Throwable t) {
-            t.printStackTrace();
-        }
-        ObjectName name;
+    public static void main(String[] args) throws Exception {
+        System.out.println("--->JRCMD MBean Test: invocation on \"help VM.version\" ...");
+
+        ObjectName name = new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME);
+        String[] helpArgs = {"-all", "\n", "VM.version"};
+        Object[] dcmdArgs = {helpArgs};
+        String[] signature = {String[].class.getName()};
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
+        JMXConnectorServer cs = null;
+        JMXConnector cc = null;
         try {
-            name = new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME);
-            MBeanInfo info = mbs.getMBeanInfo(name);
-            String[] helpArgs = {"-all", "\n", "VM.version"};
-            Object[] dcmdArgs = {helpArgs};
-            String[] signature = {String[].class.getName()};
-            String result = (String) mbs.invoke(name, "help", dcmdArgs, signature);
+            cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
+            cs.start();
+            JMXServiceURL addr = cs.getAddress();
+            cc = JMXConnectorFactory.connect(addr);
+            MBeanServerConnection mbsc = cc.getMBeanServerConnection();
+
+            String result = (String) mbsc.invoke(name, "help", dcmdArgs, signature);
             System.out.println(result);
-         } catch (RuntimeMBeanException ex) {
+
+            throw new Error("Test failed: Double commands have not been detected");
+        } catch (RuntimeMBeanException ex) {
             if (ex.getCause() instanceof IllegalArgumentException) {
-                System.out.println("Test passed");
-                return;
+                System.out.println("JTest passed: Double commands have been detected");
             } else {
                 ex.printStackTrace();
-                throw new RuntimeException("TEST FAILED");
+                throw new Error("TEST FAILED: got unknown exception "+ex);
             }
-        } catch (InstanceNotFoundException | IntrospectionException
-                | ReflectionException | MalformedObjectNameException
-                | MBeanException|IOException ex) {
-            ex.printStackTrace();
-            throw new RuntimeException("TEST FAILED");
+        } finally {
+            try {
+                cc.close();
+                cs.stop();
+            } catch (Exception e) {
+            }
         }
-        System.out.println("Double commands have not been detected");
-        throw new RuntimeException("TEST FAILED");
     }
 }
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanInvocationTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,25 +25,15 @@
  * @test
  * @bug     7150256
  * @summary Basic Test for the DiagnosticCommandMBean
- * @author  Frederic Parain
+ * @author  Frederic Parain, Shanliang JIANG
  *
- * @run main/othervm -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8129 DcmdMBeanInvocationTest
+ * @run main/othervm DcmdMBeanInvocationTest
  */
 
 
-import java.io.IOException;
 import java.lang.management.ManagementFactory;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.management.Descriptor;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
 import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 import javax.management.*;
 import javax.management.remote.*;
 
@@ -52,30 +42,35 @@
     private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
         "com.sun.management:type=DiagnosticCommand";
 
-    public static void main(String[] args) {
-        MBeanServerConnection mbs = null;
-        try {
-            JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8129/jmxrmi");
-            JMXConnector connector = JMXConnectorFactory.connect(url);
-            mbs = connector.getMBeanServerConnection();
-        } catch(Throwable t) {
-            t.printStackTrace();
-        }
-        ObjectName name;
+    public static void main(String[] args) throws Exception {
+        System.out.println("--->JRCMD MBean Test: invocation on \"help -all\" ...");
+
+        ObjectName name = new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME);
+        String[] helpArgs = {"-all"};
+        Object[] dcmdArgs = {helpArgs};
+        String[] signature = {String[].class.getName()};
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
+        JMXConnectorServer cs = null;
+        JMXConnector cc = null;
         try {
-            name = new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME);
-            MBeanInfo info = mbs.getMBeanInfo(name);
-            String[] helpArgs = {"-all"};
-            Object[] dcmdArgs = {helpArgs};
-            String[] signature = {String[].class.getName()};
-            String result = (String) mbs.invoke(name, "help", dcmdArgs, signature);
+            cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
+            cs.start();
+            JMXServiceURL addr = cs.getAddress();
+            cc = JMXConnectorFactory.connect(addr);
+            MBeanServerConnection mbsc = cc.getMBeanServerConnection();
+
+            String result = (String) mbsc.invoke(name, "help", dcmdArgs, signature);
             System.out.println(result);
-        } catch (InstanceNotFoundException | IntrospectionException
-                | ReflectionException | MalformedObjectNameException
-                | MBeanException|IOException ex) {
-            ex.printStackTrace();
-            throw new RuntimeException("TEST FAILED");
+        } finally {
+            try {
+                cc.close();
+                cs.stop();
+            } catch (Exception e) {
+            }
         }
+
         System.out.println("Test passed");
     }
 }
--- a/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/com/sun/management/DiagnosticCommandMBean/DcmdMBeanTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,25 +25,18 @@
  * @test
  * @bug     7150256
  * @summary Basic Test for the DiagnosticCommandMBean
- * @author  Frederic Parain
+ * @author  Frederic Parain, Shanliang JIANG
  *
- * @run main/othervm -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=8127 DcmdMBeanTest
+ * @run main/othervm DcmdMBeanTest
  */
 
 
-import java.io.IOException;
 import java.lang.management.ManagementFactory;
-import java.util.logging.Level;
-import java.util.logging.Logger;
 import javax.management.Descriptor;
-import javax.management.InstanceNotFoundException;
-import javax.management.IntrospectionException;
 import javax.management.MBeanInfo;
 import javax.management.MBeanOperationInfo;
 import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
-import javax.management.ReflectionException;
 import javax.management.*;
 import javax.management.remote.*;
 
@@ -52,34 +45,42 @@
     private static String HOTSPOT_DIAGNOSTIC_MXBEAN_NAME =
         "com.sun.management:type=DiagnosticCommand";
 
-    public static void main(String[] args) {
-        MBeanServerConnection mbs = null;
+    public static void main(String[] args) throws Exception {
+        System.out.println("--->JRCMD MBean Test: invocation on \"operation info\"...");
+
+        MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
+        JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
+        JMXConnectorServer cs = null;
+        JMXConnector cc = null;
         try {
-            JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:8127/jmxrmi");
-            JMXConnector connector = JMXConnectorFactory.connect(url);
-            mbs = connector.getMBeanServerConnection();
-        } catch(Throwable t) {
-            t.printStackTrace();
-        }
-        ObjectName name;
-        try {
-            name = new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME);
-            MBeanInfo info = mbs.getMBeanInfo(name);
+            cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbs);
+            cs.start();
+            JMXServiceURL addr = cs.getAddress();
+            cc = JMXConnectorFactory.connect(addr);
+            MBeanServerConnection mbsc = cc.getMBeanServerConnection();
+            ObjectName name = new ObjectName(HOTSPOT_DIAGNOSTIC_MXBEAN_NAME);
+            MBeanInfo info = mbsc.getMBeanInfo(name);
+
             // the test should check that the MBean doesn't have any
             // Attribute, notification or constructor. Current version only
             // check operations
-            System.out.println("Class Name:"+info.getClassName());
-            System.out.println("Description:"+info.getDescription());
+            System.out.println("Class Name:" + info.getClassName());
+            System.out.println("Description:" + info.getDescription());
             MBeanOperationInfo[] opInfo = info.getOperations();
             System.out.println("Operations:");
-            for(int i=0; i<opInfo.length; i++) {
+            for (int i = 0; i < opInfo.length; i++) {
                 printOperation(opInfo[i]);
                 System.out.println("\n@@@@@@\n");
             }
-        } catch (InstanceNotFoundException|IntrospectionException|ReflectionException
-                 |MalformedObjectNameException|IOException ex) {
-            Logger.getLogger(DcmdMBeanTest.class.getName()).log(Level.SEVERE, null, ex);
+        } finally {
+            try {
+                cc.close();
+                cs.stop();
+            } catch (Exception e) {
+            }
         }
+
+        System.out.println("Test passed");
     }
 
     static void printOperation(MBeanOperationInfo info) {
@@ -110,4 +111,3 @@
         }
     }
 }
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/DrawString/DrawRotatedString.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 7190349
+ * @summary Verifies that we get correct direction, when draw rotated string.
+ * @author Sergey Bylokhov
+ * @run main/othervm DrawRotatedString
+ */
+public final class DrawRotatedString {
+
+    private static final int SIZE = 500;
+
+    public static void main(final String[] args) throws IOException {
+        BufferedImage bi = createBufferedImage(true);
+        verify(bi);
+        bi = createBufferedImage(false);
+        verify(bi);
+        System.out.println("Passed");
+    }
+
+    private static void verify(BufferedImage bi) throws IOException {
+        for (int i = 0; i < SIZE; ++i) {
+            for (int j = 0; j < 99; ++j) {
+                //Text should not appear before 100
+                if (bi.getRGB(i, j) != Color.RED.getRGB()) {
+                    ImageIO.write(bi, "png", new File("image.png"));
+                    throw new RuntimeException("Failed: wrong text location");
+                }
+            }
+        }
+    }
+
+    private static BufferedImage createBufferedImage(final boolean  aa) {
+        final BufferedImage bi = new BufferedImage(SIZE, SIZE,
+                                                   BufferedImage.TYPE_INT_RGB);
+        final Graphics2D bg = bi.createGraphics();
+        bg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+                            aa ? RenderingHints.VALUE_ANTIALIAS_ON
+                               : RenderingHints.VALUE_ANTIALIAS_OFF);
+        bg.setColor(Color.RED);
+        bg.fillRect(0, 0, SIZE, SIZE);
+        bg.translate(100, 100);
+        bg.rotate(Math.toRadians(90));
+        bg.setColor(Color.BLACK);
+        bg.setFont(bg.getFont().deriveFont(20.0f));
+        bg.drawString("MMMMMMMMMMMMMMMM", 0, 0);
+        bg.dispose();
+        return bi;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Graphics2D/IncorrectTextSize/IncorrectTextSize.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+/**
+ * @test
+ * @bug 8013569
+ * @author Sergey Bylokhov
+ */
+public final class IncorrectTextSize {
+
+    static final int scale = 2;
+    static final int width = 1200;
+    static final int height = 100;
+    static BufferedImage bi = new BufferedImage(width, height,
+                                                BufferedImage.TYPE_INT_ARGB);
+    static final String TEXT = "The quick brown fox jumps over the lazy dog"
+            + "The quick brown fox jumps over the lazy dog";
+
+    public static void main(final String[] args) throws IOException {
+        for (int  point = 5; point < 11; ++point) {
+            Graphics2D g2d = bi.createGraphics();
+            g2d.setFont(new Font(Font.DIALOG, Font.PLAIN, point));
+            g2d.scale(scale, scale);
+            g2d.setColor(Color.WHITE);
+            g2d.fillRect(0, 0, width, height);
+            g2d.setColor(Color.green);
+            g2d.drawString(TEXT, 0, 20);
+            int length = g2d.getFontMetrics().stringWidth(TEXT);
+            if (length < 0) {
+                throw new RuntimeException("Negative length");
+            }
+            for (int i = (length + 1) * scale; i < width; ++i) {
+                for (int j = 0; j < height; ++j) {
+                    if (bi.getRGB(i, j) != Color.white.getRGB()) {
+                        g2d.drawLine(length, 0, length, height);
+                        ImageIO.write(bi, "png", new File("image.png"));
+                        System.out.println("length = " + length);
+                        System.err.println("Wrong color at x=" + i + ",y=" + j);
+                        System.err.println("Color is:" + new Color(bi.getRGB(i,
+                                                                             j)));
+                        throw new RuntimeException("Test failed.");
+                    }
+                }
+            }
+            g2d.dispose();
+        }
+    }
+}
--- a/jdk/test/java/lang/instrument/RedefineBigClass.sh	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 7121600
+# @bug 7121600 8016838
 # @summary Redefine a big class.
 # @author Daniel D. Daugherty
 #
--- a/jdk/test/java/lang/instrument/RedefineBigClassApp.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/lang/instrument/RedefineBigClassApp.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,21 @@
  * questions.
  */
 
+import java.io.*;
+
 public class RedefineBigClassApp {
+    /**
+     * Memory leak is assumed, if application consumes more than specified amount of memory during its execution.
+     * The number is given in Kb.
+     */
+    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32Mb
+
     public static void main(String[] args) throws Exception {
         System.out.println("Creating instance of " +
             RedefineBigClassAgent.clz);
         RedefineBigClassAgent.clz.newInstance();
 
+        long vMemBefore = getVMemSize();
         int count = 0;
         while (!RedefineBigClassAgent.doneRedefining) {
             System.out.println("App loop count: " + ++count);
@@ -37,6 +46,39 @@
         }
         System.out.println("App looped  " + count + " times.");
 
+        long vMemAfter = getVMemSize();
+        if (vMemBefore == 0 || vMemAfter == 0) {
+            System.err.println("WARNING: Cannot perform memory leak detection on this OS");
+        } else {
+            long vMemDelta = vMemAfter - vMemBefore;
+            if (vMemDelta > MEM_LEAK_THRESHOLD) {
+                System.err.println("FAIL: Virtual memory usage increased by " + vMemDelta + "Kb " +
+                        "(greater than " + MEM_LEAK_THRESHOLD + "Kb)");
+                System.exit(1);
+            }
+            System.err.println("PASS: Virtual memory usage increased by " + vMemDelta + "Kb " +
+                    "(not greater than " + MEM_LEAK_THRESHOLD + "Kb)");
+        }
         System.exit(0);
     }
+
+    /**
+     * Return size of virtual memory allocated to the process in Kb.
+     * Linux specific. On other platforms and in case of any errors return 0.
+     */
+    private static long getVMemSize() {
+
+        // Refer to the Linux proc(5) man page for details about /proc/self/stat file
+        //
+        // In short, this file contains status information about the current process
+        // written in one line. The fields are separated with spaces.
+        // The 23rd field is defined as 'vsize %lu   Virtual memory size in bytes'
+
+        try (FileReader fileReader = new FileReader("/proc/self/stat");
+             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
+            String line = bufferedReader.readLine();
+            return Long.parseLong(line.split(" ")[22]) / 1024;
+        } catch (Exception ex) {}
+        return 0;
+    }
 }
--- a/jdk/test/java/lang/instrument/RetransformBigClass.sh	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/lang/instrument/RetransformBigClass.sh	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 7122253
+# @bug 7122253 8016838
 # @summary Retransform a big class.
 # @author Daniel D. Daugherty
 #
--- a/jdk/test/java/lang/instrument/RetransformBigClassApp.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/lang/instrument/RetransformBigClassApp.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,12 +21,21 @@
  * questions.
  */
 
+import java.io.*;
+
 public class RetransformBigClassApp {
+    /**
+     * Memory leak is assumed, if application consumes more than specified amount of memory during its execution.
+     * The number is given in Kb.
+     */
+    private static final long MEM_LEAK_THRESHOLD = 32 * 1024; // 32Mb
+
     public static void main(String[] args) throws Exception {
         System.out.println("Creating instance of " +
             RetransformBigClassAgent.clz);
         RetransformBigClassAgent.clz.newInstance();
 
+        long vMemBefore = getVMemSize();
         int count = 0;
         while (!RetransformBigClassAgent.doneRetransforming) {
             System.out.println("App loop count: " + ++count);
@@ -37,6 +46,39 @@
         }
         System.out.println("App looped  " + count + " times.");
 
+        long vMemAfter = getVMemSize();
+        if (vMemBefore == 0 || vMemAfter == 0) {
+            System.err.println("WARNING: Cannot perform memory leak detection on this OS");
+        } else {
+            long vMemDelta = vMemAfter - vMemBefore;
+            if (vMemDelta > MEM_LEAK_THRESHOLD) {
+                System.err.println("FAIL: Virtual memory usage increased by " + vMemDelta + "Kb " +
+                        "(greater than " + MEM_LEAK_THRESHOLD + "Kb)");
+                System.exit(1);
+            }
+            System.err.println("PASS: Virtual memory usage increased by " + vMemDelta + "Kb " +
+                    "(not greater than " + MEM_LEAK_THRESHOLD + "Kb)");
+        }
         System.exit(0);
     }
+
+    /**
+     * Return size of virtual memory allocated to the process in Kb.
+     * Linux specific. On other platforms and in case of any errors return 0.
+     */
+    private static long getVMemSize() {
+
+        // Refer to the Linux proc(5) man page for details about /proc/self/stat file
+        //
+        // In short, this file contains status information about the current process
+        // written in one line. The fields are separated with spaces.
+        // The 23rd field is defined as 'vsize %lu   Virtual memory size in bytes'
+
+        try (FileReader fileReader = new FileReader("/proc/self/stat");
+             BufferedReader bufferedReader = new BufferedReader(fileReader)) {
+            String line = bufferedReader.readLine();
+            return Long.parseLong(line.split(" ")[22]) / 1024;
+        } catch (Exception ex) {}
+        return 0;
+    }
 }
--- a/jdk/test/java/lang/management/ThreadMXBean/ResetPeakThreadCount.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/lang/management/ThreadMXBean/ResetPeakThreadCount.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,10 +23,11 @@
 
 /*
  * @test
- * @bug     4892507
+ * @bug     4892507 8020875 8021335
  * @summary Basic Test for the following reset methods:
  *          - ThreadMXBean.resetPeakThreadCount()
  * @author  Mandy Chung
+ * @author  Jaroslav Bachorik
  *
  * @build ResetPeakThreadCount
  * @build ThreadDump
@@ -53,15 +54,17 @@
 
     private static final int TERMINATE_2 = 8;
 
+    private static final int TERMINATE_3 = 2;
+
     private static final int ALL_THREADS = DAEMON_THREADS_1 +
         DAEMON_THREADS_2 + DAEMON_THREADS_3;
     // barrier for threads communication
-    private static Barrier barrier = new Barrier(DAEMON_THREADS_1);
+    private static final Barrier barrier = new Barrier(DAEMON_THREADS_1);
 
-    private static Thread allThreads[] = new Thread[ALL_THREADS];
-    private static volatile boolean live[] = new boolean[ALL_THREADS];
+    private static final Thread allThreads[] = new Thread[ALL_THREADS];
+    private static final boolean live[] = new boolean[ALL_THREADS];
     private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
-    private static boolean testFailed = false;
+    private static volatile boolean testFailed = false;
 
     public static void main(String[] argv) throws Exception {
         // This test does not expect any threads to be created
@@ -69,7 +72,10 @@
         // The checkThreadCount() method is to produce more
         // diagnostic information in case any unexpected test failure occur.
         long previous = mbean.getThreadCount();
-        long current;
+        long current = previous;
+
+        // reset the peak to start from a scratch
+        resetPeak(current);
 
         // start DAEMON_THREADS_1 number of threads
         current = startThreads(0, DAEMON_THREADS_1, EXPECTED_PEAK_DELTA_1);
@@ -106,6 +112,14 @@
         current = terminateThreads(TERMINATE_1, TERMINATE_2);
 
         checkThreadCount(previous, current, TERMINATE_2 * -1);
+        previous = current;
+
+        resetPeak(current);
+
+        // terminate TERMINATE_3 number of threads and reset peak
+        current = terminateThreads(TERMINATE_1 + TERMINATE_2, TERMINATE_3);
+
+        checkThreadCount(previous, current, TERMINATE_3 * -1);
         resetPeak(current);
 
         if (testFailed)
@@ -114,7 +128,7 @@
         System.out.println("Test passed");
     }
 
-    private static long startThreads(int from, int count, int delta) {
+    private static long startThreads(int from, int count, int delta) throws InterruptedException {
         // get current peak thread count
         long peak1 = mbean.getPeakThreadCount();
         long current = mbean.getThreadCount();
@@ -122,11 +136,13 @@
         // Start threads and wait to be sure they all are alive
         System.out.println("Starting " + count + " threads....");
         barrier.set(count);
-        for (int i = from; i < (from + count); i++) {
-            live[i] = true;
-            allThreads[i] = new MyThread(i);
-            allThreads[i].setDaemon(true);
-            allThreads[i].start();
+        synchronized(live) {
+            for (int i = from; i < (from + count); i++) {
+                live[i] = true;
+                allThreads[i] = new MyThread(i);
+                allThreads[i].setDaemon(true);
+                allThreads[i].start();
+            }
         }
         // wait until all threads have started.
         barrier.await();
@@ -144,29 +160,25 @@
         }
         // wait until the current thread count gets incremented
         while (mbean.getThreadCount() < (current + count)) {
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-                System.out.println("Unexpected exception.");
-                testFailed = true;
-            }
+            Thread.sleep(100);
         }
         current = mbean.getThreadCount();
         System.out.println("   Live thread count before returns " + current);
         return current;
     }
 
-    private static long terminateThreads(int from, int count) {
+    private static long terminateThreads(int from, int count) throws InterruptedException {
         // get current peak thread count
         long peak1 = mbean.getPeakThreadCount();
-        long current = mbean.getThreadCount();
 
         // Stop daemon threads and wait to be sure they all are dead
         System.out.println("Terminating " + count + " threads....");
         barrier.set(count);
-        for (int i = from; i < (from+count); i++) {
-            live[i] = false;
+        synchronized(live) {
+            for (int i = from; i < (from+count); i++) {
+                live[i] = false;
+            }
+            live.notifyAll();
         }
         // wait until daemon threads terminated.
         barrier.await();
@@ -179,18 +191,17 @@
                 " Expected to be = previous peak = " + peak1);
         }
 
-        // wait until the current thread count gets decremented
-        while (mbean.getThreadCount() > (current - count)) {
-            try {
-                Thread.sleep(100);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-                System.out.println("Unexpected exception.");
-                testFailed = true;
-            }
+        for (int i = from; i < (from+count); i++) {
+            allThreads[i].join();
         }
 
-        current = mbean.getThreadCount();
+        // there is a race in the counter update logic somewhere causing
+        // the thread counters go ff
+        // we need to give the terminated threads some extra time to really die
+        // JDK-8021335
+        Thread.sleep(500);
+
+        long current = mbean.getThreadCount();
         System.out.println("   Live thread count before returns " + current);
         return current;
     }
@@ -223,11 +234,11 @@
 
     private static void checkThreadCount(long previous, long current, int expectedDelta) {
         if (current != previous + expectedDelta) {
-            System.out.println("***** Unexpected thread count:" +
+            ThreadDump.threadDump();
+            throw new RuntimeException("***** Unexpected thread count:" +
                                " previous = " + previous +
                                " current = " + current +
                                " delta = " + expectedDelta + "*****");
-            ThreadDump.threadDump();
         }
     }
 
@@ -242,13 +253,15 @@
         public void run() {
             // signal started
             barrier.signal();
-            while (live[id]) {
-                try {
-                    sleep(100);
-                } catch (InterruptedException e) {
-                    System.out.println("Unexpected exception is thrown.");
-                    e.printStackTrace(System.out);
-                    testFailed = true;
+            synchronized(live) {
+                while (live[id]) {
+                    try {
+                        live.wait(100);
+                    } catch (InterruptedException e) {
+                        System.out.println("Unexpected exception is thrown.");
+                        e.printStackTrace(System.out);
+                        testFailed = true;
+                    }
                 }
             }
             // signal about to exit
--- a/jdk/test/java/math/BigInteger/BigIntegerTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/math/BigInteger/BigIntegerTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -43,8 +43,8 @@
  * this test is a strong assurance that the BigInteger operations
  * are working correctly.
  *
- * Three arguments may be specified which give the number of
- * decimal digits you desire in the three batches of test numbers.
+ * Four arguments may be specified which give the number of
+ * decimal digits you desire in the four batches of test numbers.
  *
  * The tests are performed on arrays of random numbers which are
  * generated by a Random class as well as special cases which
@@ -63,11 +63,14 @@
     //
     // SCHOENHAGE_BASE_CONVERSION_THRESHOLD = 8 ints = 256 bits
     //
+    // BURNIKEL_ZIEGLER_THRESHOLD = 50  ints = 1600 bits
+    //
     static final int BITS_KARATSUBA = 1600;
     static final int BITS_TOOM_COOK = 2400;
     static final int BITS_KARATSUBA_SQUARE = 2880;
     static final int BITS_TOOM_COOK_SQUARE = 4480;
     static final int BITS_SCHOENHAGE_BASE = 256;
+    static final int BITS_BURNIKEL_ZIEGLER = 1600;
 
     static final int ORDER_SMALL = 60;
     static final int ORDER_MEDIUM = 100;
@@ -80,14 +83,15 @@
     // #bits for testing Toom-Cook squaring
     static final int ORDER_TOOM_COOK_SQUARE = 4600;
 
+    static final int SIZE = 1000; // numbers per batch
+
     static Random rnd = new Random();
-    static int size = 1000; // numbers per batch
     static boolean failure = false;
 
     public static void pow(int order) {
         int failCount1 = 0;
 
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             // Test identity x^power == x*x*x ... *x
             int power = rnd.nextInt(6) + 2;
             BigInteger x = fetchNumber(order);
@@ -106,7 +110,7 @@
     public static void square(int order) {
         int failCount1 = 0;
 
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             // Test identity x^2 == x*x
             BigInteger x  = fetchNumber(order);
             BigInteger xx = x.multiply(x);
@@ -121,7 +125,7 @@
     public static void arithmetic(int order) {
         int failCount = 0;
 
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(order);
             while(x.compareTo(BigInteger.ZERO) != 1)
                 x = fetchNumber(order);
@@ -187,7 +191,7 @@
         int failCount = 0;
 
         BigInteger base = BigInteger.ONE.shiftLeft(BITS_KARATSUBA - 32 - 1);
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_KARATSUBA - 32 - 1);
             BigInteger u = base.add(x);
             int a = 1 + rnd.nextInt(31);
@@ -210,7 +214,7 @@
 
         failCount = 0;
         base = base.shiftLeft(BITS_TOOM_COOK - BITS_KARATSUBA);
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_TOOM_COOK - 32 - 1);
             BigInteger u = base.add(x);
             BigInteger u2 = u.shiftLeft(1);
@@ -241,7 +245,7 @@
         int failCount = 0;
 
         BigInteger base = BigInteger.ONE.shiftLeft(BITS_KARATSUBA_SQUARE - 32 - 1);
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_KARATSUBA_SQUARE - 32 - 1);
             BigInteger u = base.add(x);
             int a = 1 + rnd.nextInt(31);
@@ -259,7 +263,7 @@
 
         failCount = 0;
         base = base.shiftLeft(BITS_TOOM_COOK_SQUARE - BITS_KARATSUBA_SQUARE);
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(BITS_TOOM_COOK_SQUARE - 32 - 1);
             BigInteger u = base.add(x);
             int a = 1 + rnd.nextInt(31);
@@ -276,10 +280,61 @@
         report("squareLarge Toom-Cook", failCount);
     }
 
+    /**
+     * Sanity test for Burnikel-Ziegler division.  The Burnikel-Ziegler division
+     * algorithm is used when each of the dividend and the divisor has at least
+     * a specified number of ints in its representation.  This test is based on
+     * the observation that if {@code w = u*pow(2,a)} and {@code z = v*pow(2,b)}
+     * where {@code abs(u) > abs(v)} and {@code a > b && b > 0}, then if
+     * {@code w/z = q1*z + r1} and {@code u/v = q2*v + r2}, then
+     * {@code q1 = q2*pow(2,a-b)} and {@code r1 = r2*pow(2,b)}.  The test
+     * ensures that {@code v} is just under the B-Z threshold and that {@code w}
+     * and {@code z} are both over the threshold.  This implies that {@code u/v}
+     * uses the standard division algorithm and {@code w/z} uses the B-Z
+     * algorithm.  The results of the two algorithms are then compared using the
+     * observation described in the foregoing and if they are not equal a
+     * failure is logged.
+     */
+    public static void divideLarge() {
+        int failCount = 0;
+
+        BigInteger base = BigInteger.ONE.shiftLeft(BITS_BURNIKEL_ZIEGLER - 33);
+        for (int i=0; i<SIZE; i++) {
+            BigInteger addend = new BigInteger(BITS_BURNIKEL_ZIEGLER - 34, rnd);
+            BigInteger v = base.add(addend);
+
+            BigInteger u = v.multiply(BigInteger.valueOf(2 + rnd.nextInt(Short.MAX_VALUE - 1)));
+
+            if(rnd.nextBoolean()) {
+                u = u.negate();
+            }
+            if(rnd.nextBoolean()) {
+                v = v.negate();
+            }
+
+            int a = 17 + rnd.nextInt(16);
+            int b = 1 + rnd.nextInt(16);
+            BigInteger w = u.multiply(BigInteger.valueOf(1L << a));
+            BigInteger z = v.multiply(BigInteger.valueOf(1L << b));
+
+            BigInteger[] divideResult = u.divideAndRemainder(v);
+            divideResult[0] = divideResult[0].multiply(BigInteger.valueOf(1L << (a - b)));
+            divideResult[1] = divideResult[1].multiply(BigInteger.valueOf(1L << b));
+            BigInteger[] bzResult = w.divideAndRemainder(z);
+
+            if (divideResult[0].compareTo(bzResult[0]) != 0 ||
+                    divideResult[1].compareTo(bzResult[1]) != 0) {
+                failCount++;
+            }
+        }
+
+        report("divideLarge", failCount);
+    }
+
     public static void bitCount() {
         int failCount = 0;
 
-        for (int i=0; i<size*10; i++) {
+        for (int i=0; i<SIZE*10; i++) {
             int x = rnd.nextInt();
             BigInteger bigX = BigInteger.valueOf((long)x);
             int bit = (x < 0 ? 0 : 1);
@@ -300,7 +355,7 @@
     public static void bitLength() {
         int failCount = 0;
 
-        for (int i=0; i<size*10; i++) {
+        for (int i=0; i<SIZE*10; i++) {
             int x = rnd.nextInt();
             BigInteger bigX = BigInteger.valueOf((long)x);
             int signBit = (x < 0 ? 0x80000000 : 0);
@@ -321,7 +376,7 @@
     public static void bitOps(int order) {
         int failCount1 = 0, failCount2 = 0, failCount3 = 0;
 
-        for (int i=0; i<size*5; i++) {
+        for (int i=0; i<SIZE*5; i++) {
             BigInteger x = fetchNumber(order);
             BigInteger y;
 
@@ -351,7 +406,7 @@
         report("clearBit/testBit for " + order + " bits", failCount1);
         report("flipBit/testBit for " + order + " bits", failCount2);
 
-        for (int i=0; i<size*5; i++) {
+        for (int i=0; i<SIZE*5; i++) {
             BigInteger x = fetchNumber(order);
 
             // Test getLowestSetBit()
@@ -375,7 +430,7 @@
 
         // Test identity x^y == x|y &~ x&y
         int failCount = 0;
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(order);
             BigInteger y = fetchNumber(order);
             BigInteger z = x.xor(y);
@@ -387,7 +442,7 @@
 
         // Test identity x &~ y == ~(~x | y)
         failCount = 0;
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(order);
             BigInteger y = fetchNumber(order);
             BigInteger z = x.andNot(y);
@@ -440,7 +495,7 @@
     public static void divideAndRemainder(int order) {
         int failCount1 = 0;
 
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(order).abs();
             while(x.compareTo(BigInteger.valueOf(3L)) != 1)
                 x = fetchNumber(order).abs();
@@ -519,7 +574,7 @@
     public static void byteArrayConv(int order) {
         int failCount = 0;
 
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(order);
             while (x.equals(BigInteger.ZERO))
                 x = fetchNumber(order);
@@ -536,7 +591,7 @@
     public static void modInv(int order) {
         int failCount = 0, successCount = 0, nonInvCount = 0;
 
-        for (int i=0; i<size; i++) {
+        for (int i=0; i<SIZE; i++) {
             BigInteger x = fetchNumber(order);
             while(x.equals(BigInteger.ZERO))
                 x = fetchNumber(order);
@@ -565,7 +620,7 @@
     public static void modExp(int order1, int order2) {
         int failCount = 0;
 
-        for (int i=0; i<size/10; i++) {
+        for (int i=0; i<SIZE/10; i++) {
             BigInteger m = fetchNumber(order1).abs();
             while(m.compareTo(BigInteger.ONE) != 1)
                 m = fetchNumber(order1).abs();
@@ -883,8 +938,8 @@
     /**
      * Main to interpret arguments and run several tests.
      *
-     * Up to three arguments may be given to specify the size of BigIntegers
-     * used for call parameters 1, 2, and 3. The size is interpreted as
+     * Up to three arguments may be given to specify the SIZE of BigIntegers
+     * used for call parameters 1, 2, and 3. The SIZE is interpreted as
      * the maximum number of decimal digits that the parameters will have.
      *
      */
@@ -945,6 +1000,7 @@
 
         multiplyLarge();
         squareLarge();
+        divideLarge();
 
         if (failure)
             throw new RuntimeException("Failure in BigIntegerTest.");
@@ -987,13 +1043,13 @@
                 break;
 
             case 4: // Random bit density
-                int iterations = rnd.nextInt(order-1);
-                result = BigInteger.ONE.shiftLeft(rnd.nextInt(order));
-                for(int i=0; i<iterations; i++) {
-                    BigInteger temp = BigInteger.ONE.shiftLeft(
-                                                rnd.nextInt(order));
-                    result = result.or(temp);
+                byte[] val = new byte[(order+7)/8];
+                int iterations = rnd.nextInt(order);
+                for (int i=0; i<iterations; i++) {
+                    int bitIdx = rnd.nextInt(order);
+                    val[bitIdx/8] |= 1 << (bitIdx%8);
                 }
+                result = new BigInteger(1, val);
                 break;
             case 5: // Runs of consecutive ones and zeros
                 result = ZERO;
--- a/jdk/test/java/security/cert/PKIXRevocationChecker/UnitTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/security/cert/PKIXRevocationChecker/UnitTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6854712 7171570
+ * @bug 6854712 7171570 8010748
  * @summary Basic unit test for PKIXRevocationChecker
  */
 
@@ -32,19 +32,9 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.net.URI;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertPathBuilder;
-import java.security.cert.CertPathChecker;
-import java.security.cert.CertPathValidator;
-import java.security.cert.Extension;
-import java.security.cert.PKIXRevocationChecker;
+import java.security.cert.*;
 import java.security.cert.PKIXRevocationChecker.Option;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
 
 public class UnitTest {
 
@@ -56,22 +46,23 @@
 
         System.out.println("Testing that get methods return null or " +
                            "empty lists/sets/maps");
-        requireNull(prc.getOCSPResponder(), "getOCSPResponder()");
-        requireNull(prc.getOCSPResponderCert(), "getOCSPResponderCert()");
-        requireEmpty(prc.getOCSPExtensions(), "getOCSPExtensions()");
-        requireEmpty(prc.getOCSPResponses(), "getOCSPResponses()");
+        requireNull(prc.getOcspResponder(), "getOcspResponder()");
+        requireNull(prc.getOcspResponderCert(), "getOcspResponderCert()");
+        requireEmpty(prc.getOcspExtensions(), "getOcspExtensions()");
+        requireEmpty(prc.getOcspResponses(), "getOcspResponses()");
         requireEmpty(prc.getOptions(), "getOptions()");
+        requireEmpty(prc.getSoftFailExceptions(), "getSoftFailExceptions()");
 
         System.out.println("Testing that get methods return same parameters " +
                            "that are passed to set methods");
         URI uri = new URI("http://localhost");
-        prc.setOCSPResponder(uri);
-        requireEquals(uri, prc.getOCSPResponder(), "getOCSPResponder()");
+        prc.setOcspResponder(uri);
+        requireEquals(uri, prc.getOcspResponder(), "getOcspResponder()");
 
         X509Certificate cert = getCert();
-        prc.setOCSPResponderCert(cert);
-        requireEquals(cert, prc.getOCSPResponderCert(),
-                      "getOCSPResponderCert()");
+        prc.setOcspResponderCert(cert);
+        requireEquals(cert, prc.getOcspResponderCert(),
+                      "getOcspResponderCert()");
 
         List<Extension> exts = new ArrayList<>();
         for (String oid : cert.getNonCriticalExtensionOIDs()) {
@@ -79,8 +70,8 @@
             exts.add(new ExtensionImpl(oid,
                                        cert.getExtensionValue(oid), false));
         }
-        prc.setOCSPExtensions(exts);
-        requireEquals(exts, prc.getOCSPExtensions(), "getOCSPExtensions()");
+        prc.setOcspExtensions(exts);
+        requireEquals(exts, prc.getOcspExtensions(), "getOcspExtensions()");
 
         Set<Option> options = EnumSet.of(Option.ONLY_END_ENTITY);
         prc.setOptions(options);
@@ -88,14 +79,14 @@
 
         System.out.println("Testing that parameters are re-initialized to " +
                            "default values if null is passed to set methods");
-        prc.setOCSPResponder(null);
-        requireNull(prc.getOCSPResponder(), "getOCSPResponder()");
-        prc.setOCSPResponderCert(null);
-        requireNull(prc.getOCSPResponderCert(), "getOCSPResponderCert()");
-        prc.setOCSPExtensions(null);
-        requireEmpty(prc.getOCSPExtensions(), "getOCSPExtensions()");
-        prc.setOCSPResponses(null);
-        requireEmpty(prc.getOCSPResponses(), "getOCSPResponses()");
+        prc.setOcspResponder(null);
+        requireNull(prc.getOcspResponder(), "getOcspResponder()");
+        prc.setOcspResponderCert(null);
+        requireNull(prc.getOcspResponderCert(), "getOcspResponderCert()");
+        prc.setOcspExtensions(null);
+        requireEmpty(prc.getOcspExtensions(), "getOcspExtensions()");
+        prc.setOcspResponses(null);
+        requireEmpty(prc.getOcspResponses(), "getOcspResponses()");
         prc.setOptions(null);
         requireEmpty(prc.getOptions(), "getOptions()");
 
--- a/jdk/test/java/time/tck/java/time/MockSimplePeriod.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/MockSimplePeriod.java	Tue Aug 06 16:54:56 2013 -0700
@@ -176,7 +176,7 @@
 
     @Override
     public String toString() {
-        return amount + " " + unit.getName();
+        return amount + " " + unit;
     }
 
 }
--- a/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKClock_Fixed.java	Tue Aug 06 16:54:56 2013 -0700
@@ -91,6 +91,7 @@
         Clock test = Clock.fixed(INSTANT, PARIS);
         assertEquals(test.instant(), INSTANT);
         assertEquals(test.getZone(), PARIS);
+   assertEquals(test.instant().getEpochSecond()*1000, test.millis());
     }
 
     @Test(expectedExceptions = NullPointerException.class)
--- a/jdk/test/java/time/tck/java/time/TCKDayOfWeek.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKDayOfWeek.java	Tue Aug 06 16:54:56 2013 -0700
@@ -159,6 +159,44 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(DayOfWeek.THURSDAY.isSupported((TemporalField) null), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.NANO_OF_SECOND), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.NANO_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MICRO_OF_SECOND), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MICRO_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MILLI_OF_SECOND), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MILLI_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.SECOND_OF_MINUTE), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.SECOND_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MINUTE_OF_HOUR), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MINUTE_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.HOUR_OF_AMPM), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.HOUR_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.AMPM_OF_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.DAY_OF_WEEK), true);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.DAY_OF_MONTH), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.MONTH_OF_YEAR), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.PROLEPTIC_MONTH), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.YEAR), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.YEAR_OF_ERA), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.ERA), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(DayOfWeek.THURSDAY.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
--- a/jdk/test/java/time/tck/java/time/TCKInstant.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKInstant.java	Tue Aug 06 16:54:56 2013 -0700
@@ -570,10 +570,6 @@
     //-----------------------------------------------------------------------
     TemporalUnit NINETY_MINS = new TemporalUnit() {
         @Override
-        public String getName() {
-            return "NinetyMins";
-        }
-        @Override
         public Duration getDuration() {
             return Duration.ofMinutes(90);
         }
@@ -582,6 +578,49 @@
             return false;
         }
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+        @Override
+        public boolean isTimeBased() {
+            return true;
+        }
+        @Override
+        public boolean isSupportedBy(Temporal temporal) {
+            return false;
+        }
+        @Override
+        public <R extends Temporal> R addTo(R temporal, long amount) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public long between(Temporal temporal1, Temporal temporal2) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public String toString() {
+            return "NinetyMins";
+        }
+    };
+
+    TemporalUnit NINETY_FIVE_MINS = new TemporalUnit() {
+        @Override
+        public Duration getDuration() {
+            return Duration.ofMinutes(95);
+        }
+        @Override
+        public boolean isDurationEstimated() {
+            return false;
+        }
+        @Override
+        public boolean isDateBased() {
+            return false;
+        }
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+        @Override
         public boolean isSupportedBy(Temporal temporal) {
             return false;
         }
@@ -593,33 +632,10 @@
         public long between(Temporal temporal1, Temporal temporal2) {
             throw new UnsupportedOperationException();
         }
-    };
-
-    TemporalUnit NINETY_FIVE_MINS = new TemporalUnit() {
         @Override
-        public String getName() {
+        public String toString() {
             return "NinetyFiveMins";
         }
-        @Override
-        public Duration getDuration() {
-            return Duration.ofMinutes(95);
-        }
-        @Override
-        public boolean isDurationEstimated() {
-            return false;
-        }
-        @Override
-        public boolean isSupportedBy(Temporal temporal) {
-            return false;
-        }
-        @Override
-        public <R extends Temporal> R addTo(R temporal, long amount) {
-            throw new UnsupportedOperationException();
-        }
-        @Override
-        public long between(Temporal temporal1, Temporal temporal2) {
-            throw new UnsupportedOperationException();
-        }
     };
 
     @DataProvider(name="truncatedToValid")
@@ -1709,7 +1725,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -1805,7 +1821,7 @@
     public void test_periodUntil_TemporalUnit(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
         Instant i1 = Instant.ofEpochSecond(seconds1, nanos1);
         Instant i2 = Instant.ofEpochSecond(seconds2, nanos2);
-        long amount = i1.periodUntil(i2, unit);
+        long amount = i1.until(i2, unit);
         assertEquals(amount, expected);
     }
 
@@ -1813,23 +1829,23 @@
     public void test_periodUntil_TemporalUnit_negated(long seconds1, int nanos1, long seconds2, long nanos2, TemporalUnit unit, long expected) {
         Instant i1 = Instant.ofEpochSecond(seconds1, nanos1);
         Instant i2 = Instant.ofEpochSecond(seconds2, nanos2);
-        long amount = i2.periodUntil(i1, unit);
+        long amount = i2.until(i1, unit);
         assertEquals(amount, -expected);
     }
 
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
     public void test_periodUntil_TemporalUnit_unsupportedUnit() {
-        TEST_12345_123456789.periodUntil(TEST_12345_123456789, MONTHS);
+        TEST_12345_123456789.until(TEST_12345_123456789, MONTHS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullEnd() {
-        TEST_12345_123456789.periodUntil(null, HOURS);
+        TEST_12345_123456789.until(null, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullUnit() {
-        TEST_12345_123456789.periodUntil(TEST_12345_123456789, null);
+        TEST_12345_123456789.until(TEST_12345_123456789, null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKLocalDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -620,6 +620,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_2007_07_15.isSupported((TemporalField) null), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.NANO_OF_SECOND), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.NANO_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MICRO_OF_SECOND), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MICRO_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MILLI_OF_SECOND), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MILLI_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.SECOND_OF_MINUTE), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.SECOND_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MINUTE_OF_HOUR), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MINUTE_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.HOUR_OF_AMPM), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.HOUR_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.AMPM_OF_DAY), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.DAY_OF_WEEK), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.DAY_OF_MONTH), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.DAY_OF_YEAR), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.EPOCH_DAY), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.PROLEPTIC_MONTH), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.YEAR), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.YEAR_OF_ERA), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.ERA), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_2007_07_15.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.NANOS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.MICROS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.MILLIS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.SECONDS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.MINUTES), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.HOURS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.HALF_DAYS), false);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.DAYS), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.WEEKS), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.MONTHS), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.YEARS), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.DECADES), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.CENTURIES), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.MILLENNIA), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.ERAS), true);
+        assertEquals(TEST_2007_07_15.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -1635,7 +1697,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -1684,35 +1746,35 @@
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
-        long amount = date1.periodUntil(date2, unit);
+        long amount = date1.until(date2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit_negated(LocalDate date1, LocalDate date2, TemporalUnit unit, long expected) {
-        long amount = date2.periodUntil(date1, unit);
+        long amount = date2.until(date1, unit);
         assertEquals(amount, -expected);
     }
 
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
     public void test_periodUntil_TemporalUnit_unsupportedUnit() {
-        TEST_2007_07_15.periodUntil(TEST_2007_07_15, HOURS);
+        TEST_2007_07_15.until(TEST_2007_07_15, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullEnd() {
-        TEST_2007_07_15.periodUntil(null, DAYS);
+        TEST_2007_07_15.until(null, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullUnit() {
-        TEST_2007_07_15.periodUntil(TEST_2007_07_15, null);
+        TEST_2007_07_15.until(TEST_2007_07_15, null);
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(ChronoLocalDate)
+    // until(ChronoLocalDate)
     //-----------------------------------------------------------------------
-    @DataProvider(name="periodUntil")
+    @DataProvider(name="until")
     Object[][] data_periodUntil() {
         return new Object[][] {
                 {2010, 1, 1, 2010, 1, 1, 0, 0, 0},
@@ -1799,11 +1861,11 @@
         };
     }
 
-    @Test(dataProvider="periodUntil")
+    @Test(dataProvider="until")
     public void test_periodUntil_LocalDate(int y1, int m1, int d1, int y2, int m2, int d2, int ye, int me, int de) {
         LocalDate start = LocalDate.of(y1, m1, d1);
         LocalDate end = LocalDate.of(y2, m2, d2);
-        Period test = start.periodUntil(end);
+        Period test = start.until(end);
         assertEquals(test.getYears(), ye);
         assertEquals(test.getMonths(), me);
         assertEquals(test.getDays(), de);
@@ -1812,12 +1874,12 @@
     @Test
     public void test_periodUntil_LocalDate_max() {
         int years = Math.toIntExact((long) Year.MAX_VALUE - (long) Year.MIN_VALUE);
-        assertEquals(LocalDate.MIN.periodUntil(LocalDate.MAX), Period.of(years, 11, 30));
+        assertEquals(LocalDate.MIN.until(LocalDate.MAX), Period.of(years, 11, 30));
     }
 
     @Test(expectedExceptions=NullPointerException.class)
     public void test_periodUntil_LocalDate_null() {
-        TEST_2007_07_15.periodUntil(null);
+        TEST_2007_07_15.until(null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKLocalDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -938,6 +938,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported((TemporalField) null), false);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.NANO_OF_SECOND), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.NANO_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MICRO_OF_SECOND), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MICRO_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MILLI_OF_SECOND), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MILLI_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.SECOND_OF_MINUTE), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.SECOND_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MINUTE_OF_HOUR), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MINUTE_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.HOUR_OF_AMPM), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.HOUR_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.AMPM_OF_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.DAY_OF_WEEK), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.DAY_OF_MONTH), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.DAY_OF_YEAR), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.EPOCH_DAY), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.PROLEPTIC_MONTH), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.YEAR), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.YEAR_OF_ERA), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.ERA), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.NANOS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.MICROS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.MILLIS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.SECONDS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.MINUTES), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.HOURS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.HALF_DAYS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.DAYS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.WEEKS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.MONTHS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.YEARS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.DECADES), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.CENTURIES), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.MILLENNIA), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.ERAS), true);
+        assertEquals(TEST_2007_07_15_12_30_40_987654321.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -2717,7 +2779,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -2859,24 +2921,24 @@
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
-        long amount = dt1.periodUntil(dt2, unit);
+        long amount = dt1.until(dt2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit_negated(LocalDateTime dt1, LocalDateTime dt2, TemporalUnit unit, long expected) {
-        long amount = dt2.periodUntil(dt1, unit);
+        long amount = dt2.until(dt1, unit);
         assertEquals(amount, -expected);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullEnd() {
-        TEST_2007_07_15_12_30_40_987654321.periodUntil(null, HOURS);
+        TEST_2007_07_15_12_30_40_987654321.until(null, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullUnit() {
-        TEST_2007_07_15_12_30_40_987654321.periodUntil(TEST_2007_07_15_12_30_40_987654321, null);
+        TEST_2007_07_15_12_30_40_987654321.until(TEST_2007_07_15_12_30_40_987654321, null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKLocalTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKLocalTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -620,6 +620,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_12_30_40_987654321.isSupported((TemporalField) null), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.NANO_OF_SECOND), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.NANO_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MICRO_OF_SECOND), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MICRO_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MILLI_OF_SECOND), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MILLI_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.SECOND_OF_MINUTE), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.SECOND_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MINUTE_OF_HOUR), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MINUTE_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.HOUR_OF_AMPM), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.HOUR_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.AMPM_OF_DAY), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.DAY_OF_WEEK), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.DAY_OF_MONTH), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.MONTH_OF_YEAR), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.PROLEPTIC_MONTH), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.YEAR), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.YEAR_OF_ERA), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.ERA), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_12_30_40_987654321.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.NANOS), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.MICROS), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.MILLIS), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.SECONDS), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.MINUTES), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.HOURS), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.HALF_DAYS), true);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.DAYS), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.WEEKS), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.MONTHS), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.YEARS), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.DECADES), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.CENTURIES), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.MILLENNIA), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.ERAS), false);
+        assertEquals(TEST_12_30_40_987654321.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -953,10 +1015,6 @@
     //-----------------------------------------------------------------------
     TemporalUnit NINETY_MINS = new TemporalUnit() {
         @Override
-        public String getName() {
-            return "NinetyMins";
-        }
-        @Override
         public Duration getDuration() {
             return Duration.ofMinutes(90);
         }
@@ -965,6 +1023,49 @@
             return false;
         }
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+        @Override
+        public boolean isTimeBased() {
+            return true;
+        }
+        @Override
+        public boolean isSupportedBy(Temporal temporal) {
+            return false;
+        }
+        @Override
+        public <R extends Temporal> R addTo(R temporal, long amount) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public long between(Temporal temporal1, Temporal temporal2) {
+            throw new UnsupportedOperationException();
+        }
+        @Override
+        public String toString() {
+            return "NinetyMins";
+        }
+    };
+
+    TemporalUnit NINETY_FIVE_MINS = new TemporalUnit() {
+        @Override
+        public Duration getDuration() {
+            return Duration.ofMinutes(95);
+        }
+        @Override
+        public boolean isDurationEstimated() {
+            return false;
+        }
+        @Override
+        public boolean isDateBased() {
+            return false;
+        }
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+        @Override
         public boolean isSupportedBy(Temporal temporal) {
             return false;
         }
@@ -976,33 +1077,10 @@
         public long between(Temporal temporal1, Temporal temporal2) {
             throw new UnsupportedOperationException();
         }
-    };
-
-    TemporalUnit NINETY_FIVE_MINS = new TemporalUnit() {
         @Override
-        public String getName() {
+        public String toString() {
             return "NinetyFiveMins";
         }
-        @Override
-        public Duration getDuration() {
-            return Duration.ofMinutes(95);
-        }
-        @Override
-        public boolean isDurationEstimated() {
-            return false;
-        }
-        @Override
-        public boolean isSupportedBy(Temporal temporal) {
-            return false;
-        }
-        @Override
-        public <R extends Temporal> R addTo(R temporal, long amount) {
-            throw new UnsupportedOperationException();
-        }
-        @Override
-        public long between(Temporal temporal1, Temporal temporal2) {
-            throw new UnsupportedOperationException();
-        }
     };
 
     @DataProvider(name="truncatedToValid")
@@ -1922,7 +2000,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -1962,29 +2040,29 @@
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
-        long amount = time1.periodUntil(time2, unit);
+        long amount = time1.until(time2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit_negated(LocalTime time1, LocalTime time2, TemporalUnit unit, long expected) {
-        long amount = time2.periodUntil(time1, unit);
+        long amount = time2.until(time1, unit);
         assertEquals(amount, -expected);
     }
 
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
     public void test_periodUntil_TemporalUnit_unsupportedUnit() {
-        TEST_12_30_40_987654321.periodUntil(TEST_12_30_40_987654321, DAYS);
+        TEST_12_30_40_987654321.until(TEST_12_30_40_987654321, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullEnd() {
-        TEST_12_30_40_987654321.periodUntil(null, HOURS);
+        TEST_12_30_40_987654321.until(null, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullUnit() {
-        TEST_12_30_40_987654321.periodUntil(TEST_12_30_40_987654321, null);
+        TEST_12_30_40_987654321.until(TEST_12_30_40_987654321, null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKMonth.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKMonth.java	Tue Aug 06 16:54:56 2013 -0700
@@ -151,6 +151,44 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(Month.AUGUST.isSupported((TemporalField) null), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.NANO_OF_SECOND), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.NANO_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MICRO_OF_SECOND), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MICRO_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MILLI_OF_SECOND), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MILLI_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.SECOND_OF_MINUTE), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.SECOND_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MINUTE_OF_HOUR), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MINUTE_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.HOUR_OF_AMPM), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.HOUR_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.AMPM_OF_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.DAY_OF_WEEK), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.DAY_OF_MONTH), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.PROLEPTIC_MONTH), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.YEAR), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.YEAR_OF_ERA), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.ERA), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(Month.AUGUST.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
--- a/jdk/test/java/time/tck/java/time/TCKMonthDay.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKMonthDay.java	Tue Aug 06 16:54:56 2013 -0700
@@ -388,6 +388,44 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_07_15.isSupported((TemporalField) null), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.NANO_OF_SECOND), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.NANO_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MICRO_OF_SECOND), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MICRO_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MILLI_OF_SECOND), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MILLI_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.SECOND_OF_MINUTE), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.SECOND_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MINUTE_OF_HOUR), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MINUTE_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.HOUR_OF_AMPM), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.HOUR_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.AMPM_OF_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.DAY_OF_WEEK), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.DAY_OF_MONTH), true);
+        assertEquals(TEST_07_15.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(TEST_07_15.isSupported(ChronoField.PROLEPTIC_MONTH), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.YEAR), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.YEAR_OF_ERA), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.ERA), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_07_15.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
--- a/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKOffsetDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -126,6 +126,7 @@
 import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
+import java.time.temporal.TemporalUnit;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -555,6 +556,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported((TemporalField) null), false);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.NANO_OF_SECOND), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.NANO_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MICRO_OF_SECOND), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MICRO_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MILLI_OF_SECOND), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MILLI_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.SECOND_OF_MINUTE), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.SECOND_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MINUTE_OF_HOUR), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MINUTE_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.HOUR_OF_AMPM), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.HOUR_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.AMPM_OF_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.DAY_OF_WEEK), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.DAY_OF_MONTH), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.DAY_OF_YEAR), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.EPOCH_DAY), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.PROLEPTIC_MONTH), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.YEAR), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.YEAR_OF_ERA), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.ERA), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.INSTANT_SECONDS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoField.OFFSET_SECONDS), true);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.NANOS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.MICROS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.MILLIS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.SECONDS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.MINUTES), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.HOURS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.HALF_DAYS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.DAYS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.WEEKS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.MONTHS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.YEARS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.DECADES), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.CENTURIES), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.MILLENNIA), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.ERAS), true);
+        assertEquals(TEST_2008_6_30_11_30_59_000000500.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -1203,6 +1266,7 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
     }
 
     @Test
@@ -1214,6 +1278,7 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
     }
 
     @Test
@@ -1225,6 +1290,7 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
     }
 
     @Test
@@ -1236,6 +1302,7 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
     }
 
     @Test
@@ -1247,6 +1314,7 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
     }
 
     @Test
@@ -1258,6 +1326,7 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
     }
 
     @Test
@@ -1269,6 +1338,14 @@
         assertEquals(a.compareTo(a) == 0, true);
         assertEquals(b.compareTo(b) == 0, true);
         assertEquals(a.toInstant().compareTo(b.toInstant()) < 0, true);
+        assertEquals(OffsetDateTime.timeLineOrder().compare(a, b) < 0, true);
+    }
+
+    @Test
+    public void test_compareTo_bothInstantComparator() {
+        OffsetDateTime a = OffsetDateTime.of(2008, 6, 30, 11, 20, 40, 4, OFFSET_PTWO);
+        OffsetDateTime b = OffsetDateTime.of(2008, 6, 30, 10, 20, 40, 5, OFFSET_PONE);
+        assertEquals(a.compareTo(b), OffsetDateTime.timeLineOrder().compare(a,b), "for nano != nano, compareTo and timeLineOrder() should be the same");
     }
 
     @Test
--- a/jdk/test/java/time/tck/java/time/TCKOffsetTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKOffsetTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -543,6 +543,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_11_30_59_500_PONE.isSupported((TemporalField) null), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.NANO_OF_SECOND), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.NANO_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MICRO_OF_SECOND), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MICRO_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MILLI_OF_SECOND), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MILLI_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.SECOND_OF_MINUTE), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.SECOND_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MINUTE_OF_HOUR), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MINUTE_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.HOUR_OF_AMPM), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.HOUR_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.AMPM_OF_DAY), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.DAY_OF_WEEK), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.DAY_OF_MONTH), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.MONTH_OF_YEAR), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.PROLEPTIC_MONTH), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.YEAR), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.YEAR_OF_ERA), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.ERA), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoField.OFFSET_SECONDS), true);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_11_30_59_500_PONE.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.NANOS), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.MICROS), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.MILLIS), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.SECONDS), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.MINUTES), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.HOURS), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.HALF_DAYS), true);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.DAYS), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.WEEKS), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.MONTHS), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.YEARS), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.DECADES), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.CENTURIES), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.MILLENNIA), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.ERAS), false);
+        assertEquals(TEST_11_30_59_500_PONE.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -1038,7 +1100,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -1063,13 +1125,13 @@
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
-        long amount = offsetTime1.periodUntil(offsetTime2, unit);
+        long amount = offsetTime1.until(offsetTime2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit_negated(OffsetTime offsetTime1, OffsetTime offsetTime2, TemporalUnit unit, long expected) {
-        long amount = offsetTime2.periodUntil(offsetTime1, unit);
+        long amount = offsetTime2.until(offsetTime1, unit);
         assertEquals(amount, -expected);
     }
 
@@ -1077,14 +1139,14 @@
     public void test_periodUntil_InvalidType() {
         OffsetTime offsetTime = OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1));
         OffsetDateTime offsetDateTime = offsetTime.atDate(LocalDate.of(1980, 2, 10));
-        offsetTime.periodUntil(offsetDateTime, SECONDS);
+        offsetTime.until(offsetDateTime, SECONDS);
     }
 
     @Test(expectedExceptions=DateTimeException.class)
     public void test_periodUntil_InvalidTemporalUnit() {
         OffsetTime offsetTime1 = OffsetTime.of(LocalTime.of(1, 1, 1), ZoneOffset.ofHours(1));
         OffsetTime offsetTime2 = OffsetTime.of(LocalTime.of(2, 1, 1), ZoneOffset.ofHours(1));
-        offsetTime1.periodUntil(offsetTime2, MONTHS);
+        offsetTime1.until(offsetTime2, MONTHS);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKPeriod.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKPeriod.java	Tue Aug 06 16:54:56 2013 -0700
@@ -121,10 +121,23 @@
     }
 
     //-----------------------------------------------------------------------
+    // ofWeeks(int)
+    //-----------------------------------------------------------------------
+    @Test
+    public void factory_ofWeeks_int() {
+        assertPeriod(Period.ofWeeks(0), 0, 0, 0);
+        assertPeriod(Period.ofWeeks(1), 0, 0, 7);
+        assertPeriod(Period.ofWeeks(234), 0, 0, 234 * 7);
+        assertPeriod(Period.ofWeeks(-100), 0, 0, -100 * 7);
+        assertPeriod(Period.ofWeeks(Integer.MAX_VALUE / 7), 0, 0, (Integer.MAX_VALUE / 7) * 7);
+        assertPeriod(Period.ofWeeks(Integer.MIN_VALUE / 7), 0, 0, (Integer.MIN_VALUE / 7) * 7);
+    }
+
+    //-----------------------------------------------------------------------
     // ofDays(int)
     //-----------------------------------------------------------------------
     @Test
-    public void factory_ofDay_int() {
+    public void factory_ofDays_int() {
         assertPeriod(Period.ofDays(0), 0, 0, 0);
         assertPeriod(Period.ofDays(1), 0, 0, 1);
         assertPeriod(Period.ofDays(234), 0, 0, 234);
@@ -251,6 +264,18 @@
                 {"P" + Integer.MAX_VALUE + "M", Period.ofMonths(Integer.MAX_VALUE)},
                 {"P" + Integer.MIN_VALUE + "M", Period.ofMonths(Integer.MIN_VALUE)},
 
+                {"P1W", Period.ofDays(1 * 7)},
+                {"P12W", Period.ofDays(12 * 7)},
+                {"P7654321W", Period.ofDays(7654321 * 7)},
+                {"P+1W", Period.ofDays(1 * 7)},
+                {"P+12W", Period.ofDays(12 * 7)},
+                {"P+7654321W", Period.ofDays(7654321 * 7)},
+                {"P+0W", Period.ofDays(0)},
+                {"P0W", Period.ofDays(0)},
+                {"P-0W", Period.ofDays(0)},
+                {"P-25W", Period.ofDays(-25 * 7)},
+                {"P-7654321W", Period.ofDays(-7654321 * 7)},
+
                 {"P1D", Period.ofDays(1)},
                 {"P12D", Period.ofDays(12)},
                 {"P987654321D", Period.ofDays(987654321)},
@@ -274,6 +299,10 @@
                 {"P2Y-3M25D", Period.of(2, -3, 25)},
                 {"P2Y3M-25D", Period.of(2, 3, -25)},
                 {"P-2Y-3M-25D", Period.of(-2, -3, -25)},
+
+                {"P0Y0M0W0D", Period.of(0, 0, 0)},
+                {"P2Y3M4W25D", Period.of(2, 3, 4 * 7 + 25)},
+                {"P-2Y-3M-4W-25D", Period.of(-2, -3, -4 * 7 - 25)},
         };
     }
 
@@ -334,6 +363,13 @@
                 {"P1Y2Y"},
                 {"PT1M+3S"},
 
+                {"P1M2Y"},
+                {"P1W2Y"},
+                {"P1D2Y"},
+                {"P1W2M"},
+                {"P1D2M"},
+                {"P1D2W"},
+
                 {"PT1S1"},
                 {"PT1S."},
                 {"PT1SA"},
--- a/jdk/test/java/time/tck/java/time/TCKYear.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKYear.java	Tue Aug 06 16:54:56 2013 -0700
@@ -348,6 +348,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_2008.isSupported((TemporalField) null), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.NANO_OF_SECOND), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.NANO_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MICRO_OF_SECOND), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MICRO_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MILLI_OF_SECOND), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MILLI_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.SECOND_OF_MINUTE), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.SECOND_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MINUTE_OF_HOUR), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MINUTE_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.HOUR_OF_AMPM), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.HOUR_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.AMPM_OF_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.DAY_OF_WEEK), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.DAY_OF_MONTH), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.MONTH_OF_YEAR), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.PROLEPTIC_MONTH), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.YEAR), true);
+        assertEquals(TEST_2008.isSupported(ChronoField.YEAR_OF_ERA), true);
+        assertEquals(TEST_2008.isSupported(ChronoField.ERA), true);
+        assertEquals(TEST_2008.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_2008.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_2008.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.NANOS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.MICROS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.MILLIS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.SECONDS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.MINUTES), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.HOURS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.HALF_DAYS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.DAYS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.WEEKS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.MONTHS), false);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.YEARS), true);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.DECADES), true);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.CENTURIES), true);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.MILLENNIA), true);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.ERAS), true);
+        assertEquals(TEST_2008.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -829,7 +891,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -881,29 +943,29 @@
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit(Year year1, Year year2, TemporalUnit unit, long expected) {
-        long amount = year1.periodUntil(year2, unit);
+        long amount = year1.until(year2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit_negated(Year year1, Year year2, TemporalUnit unit, long expected) {
-        long amount = year2.periodUntil(year1, unit);
+        long amount = year2.until(year1, unit);
         assertEquals(amount, -expected);
     }
 
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
     public void test_periodUntil_TemporalUnit_unsupportedUnit() {
-        TEST_2008.periodUntil(TEST_2008, MONTHS);
+        TEST_2008.until(TEST_2008, MONTHS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullEnd() {
-        TEST_2008.periodUntil(null, DAYS);
+        TEST_2008.until(null, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullUnit() {
-        TEST_2008.periodUntil(TEST_2008, null);
+        TEST_2008.until(TEST_2008, null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKYearMonth.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKYearMonth.java	Tue Aug 06 16:54:56 2013 -0700
@@ -408,6 +408,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_2008_06.isSupported((TemporalField) null), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.NANO_OF_SECOND), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.NANO_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MICRO_OF_SECOND), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MICRO_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MILLI_OF_SECOND), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MILLI_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.SECOND_OF_MINUTE), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.SECOND_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MINUTE_OF_HOUR), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MINUTE_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.HOUR_OF_AMPM), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.HOUR_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.AMPM_OF_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.DAY_OF_WEEK), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.DAY_OF_MONTH), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.DAY_OF_YEAR), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.EPOCH_DAY), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.PROLEPTIC_MONTH), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.YEAR), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.YEAR_OF_ERA), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.ERA), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.INSTANT_SECONDS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoField.OFFSET_SECONDS), false);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_2008_06.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.NANOS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.MICROS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.MILLIS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.SECONDS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.MINUTES), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.HOURS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.HALF_DAYS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.DAYS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.WEEKS), false);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.MONTHS), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.YEARS), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.DECADES), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.CENTURIES), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.MILLENNIA), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.ERAS), true);
+        assertEquals(TEST_2008_06.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -1120,7 +1182,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal, TemporalUnit)
+    // until(Temporal, TemporalUnit)
     //-----------------------------------------------------------------------
     @DataProvider(name="periodUntilUnit")
     Object[][] data_periodUntilUnit() {
@@ -1200,29 +1262,29 @@
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
-        long amount = ym1.periodUntil(ym2, unit);
+        long amount = ym1.until(ym2, unit);
         assertEquals(amount, expected);
     }
 
     @Test(dataProvider="periodUntilUnit")
     public void test_periodUntil_TemporalUnit_negated(YearMonth ym1, YearMonth ym2, TemporalUnit unit, long expected) {
-        long amount = ym2.periodUntil(ym1, unit);
+        long amount = ym2.until(ym1, unit);
         assertEquals(amount, -expected);
     }
 
     @Test(expectedExceptions = UnsupportedTemporalTypeException.class)
     public void test_periodUntil_TemporalUnit_unsupportedUnit() {
-        TEST_2008_06.periodUntil(TEST_2008_06, HOURS);
+        TEST_2008_06.until(TEST_2008_06, HOURS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullEnd() {
-        TEST_2008_06.periodUntil(null, DAYS);
+        TEST_2008_06.until(null, DAYS);
     }
 
     @Test(expectedExceptions = NullPointerException.class)
     public void test_periodUntil_TemporalUnit_nullUnit() {
-        TEST_2008_06.periodUntil(TEST_2008_06, null);
+        TEST_2008_06.until(TEST_2008_06, null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/TCKZoneId.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKZoneId.java	Tue Aug 06 16:54:56 2013 -0700
@@ -465,6 +465,53 @@
     }
 
     //-----------------------------------------------------------------------
+    @DataProvider(name="prefixValid")
+    Object[][] data_prefixValid() {
+        return new Object[][] {
+                {"GMT", "+01:00"},
+                {"UTC", "+01:00"},
+                {"UT", "+01:00"},
+                {"", "+01:00"},
+        };
+    }
+
+    @Test(dataProvider="prefixValid")
+    public void test_prefixOfOffset(String prefix, String offset) {
+        ZoneOffset zoff = ZoneOffset.of(offset);
+        ZoneId zoneId = ZoneId.ofOffset(prefix, zoff);
+        assertEquals(zoneId.getId(), prefix + zoff.getId(), "in correct id for : " + prefix + ", zoff: " + zoff);
+
+    }
+
+    //-----------------------------------------------------------------------
+    @DataProvider(name="prefixInvalid")
+    Object[][] data_prefixInvalid() {
+        return new Object[][] {
+                {"GM", "+01:00"},
+                {"U", "+01:00"},
+                {"UTC0", "+01:00"},
+                {"A", "+01:00"},
+        };
+    }
+
+    @Test(dataProvider="prefixInvalid", expectedExceptions=java.lang.IllegalArgumentException.class)
+    public void test_invalidPrefixOfOffset(String prefix, String offset) {
+        ZoneOffset zoff = ZoneOffset.of(offset);
+        ZoneId zoneId = ZoneId.ofOffset(prefix, zoff);
+        fail("should have thrown an exception for prefix: " + prefix);
+    }
+
+    @Test(expectedExceptions=java.lang.NullPointerException.class)
+    public void test_nullPrefixOfOffset() {
+        ZoneId.ofOffset(null, ZoneOffset.ofTotalSeconds(1));
+    }
+
+    @Test(expectedExceptions=java.lang.NullPointerException.class)
+    public void test_nullOffsetOfOffset() {
+        ZoneId.ofOffset("GMT", null);
+    }
+
+    //-----------------------------------------------------------------------
     @DataProvider(name="offsetBasedValidOther")
     Object[][] data_offsetBasedValidOther() {
         return new Object[][] {
--- a/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/TCKZonedDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -127,6 +127,7 @@
 import java.time.temporal.TemporalAmount;
 import java.time.temporal.TemporalField;
 import java.time.temporal.TemporalQuery;
+import java.time.temporal.TemporalUnit;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -723,10 +724,12 @@
             public boolean isSupported(TemporalField field) {
                 return TEST_DATE_TIME_PARIS.toLocalDateTime().isSupported(field);
             }
+
             @Override
             public long getLong(TemporalField field) {
                 return TEST_DATE_TIME_PARIS.toLocalDateTime().getLong(field);
             }
+
             @SuppressWarnings("unchecked")
             @Override
             public <R> R query(TemporalQuery<R> query) {
@@ -791,17 +794,18 @@
     @DataProvider(name="parseAdditional")
     Object[][] data_parseAdditional() {
         return new Object[][] {
-                {"2012-06-30T12:30:40Z[GMT]", 2012, 6, 30, 12, 30, 40, 0, "Z"},
-                {"2012-06-30T12:30:40Z[UT]", 2012, 6, 30, 12, 30, 40, 0, "Z"},
-                {"2012-06-30T12:30:40Z[UTC]", 2012, 6, 30, 12, 30, 40, 0, "Z"},
+                {"2012-06-30T12:30:40Z[GMT]", 2012, 6, 30, 12, 30, 40, 0, "GMT"},
+                {"2012-06-30T12:30:40Z[UT]", 2012, 6, 30, 12, 30, 40, 0, "UT"},
+                {"2012-06-30T12:30:40Z[UTC]", 2012, 6, 30, 12, 30, 40, 0, "UTC"},
+                {"2012-06-30T12:30:40+01:00[Z]", 2012, 6, 30, 12, 30, 40, 0, "Z"},
                 {"2012-06-30T12:30:40+01:00[+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
-                {"2012-06-30T12:30:40+01:00[GMT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
-                {"2012-06-30T12:30:40+01:00[UT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
-                {"2012-06-30T12:30:40+01:00[UTC+01:00]", 2012, 6, 30, 12, 30, 40, 0, "+01:00"},
+                {"2012-06-30T12:30:40+01:00[GMT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT+01:00"},
+                {"2012-06-30T12:30:40+01:00[UT+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT+01:00"},
+                {"2012-06-30T12:30:40+01:00[UTC+01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC+01:00"},
                 {"2012-06-30T12:30:40-01:00[-01:00]", 2012, 6, 30, 12, 30, 40, 0, "-01:00"},
-                {"2012-06-30T12:30:40-01:00[GMT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "-01:00"},
-                {"2012-06-30T12:30:40-01:00[UT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "-01:00"},
-                {"2012-06-30T12:30:40-01:00[UTC-01:00]", 2012, 6, 30, 12, 30, 40, 0, "-01:00"},
+                {"2012-06-30T12:30:40-01:00[GMT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "GMT-01:00"},
+                {"2012-06-30T12:30:40-01:00[UT-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UT-01:00"},
+                {"2012-06-30T12:30:40-01:00[UTC-01:00]", 2012, 6, 30, 12, 30, 40, 0, "UTC-01:00"},
                 {"2012-06-30T12:30:40+01:00[Europe/London]", 2012, 6, 30, 12, 30, 40, 0, "Europe/London"},
         };
     }
@@ -900,6 +904,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // isSupported(TemporalField)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalField() {
+        assertEquals(TEST_DATE_TIME.isSupported((TemporalField) null), false);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.NANO_OF_SECOND), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.NANO_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MICRO_OF_SECOND), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MICRO_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MILLI_OF_SECOND), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MILLI_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.SECOND_OF_MINUTE), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.SECOND_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MINUTE_OF_HOUR), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MINUTE_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.HOUR_OF_AMPM), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.CLOCK_HOUR_OF_AMPM), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.HOUR_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.CLOCK_HOUR_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.AMPM_OF_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.DAY_OF_WEEK), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.DAY_OF_MONTH), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.DAY_OF_YEAR), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.EPOCH_DAY), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.ALIGNED_WEEK_OF_MONTH), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.ALIGNED_WEEK_OF_YEAR), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.MONTH_OF_YEAR), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.PROLEPTIC_MONTH), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.YEAR), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.YEAR_OF_ERA), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.ERA), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.INSTANT_SECONDS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoField.OFFSET_SECONDS), true);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupported(TemporalUnit)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_isSupported_TemporalUnit() {
+        assertEquals(TEST_DATE_TIME.isSupported((TemporalUnit) null), false);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.NANOS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.MICROS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.MILLIS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.SECONDS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.MINUTES), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.HOURS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.HALF_DAYS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.DAYS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.WEEKS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.MONTHS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.YEARS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.DECADES), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.CENTURIES), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.MILLENNIA), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.ERAS), true);
+        assertEquals(TEST_DATE_TIME.isSupported(ChronoUnit.FOREVER), false);
+    }
+
+    //-----------------------------------------------------------------------
     // get(TemporalField)
     //-----------------------------------------------------------------------
     @Test
@@ -1977,37 +2043,37 @@
     }
 
     //-----------------------------------------------------------------------
-    // periodUntil(Temporal,TemporalUnit)
+    // until(Temporal,TemporalUnit)
     //-----------------------------------------------------------------------
     // TODO: more tests for period between two different zones
-    // compare results to OffsetDateTime.periodUntil, especially wrt dates
+    // compare results to OffsetDateTime.until, especially wrt dates
 
     @Test(dataProvider="plusDays")
     public void test_periodUntil_days(ZonedDateTime base, long expected, ZonedDateTime end) {
         if (base.toLocalTime().equals(end.toLocalTime()) == false) {
             return;  // avoid DST gap input values
         }
-        assertEquals(base.periodUntil(end, DAYS), expected);
+        assertEquals(base.until(end, DAYS), expected);
     }
 
     @Test(dataProvider="plusTime")
     public void test_periodUntil_hours(ZonedDateTime base, long expected, ZonedDateTime end) {
-        assertEquals(base.periodUntil(end, HOURS), expected);
+        assertEquals(base.until(end, HOURS), expected);
     }
 
     @Test(dataProvider="plusTime")
     public void test_periodUntil_minutes(ZonedDateTime base, long expected, ZonedDateTime end) {
-        assertEquals(base.periodUntil(end, MINUTES), expected * 60);
+        assertEquals(base.until(end, MINUTES), expected * 60);
     }
 
     @Test(dataProvider="plusTime")
     public void test_periodUntil_seconds(ZonedDateTime base, long expected, ZonedDateTime end) {
-        assertEquals(base.periodUntil(end, SECONDS), expected * 3600);
+        assertEquals(base.until(end, SECONDS), expected * 3600);
     }
 
     @Test(dataProvider="plusTime")
     public void test_periodUntil_nanos(ZonedDateTime base, long expected, ZonedDateTime end) {
-        assertEquals(base.periodUntil(end, NANOS), expected * 3600_000_000_000L);
+        assertEquals(base.until(end, NANOS), expected * 3600_000_000_000L);
     }
 
     @Test
@@ -2017,13 +2083,13 @@
         ZonedDateTime oneAm1 = LocalDateTime.of(2012, 6, 29, 1, 0).atZone(ZONE_PARIS);
         ZonedDateTime midnightParis2 = LocalDate.of(2012, 6, 30).atStartOfDay(ZONE_PARIS);
 
-        assertEquals(midnightLondon.periodUntil(midnightParis1, HOURS), 23);
-        assertEquals(midnightLondon.periodUntil(oneAm1, HOURS), 24);
-        assertEquals(midnightLondon.periodUntil(midnightParis2, HOURS), 23 + 24);
+        assertEquals(midnightLondon.until(midnightParis1, HOURS), 23);
+        assertEquals(midnightLondon.until(oneAm1, HOURS), 24);
+        assertEquals(midnightLondon.until(midnightParis2, HOURS), 23 + 24);
 
-        assertEquals(midnightLondon.periodUntil(midnightParis1, DAYS), 0);
-        assertEquals(midnightLondon.periodUntil(oneAm1, DAYS), 1);
-        assertEquals(midnightLondon.periodUntil(midnightParis2, DAYS), 1);
+        assertEquals(midnightLondon.until(midnightParis1, DAYS), 0);
+        assertEquals(midnightLondon.until(oneAm1, DAYS), 1);
+        assertEquals(midnightLondon.until(midnightParis2, DAYS), 1);
     }
 
     @Test
@@ -2031,8 +2097,8 @@
         ZonedDateTime before = TEST_PARIS_GAP_2008_03_30_02_30.withHour(0).withMinute(0).atZone(ZONE_PARIS);
         ZonedDateTime after = TEST_PARIS_GAP_2008_03_30_02_30.withHour(0).withMinute(0).plusDays(1).atZone(ZONE_PARIS);
 
-        assertEquals(before.periodUntil(after, HOURS), 23);
-        assertEquals(before.periodUntil(after, DAYS), 1);
+        assertEquals(before.until(after, HOURS), 23);
+        assertEquals(before.until(after, DAYS), 1);
     }
 
     @Test
@@ -2040,23 +2106,23 @@
         ZonedDateTime before = TEST_PARIS_OVERLAP_2008_10_26_02_30.withHour(0).withMinute(0).atZone(ZONE_PARIS);
         ZonedDateTime after = TEST_PARIS_OVERLAP_2008_10_26_02_30.withHour(0).withMinute(0).plusDays(1).atZone(ZONE_PARIS);
 
-        assertEquals(before.periodUntil(after, HOURS), 25);
-        assertEquals(before.periodUntil(after, DAYS), 1);
+        assertEquals(before.until(after, HOURS), 25);
+        assertEquals(before.until(after, DAYS), 1);
     }
 
     @Test(expectedExceptions=DateTimeException.class)
     public void test_periodUntil_differentType() {
-        TEST_DATE_TIME_PARIS.periodUntil(TEST_LOCAL_2008_06_30_11_30_59_500, DAYS);
+        TEST_DATE_TIME_PARIS.until(TEST_LOCAL_2008_06_30_11_30_59_500, DAYS);
     }
 
     @Test(expectedExceptions=NullPointerException.class)
     public void test_periodUntil_nullTemporal() {
-        TEST_DATE_TIME_PARIS.periodUntil(null, DAYS);
+        TEST_DATE_TIME_PARIS.until(null, DAYS);
     }
 
     @Test(expectedExceptions=NullPointerException.class)
     public void test_periodUntil_nullUnit() {
-        TEST_DATE_TIME_PARIS.periodUntil(TEST_DATE_TIME_PARIS, null);
+        TEST_DATE_TIME_PARIS.until(TEST_DATE_TIME_PARIS, null);
     }
 
     //-----------------------------------------------------------------------
--- a/jdk/test/java/time/tck/java/time/chrono/CopticDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/CopticDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -87,7 +87,7 @@
  * This class is immutable and thread-safe.
  */
 public final class CopticDate
-        implements ChronoLocalDate<CopticDate>, Serializable {
+        implements ChronoLocalDate, Serializable {
 
     /**
      * Serialization version.
@@ -202,7 +202,7 @@
                 }
                 return getChronology().range(f);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
@@ -224,7 +224,7 @@
                 case YEAR: return prolepticYear;
                 case ERA: return (prolepticYear >= 1 ? 1 : 0);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.getFrom(this);
     }
@@ -249,7 +249,7 @@
                 case YEAR: return resolvePreviousValid(nvalue, month, day);
                 case ERA: return resolvePreviousValid(1 - prolepticYear, month, day);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.adjustInto(this, newValue);
     }
@@ -268,7 +268,7 @@
                 case CENTURIES: return plusYears(Math.multiplyExact(amountToAdd, 100));
                 case MILLENNIA: return plusYears(Math.multiplyExact(amountToAdd, 1000));
             }
-            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
         return unit.addTo(this, amountToAdd);
     }
@@ -297,22 +297,22 @@
     }
 
     @Override
-    public long periodUntil(Temporal endDateTime, TemporalUnit unit) {
+    public long until(Temporal endDateTime, TemporalUnit unit) {
         if (endDateTime instanceof ChronoLocalDate == false) {
             throw new DateTimeException("Unable to calculate period between objects of two different types");
         }
-        ChronoLocalDate<?> end = (ChronoLocalDate<?>) endDateTime;
+        ChronoLocalDate end = (ChronoLocalDate) endDateTime;
         if (getChronology().equals(end.getChronology()) == false) {
             throw new DateTimeException("Unable to calculate period between two different chronologies");
         }
         if (unit instanceof ChronoUnit) {
-            return LocalDate.from(this).periodUntil(end, unit);  // TODO: this is wrong
+            return LocalDate.from(this).until(end, unit);  // TODO: this is wrong
         }
         return unit.between(this, endDateTime);
     }
 
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
+    public Period until(ChronoLocalDate endDate) {
         // TODO: untested
         CopticDate end = (CopticDate) getChronology().date(endDate);
         long totalMonths = (end.prolepticYear - this.prolepticYear) * 13 + (end.month - this.month);  // safe
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -113,10 +113,10 @@
     @Test(dataProvider="calendars")
     public void test_badWithAdjusterChrono(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
+        ChronoLocalDate date = chrono.date(refDate);
         for (Chronology[] clist : data_of_calendars()) {
             Chronology chrono2 = clist[0];
-            ChronoLocalDate<?> date2 = chrono2.date(refDate);
+            ChronoLocalDate date2 = chrono2.date(refDate);
             TemporalAdjuster adjuster = new FixedAdjuster(date2);
             if (chrono != chrono2) {
                 try {
@@ -127,7 +127,7 @@
                 }
             } else {
                 // Same chronology,
-                ChronoLocalDate<?> result = date.with(adjuster);
+                ChronoLocalDate result = date.with(adjuster);
                 assertEquals(result, date2, "WithAdjuster failed to replace date");
             }
         }
@@ -136,10 +136,10 @@
     @Test(dataProvider="calendars")
     public void test_badPlusAdjusterChrono(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
+        ChronoLocalDate date = chrono.date(refDate);
         for (Chronology[] clist : data_of_calendars()) {
             Chronology chrono2 = clist[0];
-            ChronoLocalDate<?> date2 = chrono2.date(refDate);
+            ChronoLocalDate date2 = chrono2.date(refDate);
             TemporalAmount adjuster = new FixedAdjuster(date2);
             if (chrono != chrono2) {
                 try {
@@ -150,7 +150,7 @@
                 }
             } else {
                 // Same chronology,
-                ChronoLocalDate<?> result = date.plus(adjuster);
+                ChronoLocalDate result = date.plus(adjuster);
                 assertEquals(result, date2, "WithAdjuster failed to replace date");
             }
         }
@@ -159,10 +159,10 @@
     @Test(dataProvider="calendars")
     public void test_badMinusAdjusterChrono(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
+        ChronoLocalDate date = chrono.date(refDate);
         for (Chronology[] clist : data_of_calendars()) {
             Chronology chrono2 = clist[0];
-            ChronoLocalDate<?> date2 = chrono2.date(refDate);
+            ChronoLocalDate date2 = chrono2.date(refDate);
             TemporalAmount adjuster = new FixedAdjuster(date2);
             if (chrono != chrono2) {
                 try {
@@ -173,7 +173,7 @@
                 }
             } else {
                 // Same chronology,
-                ChronoLocalDate<?> result = date.minus(adjuster);
+                ChronoLocalDate result = date.minus(adjuster);
                 assertEquals(result, date2, "WithAdjuster failed to replace date");
             }
         }
@@ -182,10 +182,10 @@
     @Test(dataProvider="calendars")
     public void test_badPlusTemporalUnitChrono(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
+        ChronoLocalDate date = chrono.date(refDate);
         for (Chronology[] clist : data_of_calendars()) {
             Chronology chrono2 = clist[0];
-            ChronoLocalDate<?> date2 = chrono2.date(refDate);
+            ChronoLocalDate date2 = chrono2.date(refDate);
             TemporalUnit adjuster = new FixedTemporalUnit(date2);
             if (chrono != chrono2) {
                 try {
@@ -197,7 +197,7 @@
                 }
             } else {
                 // Same chronology,
-                ChronoLocalDate<?> result = date.plus(1, adjuster);
+                ChronoLocalDate result = date.plus(1, adjuster);
                 assertEquals(result, date2, "WithAdjuster failed to replace date");
             }
         }
@@ -206,10 +206,10 @@
     @Test(dataProvider="calendars")
     public void test_badMinusTemporalUnitChrono(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
+        ChronoLocalDate date = chrono.date(refDate);
         for (Chronology[] clist : data_of_calendars()) {
             Chronology chrono2 = clist[0];
-            ChronoLocalDate<?> date2 = chrono2.date(refDate);
+            ChronoLocalDate date2 = chrono2.date(refDate);
             TemporalUnit adjuster = new FixedTemporalUnit(date2);
             if (chrono != chrono2) {
                 try {
@@ -221,7 +221,7 @@
                 }
             } else {
                 // Same chronology,
-                ChronoLocalDate<?> result = date.minus(1, adjuster);
+                ChronoLocalDate result = date.minus(1, adjuster);
                 assertEquals(result, date2, "WithAdjuster failed to replace date");
             }
         }
@@ -230,10 +230,10 @@
     @Test(dataProvider="calendars")
     public void test_badTemporalFieldChrono(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
+        ChronoLocalDate date = chrono.date(refDate);
         for (Chronology[] clist : data_of_calendars()) {
             Chronology chrono2 = clist[0];
-            ChronoLocalDate<?> date2 = chrono2.date(refDate);
+            ChronoLocalDate date2 = chrono2.date(refDate);
             TemporalField adjuster = new FixedTemporalField(date2);
             if (chrono != chrono2) {
                 try {
@@ -245,7 +245,7 @@
                 }
             } else {
                 // Same chronology,
-                ChronoLocalDate<?> result = date.with(adjuster, 1);
+                ChronoLocalDate result = date.with(adjuster, 1);
                 assertEquals(result, date2, "TemporalField doSet failed to replace date");
             }
         }
@@ -258,7 +258,7 @@
     public void test_date_comparisons(Chronology chrono) {
         List<ChronoLocalDate> dates = new ArrayList<>();
 
-        ChronoLocalDate<?> date = chrono.date(LocalDate.of(2013, 1, 1));
+        ChronoLocalDate date = chrono.date(LocalDate.of(2013, 1, 1));
 
         // Insert dates in order, no duplicates
         dates.add(date.minus(1, ChronoUnit.YEARS));
@@ -273,17 +273,17 @@
 
         // Check these dates against the corresponding dates for every calendar
         for (Chronology[] clist : data_of_calendars()) {
-            List<ChronoLocalDate<?>> otherDates = new ArrayList<>();
+            List<ChronoLocalDate> otherDates = new ArrayList<>();
             Chronology chrono2 = clist[0];
-            for (ChronoLocalDate<?> d : dates) {
+            for (ChronoLocalDate d : dates) {
                 otherDates.add(chrono2.date(d));
             }
 
             // Now compare  the sequence of original dates with the sequence of converted dates
             for (int i = 0; i < dates.size(); i++) {
-                ChronoLocalDate<?> a = dates.get(i);
+                ChronoLocalDate a = dates.get(i);
                 for (int j = 0; j < otherDates.size(); j++) {
-                    ChronoLocalDate<?> b = otherDates.get(j);
+                    ChronoLocalDate b = otherDates.get(j);
                     int cmp = ChronoLocalDate.timeLineOrder().compare(a, b);
                     if (i < j) {
                         assertTrue(cmp < 0, a + " compare " + b);
@@ -312,7 +312,7 @@
     @Test( dataProvider="calendars")
     public void test_ChronoSerialization(Chronology chrono) throws Exception {
         LocalDate ref = LocalDate.of(2013, 1, 5);
-        ChronoLocalDate<?> orginal = chrono.date(ref);
+        ChronoLocalDate orginal = chrono.date(ref);
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream(baos);
         out.writeObject(orginal);
@@ -320,7 +320,7 @@
         ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
         ObjectInputStream in = new ObjectInputStream(bais);
         @SuppressWarnings("unchecked")
-        ChronoLocalDate<?> ser = (ChronoLocalDate<?>) in.readObject();
+        ChronoLocalDate ser = (ChronoLocalDate) in.readObject();
         assertEquals(ser, orginal, "deserialized date is wrong");
     }
 
@@ -328,12 +328,12 @@
     @Test(dataProvider="calendars")
     public void test_from_TemporalAccessor(Chronology chrono) {
         LocalDate refDate = LocalDate.of(2013, 1, 1);
-        ChronoLocalDate<?> date = chrono.date(refDate);
-        ChronoLocalDate<?> test1 = ChronoLocalDate.from(date);
+        ChronoLocalDate date = chrono.date(refDate);
+        ChronoLocalDate test1 = ChronoLocalDate.from(date);
         assertEquals(test1, date);
-        ChronoLocalDate<?> test2 = ChronoLocalDate.from(date.atTime(LocalTime.of(12, 30)));
+        ChronoLocalDate test2 = ChronoLocalDate.from(date.atTime(LocalTime.of(12, 30)));
         assertEquals(test2, date);
-        ChronoLocalDate<?> test3 = ChronoLocalDate.from(date.atTime(LocalTime.of(12, 30)).atZone(ZoneOffset.UTC));
+        ChronoLocalDate test3 = ChronoLocalDate.from(date.atTime(LocalTime.of(12, 30)).atZone(ZoneOffset.UTC));
         assertEquals(test3, date);
     }
 
@@ -397,11 +397,6 @@
         }
 
         @Override
-        public String getName() {
-            return "FixedTemporalUnit";
-        }
-
-        @Override
         public Duration getDuration() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -412,6 +407,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(Temporal temporal) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -426,6 +431,11 @@
         public long between(Temporal temporal1, Temporal temporal2) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
+
+        @Override
+        public String toString() {
+            return "FixedTemporalUnit";
+        }
     }
 
     /**
@@ -439,11 +449,6 @@
         }
 
         @Override
-        public String getName() {
-            return "FixedTemporalField";
-        }
-
-        @Override
         public TemporalUnit getBaseUnit() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -459,6 +464,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(TemporalAccessor temporal) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -478,5 +493,10 @@
         public <R extends Temporal> R adjustInto(R temporal, long newValue) {
             return (R) this.temporal;
         }
+
+        @Override
+        public String toString() {
+            return "FixedTemporalField";
+        }
     }
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -411,11 +411,6 @@
         }
 
         @Override
-        public String getName() {
-            return "FixedTemporalUnit";
-        }
-
-        @Override
         public Duration getDuration() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -426,6 +421,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(Temporal temporal) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -440,6 +445,11 @@
         public long between(Temporal temporal1, Temporal temporal2) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
+
+        @Override
+        public String toString() {
+            return "FixedTemporalUnit";
+        }
     }
 
     /**
@@ -453,11 +463,6 @@
         }
 
         @Override
-        public String getName() {
-            return "FixedTemporalField";
-        }
-
-        @Override
         public TemporalUnit getBaseUnit() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -473,6 +478,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(TemporalAccessor temporal) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -492,5 +507,10 @@
         public <R extends Temporal> R adjustInto(R temporal, long newValue) {
             return (R) this.temporal;
         }
+
+        @Override
+        public String toString() {
+            return "FixedTemporalField";
+        }
     }
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -256,7 +256,7 @@
     }
 
     //-----------------------------------------------------------------------
-    // isBefore, isAfter, isEqual, INSTANT_COMPARATOR  test a Chronology against the other Chronos
+    // isBefore, isAfter, isEqual, timeLineOrder()  test a Chronology against the other Chronos
     //-----------------------------------------------------------------------
     @Test(dataProvider="calendars")
     public void test_zonedDateTime_comparisons(Chronology chrono) {
@@ -413,11 +413,6 @@
         }
 
         @Override
-        public String getName() {
-            return "FixedTemporalUnit";
-        }
-
-        @Override
         public Duration getDuration() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -428,6 +423,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(Temporal temporal) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -442,6 +447,12 @@
         public long between(Temporal temporal1, Temporal temporal2) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
+
+        @Override
+        public String toString() {
+            return "FixedTemporalUnit";
+        }
+
     }
 
     /**
@@ -455,11 +466,6 @@
         }
 
         @Override
-        public String getName() {
-            return "FixedTemporalField";
-        }
-
-        @Override
         public TemporalUnit getBaseUnit() {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -475,6 +481,16 @@
         }
 
         @Override
+        public boolean isDateBased() {
+            return false;
+        }
+
+        @Override
+        public boolean isTimeBased() {
+            return false;
+        }
+
+        @Override
         public boolean isSupportedBy(TemporalAccessor temporal) {
             throw new UnsupportedOperationException("Not supported yet.");
         }
@@ -494,5 +510,10 @@
         public <R extends Temporal> R adjustInto(R temporal, long newValue) {
             return (R) this.temporal;
         }
+
+        @Override
+        public String toString() {
+            return "FixedTemporalField";
+        }
     }
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -64,18 +64,27 @@
 import static org.testng.Assert.assertSame;
 import static org.testng.Assert.assertTrue;
 
+import java.util.Locale;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.time.ZoneId;
+import java.time.Clock;
 import java.time.DateTimeException;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.Chronology;
 import java.time.chrono.HijrahChronology;
+import java.time.chrono.HijrahEra;
 import java.time.chrono.IsoChronology;
+import java.time.chrono.IsoEra;
 import java.time.chrono.JapaneseChronology;
+import java.time.chrono.JapaneseEra;
 import java.time.chrono.MinguoChronology;
+import java.time.chrono.MinguoEra;
 import java.time.chrono.ThaiBuddhistChronology;
+import java.time.chrono.ThaiBuddhistEra;
+import java.time.format.TextStyle;
 import java.time.temporal.ChronoField;
 import java.util.Locale;
 import java.util.Set;
@@ -133,15 +142,35 @@
                 + ", expected >= " + data_of_calendars().length);
     }
 
+    //-----------------------------------------------------------------------
+    // getDisplayName()
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "calendarDisplayName")
+    Object[][] data_of_calendarDisplayNames() {
+        return new Object[][] {
+                    {"Hijrah", "Hijrah-umalqura"},
+                    {"ISO", "ISO"},
+                    {"Japanese", "Japanese Calendar"},
+                    {"Minguo", "Minguo Calendar"},
+                    {"ThaiBuddhist", "Buddhist Calendar"},
+                };
+    }
+
+    @Test(dataProvider = "calendarDisplayName")
+    public void test_getDisplayName(String chronoId, String calendarDisplayName) {
+        Chronology chrono = Chronology.of(chronoId);
+        assertEquals(chrono.getDisplayName(TextStyle.FULL, Locale.ENGLISH), calendarDisplayName);
+    }
+
     /**
      * Compute the number of days from the Epoch and compute the date from the number of days.
      */
     @Test(dataProvider = "calendarNameAndType")
     public void test_epoch(String name, String alias) {
         Chronology chrono = Chronology.of(name); // a chronology. In practice this is rarely hardcoded
-        ChronoLocalDate<?> date1 = chrono.dateNow();
+        ChronoLocalDate date1 = chrono.dateNow();
         long epoch1 = date1.getLong(ChronoField.EPOCH_DAY);
-        ChronoLocalDate<?> date2 = date1.with(ChronoField.EPOCH_DAY, epoch1);
+        ChronoLocalDate date2 = date1.with(ChronoField.EPOCH_DAY, epoch1);
         assertEquals(date1, date2, "Date from epoch day is not same date: " + date1 + " != " + date2);
         long epoch2 = date1.getLong(ChronoField.EPOCH_DAY);
         assertEquals(epoch1, epoch2, "Epoch day not the same: " + epoch1 + " != " + epoch2);
@@ -150,9 +179,9 @@
     @Test(dataProvider = "calendarNameAndType")
     public void test_dateEpochDay(String name, String alias) {
         Chronology chrono = Chronology.of(name);
-        ChronoLocalDate<?> date = chrono.dateNow();
+        ChronoLocalDate date = chrono.dateNow();
         long epochDay = date.getLong(ChronoField.EPOCH_DAY);
-        ChronoLocalDate<?> test = chrono.dateEpochDay(epochDay);
+        ChronoLocalDate test = chrono.dateEpochDay(epochDay);
         assertEquals(test, date);
     }
 
@@ -184,6 +213,101 @@
         assertEquals(Chronology.ofLocale(locale), chrono);
     }
 
+    //-----------------------------------------------------------------------
+    // dateNow()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_MinguoChronology_dateNow() {
+        ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
+        Clock clock = Clock.system(zoneId_paris);
+
+        Chronology chrono = Chronology.of("Minguo");
+        assertEquals(chrono.dateNow(), MinguoChronology.INSTANCE.dateNow());
+        assertEquals(chrono.dateNow(zoneId_paris), MinguoChronology.INSTANCE.dateNow(zoneId_paris));
+        assertEquals(chrono.dateNow(clock), MinguoChronology.INSTANCE.dateNow(clock));
+    }
+
+    @Test
+    public void test_IsoChronology_dateNow() {
+        ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
+        Clock clock = Clock.system(zoneId_paris);
+
+        Chronology chrono = Chronology.of("ISO");
+        assertEquals(chrono.dateNow(), IsoChronology.INSTANCE.dateNow());
+        assertEquals(chrono.dateNow(zoneId_paris), IsoChronology.INSTANCE.dateNow(zoneId_paris));
+        assertEquals(chrono.dateNow(clock), IsoChronology.INSTANCE.dateNow(clock));
+    }
+
+    @Test
+    public void test_JapaneseChronology_dateNow() {
+        ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
+        Clock clock = Clock.system(zoneId_paris);
+
+        Chronology chrono = Chronology.of("Japanese");
+        assertEquals(chrono.dateNow(), JapaneseChronology.INSTANCE.dateNow());
+        assertEquals(chrono.dateNow(zoneId_paris), JapaneseChronology.INSTANCE.dateNow(zoneId_paris));
+        assertEquals(chrono.dateNow(clock), JapaneseChronology.INSTANCE.dateNow(clock));
+    }
+
+    @Test
+    public void test_ThaiBuddhistChronology_dateNow() {
+        ZoneId zoneId_paris = ZoneId.of("Europe/Paris");
+        Clock clock = Clock.system(zoneId_paris);
+
+        Chronology chrono = Chronology.of("ThaiBuddhist");
+        assertEquals(chrono.dateNow(), ThaiBuddhistChronology.INSTANCE.dateNow());
+        assertEquals(chrono.dateNow(zoneId_paris), ThaiBuddhistChronology.INSTANCE.dateNow(zoneId_paris));
+        assertEquals(chrono.dateNow(clock), ThaiBuddhistChronology.INSTANCE.dateNow(clock));
+    }
+
+    //-----------------------------------------------------------------------
+    // dateYearDay() and date()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_HijrahChronology_dateYearDay() {
+        Chronology chrono = Chronology.of("Hijrah");
+        ChronoLocalDate date1 = chrono.dateYearDay(HijrahEra.AH, 1434, 178);
+        ChronoLocalDate date2 = chrono.date(HijrahEra.AH, 1434, 7, 1);
+        assertEquals(date1, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178));
+        assertEquals(date2, HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178));
+    }
+
+    @Test
+    public void test_MinguoChronology_dateYearDay() {
+        Chronology chrono = Chronology.of("Minguo");
+        ChronoLocalDate date1 = chrono.dateYearDay(MinguoEra.ROC, 5, 60);
+        ChronoLocalDate date2 = chrono.date(MinguoEra.ROC, 5, 2, 29);
+        assertEquals(date1, MinguoChronology.INSTANCE.dateYearDay(MinguoEra.ROC, 5, 60));
+        assertEquals(date2, MinguoChronology.INSTANCE.dateYearDay(MinguoEra.ROC, 5, 60));
+    }
+
+    @Test
+    public void test_IsoChronology_dateYearDay() {
+        Chronology chrono = Chronology.of("ISO");
+        ChronoLocalDate date1 = chrono.dateYearDay(IsoEra.CE, 5, 60);
+        ChronoLocalDate date2 = chrono.date(IsoEra.CE, 5, 3, 1);
+        assertEquals(date1, IsoChronology.INSTANCE.dateYearDay(IsoEra.CE, 5, 60));
+        assertEquals(date2, IsoChronology.INSTANCE.dateYearDay(IsoEra.CE, 5, 60));
+    }
+
+    @Test
+    public void test_JapaneseChronology_dateYearDay() {
+        Chronology chrono = Chronology.of("Japanese");
+        ChronoLocalDate date1 = chrono.dateYearDay(JapaneseEra.HEISEI, 8, 60);
+        ChronoLocalDate date2 = chrono.date(JapaneseEra.HEISEI, 8, 2, 29);
+        assertEquals(date1, JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 8, 60));
+        assertEquals(date2, JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 8, 60));
+    }
+
+    @Test
+    public void test_ThaiBuddhistChronology_dateYearDay() {
+        Chronology chrono = Chronology.of("ThaiBuddhist");
+        ChronoLocalDate date1 = chrono.dateYearDay(ThaiBuddhistEra.BE, 2459, 60);
+        ChronoLocalDate date2 = chrono.date(ThaiBuddhistEra.BE, 2459, 2, 29);
+        assertEquals(date1, ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2459, 60));
+        assertEquals(date2, ThaiBuddhistChronology.INSTANCE.dateYearDay(ThaiBuddhistEra.BE, 2459, 60));
+    }
+
     /**
      * Test lookup by calendarType of each chronology.
      * Verify that the calendar can be found by {@link java.time.chrono.Chronology#ofLocale}.
--- a/jdk/test/java/time/tck/java/time/chrono/TCKHijrahChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKHijrahChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -56,18 +56,13 @@
  */
 package tck.java.time.chrono;
 
-import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import java.time.Clock;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
-import java.time.Clock;
 import java.time.DateTimeException;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.Month;
-import java.time.Period;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.chrono.ChronoLocalDate;
@@ -77,11 +72,12 @@
 import java.time.chrono.HijrahDate;
 import java.time.chrono.HijrahEra;
 import java.time.chrono.IsoChronology;
-import java.time.chrono.MinguoChronology;
-import java.time.chrono.MinguoDate;
-import java.time.temporal.ChronoUnit;
-import java.time.temporal.TemporalAdjuster;
+import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoField;
+import java.time.temporal.TemporalField;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
@@ -106,49 +102,7 @@
         Assert.assertEquals(test, c);
     }
 
-    //-----------------------------------------------------------------------
-    // creation, toLocalDate()
-    //-----------------------------------------------------------------------
-    @DataProvider(name="samples")
-    Object[][] data_samples() {
-        return new Object[][] {
-            //{HijrahChronology.INSTANCE.date(1320, 1, 1), LocalDate.of(1902, 4, 9)},
-            //{HijrahChronology.INSTANCE.date(1320, 1, 2), LocalDate.of(1902, 4, 10)},
-            //{HijrahChronology.INSTANCE.date(1320, 1, 3), LocalDate.of(1902, 4, 11)},
-
-            //{HijrahChronology.INSTANCE.date(1322, 1, 1), LocalDate.of(1904, 3, 18)},
-            //{HijrahChronology.INSTANCE.date(1323, 1, 1), LocalDate.of(1905, 3, 7)},
-            //{HijrahChronology.INSTANCE.date(1323, 12, 6), LocalDate.of(1906, 1, 30)},
-            //{HijrahChronology.INSTANCE.date(1324, 1, 1), LocalDate.of(1906, 2, 24)},
-            //{HijrahChronology.INSTANCE.date(1324, 7, 3), LocalDate.of(1906, 8, 23)},
-            //{HijrahChronology.INSTANCE.date(1324, 7, 4), LocalDate.of(1906, 8, 24)},
-            //{HijrahChronology.INSTANCE.date(1325, 1, 1), LocalDate.of(1907, 2, 13)},
-
-            {HijrahChronology.INSTANCE.date(1434, 7, 1), LocalDate.of(2013, 5, 11)},
-            {HijrahChronology.INSTANCE.date(HijrahEra.AH, 1434, 7, 1), LocalDate.of(2013, 5, 11)},
-            {HijrahChronology.INSTANCE.dateYearDay(HijrahEra.AH, 1434, 178), LocalDate.of(2013, 5, 11)},
-            {HijrahChronology.INSTANCE.dateYearDay(1434, 178), LocalDate.of(2013, 5, 11)},
-            //{HijrahChronology.INSTANCE.date(1500, 3, 3), LocalDate.of(2079, 1, 5)},
-            //{HijrahChronology.INSTANCE.date(1500, 10, 28), LocalDate.of(2079, 8, 25)},
-            //{HijrahChronology.INSTANCE.date(1500, 10, 29), LocalDate.of(2079, 8, 26)},
-        };
-    }
-
-    @Test(dataProvider="samples")
-    public void test_toLocalDate(ChronoLocalDate<?> hijrahDate, LocalDate iso) {
-        assertEquals(LocalDate.from(hijrahDate), iso);
-    }
-
-    @Test(dataProvider="samples")
-    public void test_fromCalendrical(ChronoLocalDate<?> hijrahDate, LocalDate iso) {
-        assertEquals(HijrahChronology.INSTANCE.date(iso), hijrahDate);
-    }
-
-    @Test(dataProvider="samples")
-    public void test_dayOfWeekEqualIsoDayOfWeek(ChronoLocalDate<?> hijrahDate, LocalDate iso) {
-        assertEquals(hijrahDate.get(DAY_OF_WEEK), iso.get(DAY_OF_WEEK), "Hijrah day of week should be same as ISO day of week");
-    }
-
+    // Tests for dateNow() method
     @Test
     public void test_dateNow(){
         assertEquals(HijrahChronology.INSTANCE.dateNow(), HijrahDate.now()) ;
@@ -169,31 +123,41 @@
         assertEquals(HijrahChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), HijrahChronology.INSTANCE.dateNow(Clock.systemUTC())) ;
     }
 
+    // Sample invalid dates
     @DataProvider(name="badDates")
     Object[][] data_badDates() {
         return new Object[][] {
-            {1434, 0, 0},
-
+            {1299, 12, 29},
+            {1320, 1, 29 + 1},
+            {1320, 12, 29 + 1},
             {1434, -1, 1},
+            {1605, 1, 29},
             {1434, 0, 1},
             {1434, 14, 1},
             {1434, 15, 1},
-
             {1434, 1, -1},
             {1434, 1, 0},
             {1434, 1, 32},
-
             {1434, 12, -1},
             {1434, 12, 0},
             {1434, 12, 32},
         };
     }
 
+    // This is a negative test to verify if the API throws exception if an invalid date is provided
     @Test(dataProvider="badDates", expectedExceptions=DateTimeException.class)
     public void test_badDates(int year, int month, int dom) {
         HijrahChronology.INSTANCE.date(year, month, dom);
     }
 
+    // Negative test or dateYearDay with day too large
+    @Test(expectedExceptions=java.time.DateTimeException.class)
+    public void test_ofYearDayTooLarge() {
+        int year = 1435;
+        int lengthOfYear = HijrahChronology.INSTANCE.dateYearDay(year, 1).lengthOfYear();
+        HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(year, lengthOfYear + 1);
+    }
+
     //-----------------------------------------------------------------------
     // Bad Era for Chronology.date(era,...) and Chronology.prolepticYear(Era,...)
     //-----------------------------------------------------------------------
@@ -213,7 +177,7 @@
                     ; // ignore expected exception
                 }
 
-                /* TODO: Test for missing HijrahDate.of(Era, y, m, d) method.
+                /* TODO: Test for checking HijrahDate.of(Era, y, m, d) method if it is added.
                 try {
                     @SuppressWarnings("unused")
                     HijrahDate jdate = HijrahDate.of(era, 1, 1, 1);
@@ -233,102 +197,344 @@
             }
         }
     }
-
     //-----------------------------------------------------------------------
-    // with(WithAdjuster)
+    // Tests for HijrahChronology resolve
     //-----------------------------------------------------------------------
-    @Test
-    public void test_adjust1() {
-        ChronoLocalDate<?> base = HijrahChronology.INSTANCE.date(1434, 5, 15);
-        ChronoLocalDate<?> test = base.with(TemporalAdjuster.lastDayOfMonth());
-        assertEquals(test, HijrahChronology.INSTANCE.date(1434, 5, 29));
+    @DataProvider(name = "resolve_styleByEra")
+    Object[][] data_resolve_styleByEra() {
+        Object[][] result = new Object[ResolverStyle.values().length * HijrahEra.values().length][];
+        int i = 0;
+        for (ResolverStyle style : ResolverStyle.values()) {
+            for (HijrahEra era : HijrahEra.values()) {
+                result[i++] = new Object[] {style, era};
+            }
+        }
+        return result;
+    }
+
+    @Test(dataProvider = "resolve_styleByEra")
+    public void test_resolve_yearOfEra_eraOnly_valid(ResolverStyle style, HijrahEra era) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
+        assertEquals(fieldValues.size(), 1);
+    }
+
+    @Test(dataProvider = "resolve_styleByEra")
+    public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, HijrahEra era) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
+        HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.ERA), null);
+        assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
+        assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
+        assertEquals(fieldValues.size(), 1);
     }
 
-    @Test
-    public void test_adjust2() {
-        ChronoLocalDate<?> base = HijrahChronology.INSTANCE.date(1434, 6, 2);
-        ChronoLocalDate<?> test = base.with(TemporalAdjuster.lastDayOfMonth());
-        assertEquals(test, HijrahChronology.INSTANCE.date(1434, 6, 30));
+    @Test(dataProvider = "resolve_styleByEra")
+    public void test_resolve_yearOfEra_eraAndYearOnly_valid(ResolverStyle style, HijrahEra era) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        fieldValues.put(ChronoField.YEAR, 1343L);
+        HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
+        assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
+        assertEquals(fieldValues.size(), 2);
+    }
+
+    @DataProvider(name = "resolve_styles")
+    Object[][] data_resolve_styles() {
+        Object[][] result = new Object[ResolverStyle.values().length][];
+        int i = 0;
+        for (ResolverStyle style : ResolverStyle.values()) {
+            result[i++] = new Object[] {style};
+        }
+        return result;
     }
 
-    //-----------------------------------------------------------------------
-    // HijrahDate.with(Local*)
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_adjust_toLocalDate() {
-        ChronoLocalDate<?> hijrahDate = HijrahChronology.INSTANCE.date(1435, 1, 4);
-        ChronoLocalDate<?> test = hijrahDate.with(LocalDate.of(2012, 7, 6));
-        assertEquals(test, HijrahChronology.INSTANCE.date(1433, 8, 16));
+    @Test(dataProvider = "resolve_styles")
+    public void test_resolve_yearOfEra_yearOfEraOnly_valid(ResolverStyle style) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
+        HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (style != ResolverStyle.STRICT) ? null : (Long) 1343L);
+        assertEquals(fieldValues.get(ChronoField.YEAR), (style == ResolverStyle.STRICT) ? null : (Long) 1343L);
+        assertEquals(fieldValues.size(), 1);
     }
 
-    @Test(expectedExceptions=DateTimeException.class)
-    public void test_adjust_toMonth() {
-        ChronoLocalDate<?> hijrahDate = HijrahChronology.INSTANCE.date(1435, 1, 4);
-        hijrahDate.with(Month.APRIL);
+    @Test(dataProvider = "resolve_styles")
+    public void test_resolve_yearOfEra_yearOfEraAndYearOnly_valid(ResolverStyle style) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR_OF_ERA, 1343L);
+        fieldValues.put(ChronoField.YEAR, 1343L);
+        HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), null);
+        assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1343L);
+        assertEquals(fieldValues.size(), 1);
     }
 
     //-----------------------------------------------------------------------
-    // LocalDate.with(HijrahDate)
+    // Sample Hijrah Calendar data; official data is in lib/hijrah-ummalqura.properties
+    // 1432=29 30 30 30 29 30 29 30 29 30 29 29  total = 354
+    // 1433=30 29 30 30 29 30 30 29 30 29 30 29  total = 355
+    // 1434=29 30 29 30 29 30 30 29 30 30 29 29  total = 354
+    // 1435=30 29 30 29 30 29 30 29 30 30 29 30  total = 355
     //-----------------------------------------------------------------------
-    @Test
-    public void test_LocalDate_adjustToHijrahDate() {
-        ChronoLocalDate<?> hijrahDate = HijrahChronology.INSTANCE.date(1434, 5, 15);
-        LocalDate test = LocalDate.MIN.with(hijrahDate);
-        assertEquals(test, LocalDate.of(2013, 3, 27));
+    @DataProvider(name = "resolve_ymd")
+    Object[][] data_resolve_ymd() {
+        // Compute the number of days in various month and years so that test cases
+        // are not dependent on specific calendar data
+        // Month numbers are always 1..12 so they can be used literally
+        final int year = 1434;
+        final int yearP1 = year + 1;
+        final int yearP2 = year + 2;
+        final int yearM1 = year - 1;
+        final int yearM2 = year - 2;
+        final int lastDayInYear = dateYearDay(year, 1).lengthOfYear();
+        final int lastDayInYearP1 = dateYearDay(yearP1, 1).lengthOfYear();
+        final int lastDayInYearM1 = dateYearDay(yearM1, 1).lengthOfYear();
+        final int lastDayInYearM2 = dateYearDay(yearM2, 1).lengthOfYear();
+        final int lastDayInMonthM1 = date(yearM1, 12, 1).lengthOfMonth();
+        final int lastDayInMonthM2 = date(yearM1, 11, 1).lengthOfMonth();
+        final int lastDayInMonthM11 = date(yearM1, 2, 1).lengthOfMonth();
+
+        final int lastDayInMonth1 = date(year, 1, 1).lengthOfMonth();
+        final int lastDayInMonth2 = date(year, 2, 1).lengthOfMonth();
+        final int lastDayInMonth4 = date(year, 4, 1).lengthOfMonth();
+        final int lastDayInMonth5 = date(year, 5, 1).lengthOfMonth();
+        final int lastDayInMonth6 = date(year, 6, 1).lengthOfMonth();
+        final int lastDayInMonth7 = date(year, 7, 1).lengthOfMonth();
+
+        return new Object[][] {
+                {year, 1, -lastDayInYearM1, dateYearDay(yearM2, lastDayInYearM2), false, false},
+                {year, 1, -lastDayInYearM1 + 1, date(yearM1, 1, 1), false, false},
+                {year, 1, -lastDayInMonthM1, date(yearM1, 11, lastDayInMonthM2), false, false},
+                {year, 1, -lastDayInMonthM1 + 1, date(yearM1, 12, 1), false, false},
+                {year, 1, -12, date(yearM1, 12, lastDayInMonthM1 - 12), false, false},
+                {year, 1, 1, date(year, 1, 1), true, true},
+                {year, 1, lastDayInMonth1 + lastDayInMonth2 - 1, date(year, 2, lastDayInMonth2 - 1), false, false},
+                {year, 1, lastDayInMonth1 + lastDayInMonth2, date(year, 2, lastDayInMonth2), false, false},
+                {year, 1, lastDayInMonth1 + lastDayInMonth2 + 1 , date(year, 3, 1), false, false},
+                {year, 1, lastDayInYear, dateYearDay(year, lastDayInYear), false, false},
+                {year, 1, lastDayInYear + 1, date(1435, 1, 1), false, false},
+                {year, 1, lastDayInYear + lastDayInYearP1, dateYearDay(yearP1, lastDayInYearP1), false, false},
+                {year, 1, lastDayInYear + lastDayInYearP1 + 1, date(yearP2, 1, 1), false, false},
+
+                {year, 2, 1, date(year, 2, 1), true, true},
+                {year, 2, lastDayInMonth2 - 2, date(year, 2, lastDayInMonth2 - 2), true, true},
+                {year, 2, lastDayInMonth2 - 1, date(year, 2, lastDayInMonth2 - 1), true, true},
+                {year, 2, lastDayInMonth2, date(year, 2, lastDayInMonth2), date(year, 2, lastDayInMonth2), true},
+                {year, 2, lastDayInMonth2 + 1, date(year, 3, 1), false, false},
+
+                {year, -12, 1, date(yearM2, 12, 1), false, false},
+                {year, -11, 1, date(yearM1, 1, 1), false, false},
+                {year, -1, 1, date(yearM1, 11, 1), false, false},
+                {year, 0, 1, date(yearM1, 12, 1), false, false},
+                {year, 1, 1, date(year, 1, 1), true, true},
+                {year, 12, 1, date(year, 12, 1), true, true},
+                {year, 13, 1, date(yearP1, 1, 1), false, false},
+                {year, 24, 1, date(yearP1, 12, 1), false, false},
+                {year, 25, 1, date(yearP2, 1, 1), false, false},
+
+                {year, 6, -lastDayInMonth5, date(year, 4, lastDayInMonth4), false, false},
+                {year, 6, -lastDayInMonth5 + 1, date(year, 5, 1), false, false},
+                {year, 6, -1, date(year, 5, lastDayInMonth5 - 1), false, false},
+                {year, 6, 0, date(year, 5, lastDayInMonth5), false, false},
+                {year, 6, 1, date(year, 6, 1), true, true},
+                {year, 6, lastDayInMonth6 - 1 , date(year, 6, lastDayInMonth6 - 1), true, true},
+                {year, 6, lastDayInMonth6, date(year, 6, lastDayInMonth6), date(year, 6, lastDayInMonth6), true},
+                {year, 6, lastDayInMonth6 + 1, date(year, 7, 1), false, false},
+                {year, 6, lastDayInMonth6 + lastDayInMonth7 , date(year, 7, lastDayInMonth7), false, false},
+                {year, 6, lastDayInMonth6 + lastDayInMonth7 + 1, date(year, 8, 1), false, false},
+
+                {yearM1, 2, 1, date(yearM1, 2, 1), true, true},
+                {yearM1, 2, lastDayInMonthM11 - 1, date(yearM1, 2, lastDayInMonthM11 - 1), true, true},
+                {yearM1, 2, lastDayInMonthM11, date(yearM1, 2, lastDayInMonthM11), true, true},
+                {yearM1, 2, lastDayInMonthM11 + 1, date(yearM1, 3, 1), date(yearM1, 2, lastDayInMonthM11), false},
+                {yearM1, 2, lastDayInMonthM11 + 2, date(yearM1, 3, 2), false, false},
+                // Bad dates
+                {1299, 12, 1, null, false, false},
+                {1601, 1, 1, null, false, false},
+
+        };
     }
 
-    @Test
-    public void test_LocalDateTime_adjustToHijrahDate() {
-        ChronoLocalDate<?> hijrahDate = HijrahChronology.INSTANCE.date(1435, 5, 15);
-        LocalDateTime test = LocalDateTime.MIN.with(hijrahDate);
-        assertEquals(test, LocalDateTime.of(2014, 3, 16, 0, 0));
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_lenient(int y, int m, int d, HijrahDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+
+        if (expected != null) {
+            HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+                fail("Should have failed, returned: " + date);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_smart(int y, int m, int d, HijrahDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (Boolean.TRUE.equals(smart)) {
+            HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else if (smart instanceof HijrahDate) {
+            HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, smart);
+        } else {
+            try {
+                HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed, returned: " + date);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_strict(int y, int m, int d, HijrahDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (strict) {
+            HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected, "Resolved to incorrect date");
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed, returned: " + date);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
     }
 
     //-----------------------------------------------------------------------
-    // PeriodUntil()
-    //-----------------------------------------------------------------------
-    @Test
-    public void test_periodUntilDate() {
-        HijrahDate mdate1 = HijrahDate.of(1434, 1, 1);
-        HijrahDate mdate2 = HijrahDate.of(1435, 2, 2);
-        Period period = mdate1.periodUntil(mdate2);
-        assertEquals(period, Period.of(1, 1, 1));
+    @DataProvider(name = "resolve_yd")
+    Object[][] data_resolve_yd() {
+        // Compute the number of days in various month and years so that test cases
+        // are not dependent on specific calendar data
+        // Month numbers are always 1..12 so they can be used literally
+        final int year = 1343;
+        final int yearP1 = year + 1;
+        final int yearP2 = year + 2;
+        final int yearM1 = year - 1;
+        final int yearM2 = year - 2;
+        final int lastDayInYear = dateYearDay(year, 1).lengthOfYear();
+        final int lastDayInYearP1 = dateYearDay(yearP1, 1).lengthOfYear();
+        final int lastDayInYearM1 = dateYearDay(yearM1, 1).lengthOfYear();
+        final int lastDayInYearM2 = dateYearDay(yearM2, 1).lengthOfYear();
+
+        final int lastDayInMonthM1 = date(yearM1, 12, 1).lengthOfMonth();
+        final int lastDayInMonthM2 = date(yearM1, 11, 1).lengthOfMonth();
+        final int lastDayInMonthM11 = date(yearM1, 2, 1).lengthOfMonth();
+
+        final int lastDayInMonth1 = date(year, 1, 1).lengthOfMonth();
+        final int lastDayInMonth2 = date(year, 2, 1).lengthOfMonth();
+        final int lastDayInMonth4 = date(year, 4, 1).lengthOfMonth();
+        final int lastDayInMonth5 = date(year, 5, 1).lengthOfMonth();
+        final int lastDayInMonth6 = date(year, 6, 1).lengthOfMonth();
+        final int lastDayInMonth7 = date(year, 7, 1).lengthOfMonth();
+
+        return new Object[][] {
+                {year, -lastDayInYearM1, dateYearDay(yearM2, lastDayInYearM2), false, false},
+                {year, -lastDayInYearM1 + 1, date(yearM1, 1, 1), false, false},
+                {year, -lastDayInMonthM1, date(yearM1, 11, lastDayInMonthM2), false, false},
+                {year, -lastDayInMonthM1 + 1, date(yearM1, 12, 1), false, false},
+                {year, -12, date(yearM1, 12, lastDayInMonthM1 - 12), false, false},
+                {year, -1, date(yearM1, 12, lastDayInMonthM1 - 1), false, false},
+                {year, 0, date(yearM1, 12, lastDayInMonthM1), false, false},
+                {year, 1, date(year, 1, 1), true, true},
+                {year, 2, date(year, 1, 2), true, true},
+                {year, lastDayInMonth1, date(year, 1, lastDayInMonth1), true, true},
+                {year, lastDayInMonth1 + 1, date(year, 2, 1), true, true},
+                {year, lastDayInMonth1 + lastDayInMonth2 - 1, date(year, 2, lastDayInMonth2 - 1), true, true},
+                {year, lastDayInMonth1 + lastDayInMonth2, date(year, 2, lastDayInMonth2), true, true},
+                {year, lastDayInMonth1 + lastDayInMonth2 + 1, date(year, 3, 1), true, true},
+                {year, lastDayInYear - 1, dateYearDay(year, lastDayInYear - 1), true, true},
+                {year, lastDayInYear, dateYearDay(year, lastDayInYear), true, true},
+                {year, lastDayInYear + 1, date(yearP1, 1, 1), false, false},
+                {year, lastDayInYear + lastDayInYearP1, dateYearDay(yearP1, lastDayInYearP1), false, false},
+                {year, lastDayInYear + lastDayInYearP1 + 1, date(yearP2, 1, 1), false, false},
+        };
     }
 
-    @Test
-    public void test_periodUntilUnit() {
-        HijrahDate mdate1 = HijrahDate.of(1434, 1, 1);
-        HijrahDate mdate2 = HijrahDate.of(1435, 2, 2);
-        long months = mdate1.periodUntil(mdate2, ChronoUnit.MONTHS);
-        assertEquals(months, 13);
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_lenient(int y, int d, HijrahDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
     }
 
-    @Test
-    public void test_periodUntilDiffChrono() {
-        HijrahDate mdate1 = HijrahDate.of(1434, 1, 1);
-        HijrahDate mdate2 = HijrahDate.of(1435, 2, 2);
-        MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.periodUntil(ldate2);
-        assertEquals(period, Period.of(1, 1, 1));
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_smart(int y, int d, HijrahDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (smart) {
+            HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed, returned date: " + date);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_strict(int y, int d, HijrahDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (strict) {
+            HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                HijrahDate date = HijrahChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed, returned date: " + date);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
     }
 
     //-----------------------------------------------------------------------
-    // toString()
-    //-----------------------------------------------------------------------
-    @DataProvider(name="toString")
-    Object[][] data_toString() {
-        return new Object[][] {
-            //{HijrahChronology.INSTANCE.date(1320, 1, 1), "Hijrah AH 1320-01-01"},
-            //{HijrahChronology.INSTANCE.date(1500, 10, 28), "Hijrah AH 1500-10-28"},
-            //{HijrahChronology.INSTANCE.date(1500, 10, 29), "Hijrah AH 1500-10-29"},
-            {HijrahChronology.INSTANCE.date(1434, 12, 5), "Hijrah-umalqura AH 1434-12-05"},
-            {HijrahChronology.INSTANCE.date(1434, 12, 6), "Hijrah-umalqura AH 1434-12-06"},
-        };
+    private static HijrahDate date(int y, int m, int d) {
+        return HijrahDate.of(y, m, d);
     }
 
-    @Test(dataProvider="toString")
-    public void test_toString(ChronoLocalDate<?> hijrahDate, String expected) {
-        assertEquals(hijrahDate.toString(), expected);
+    private static HijrahDate dateYearDay(int y, int doy) {
+        return HijrahChronology.INSTANCE.dateYearDay(y, doy);
     }
 
     //-----------------------------------------------------------------------
@@ -343,5 +549,4 @@
     public void test_equals_false() {
         assertFalse(HijrahChronology.INSTANCE.equals(IsoChronology.INSTANCE));
     }
-
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKHijrahEra.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKHijrahEra.java	Tue Aug 06 16:54:56 2013 -0700
@@ -85,6 +85,8 @@
     @Test(dataProvider="HijrahEras")
     public void test_valueOf(HijrahEra era , String eraName, int eraValue) {
         assertEquals(era.getValue(), eraValue);
+
+        assertEquals(HijrahChronology.INSTANCE.eraOf(eraValue), era);
         assertEquals(HijrahEra.of(eraValue), era);
         assertEquals(HijrahEra.valueOf(eraName), era);
     }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKIsoChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKIsoChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -278,91 +278,88 @@
     @DataProvider(name = "resolve_yearOfEra")
     Object[][] data_resolve_yearOfEra() {
         return new Object[][] {
-                {-1, 2012, null, null, false, false},
-                {0, 2012, null, -2011, true, true},
-                {1, 2012, null, 2012, true, true},
-                {2, 2012, null, null, false, false},
+                // era only
+                {ResolverStyle.STRICT, -1, null, null, null, null},
+                {ResolverStyle.SMART, -1, null, null, null, null},
+                {ResolverStyle.LENIENT, -1, null, null, null, null},
+
+                {ResolverStyle.STRICT, 0, null, null, ChronoField.ERA, 0},
+                {ResolverStyle.SMART, 0, null, null, ChronoField.ERA, 0},
+                {ResolverStyle.LENIENT, 0, null, null, ChronoField.ERA, 0},
+
+                {ResolverStyle.STRICT, 1, null, null, ChronoField.ERA, 1},
+                {ResolverStyle.SMART, 1, null, null, ChronoField.ERA, 1},
+                {ResolverStyle.LENIENT, 1, null, null, ChronoField.ERA, 1},
+
+                {ResolverStyle.STRICT, 2, null, null, null, null},
+                {ResolverStyle.SMART, 2, null, null, null, null},
+                {ResolverStyle.LENIENT, 2, null, null, null, null},
+
+                // era and year-of-era
+                {ResolverStyle.STRICT, -1, 2012, null, null, null},
+                {ResolverStyle.SMART, -1, 2012, null, null, null},
+                {ResolverStyle.LENIENT, -1, 2012, null, null, null},
+
+                {ResolverStyle.STRICT, 0, 2012, null, ChronoField.YEAR, -2011},
+                {ResolverStyle.SMART, 0, 2012, null, ChronoField.YEAR, -2011},
+                {ResolverStyle.LENIENT, 0, 2012, null, ChronoField.YEAR, -2011},
+
+                {ResolverStyle.STRICT, 1, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.SMART, 1, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, 1, 2012, null, ChronoField.YEAR, 2012},
 
-                {null, 2012, null, 2012, true, null},
-                {null, 2012, 2012, 2012, true, true},
-                {null, 2012, -2011, -2011, true, true},
-                {null, 2012, 2013, null, false, false},
-                {null, 2012, -2013, null, false, false},
+                {ResolverStyle.STRICT, 2, 2012, null, null, null},
+                {ResolverStyle.SMART, 2, 2012, null, null, null},
+                {ResolverStyle.LENIENT, 2, 2012, null, null, null},
+
+                // year-of-era only
+                {ResolverStyle.STRICT, null, 2012, null, ChronoField.YEAR_OF_ERA, 2012},
+                {ResolverStyle.SMART, null, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, null, 2012, null, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, null, Integer.MAX_VALUE, null, null, null},
+                {ResolverStyle.SMART, null, Integer.MAX_VALUE, null, null, null},
+                {ResolverStyle.LENIENT, null, Integer.MAX_VALUE, null, ChronoField.YEAR, Integer.MAX_VALUE},
+
+                // year-of-era and year
+                {ResolverStyle.STRICT, null, 2012, 2012, ChronoField.YEAR, 2012},
+                {ResolverStyle.SMART, null, 2012, 2012, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, null, 2012, 2012, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, null, 2012, -2011, ChronoField.YEAR, -2011},
+                {ResolverStyle.SMART, null, 2012, -2011, ChronoField.YEAR, -2011},
+                {ResolverStyle.LENIENT, null, 2012, -2011, ChronoField.YEAR, -2011},
+
+                {ResolverStyle.STRICT, null, 2012, 2013, null, null},
+                {ResolverStyle.SMART, null, 2012, 2013, null, null},
+                {ResolverStyle.LENIENT, null, 2012, 2013, null, null},
+
+                {ResolverStyle.STRICT, null, 2012, -2013, null, null},
+                {ResolverStyle.SMART, null, 2012, -2013, null, null},
+                {ResolverStyle.LENIENT, null, 2012, -2013, null, null},
         };
     }
 
     @Test(dataProvider = "resolve_yearOfEra")
-    public void test_resolve_yearOfEra_lenient(Integer e, int yoe, Integer y, Integer expected, boolean smart, Boolean strict) {
+    public void test_resolve_yearOfEra(ResolverStyle style, Integer e, Integer yoe, Integer y, ChronoField field, Integer expected) {
         Map<TemporalField, Long> fieldValues = new HashMap<>();
         if (e != null) {
             fieldValues.put(ChronoField.ERA, (long) e);
         }
-        fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
-        if (y != null) {
-            fieldValues.put(ChronoField.YEAR, (long) y);
+        if (yoe != null) {
+            fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
         }
-        if (smart) {
-            LocalDate date = IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
-            assertEquals(date, null);
-            assertEquals(fieldValues.get(ChronoField.YEAR), (Long) (long) expected);
-            assertEquals(fieldValues.size(), 1);
-        } else {
-            try {
-                IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
-                fail("Should have failed");
-            } catch (DateTimeException ex) {
-                // expected
-            }
-        }
-    }
-
-    @Test(dataProvider = "resolve_yearOfEra")
-    public void test_resolve_yearOfEra_smart(Integer e, int yoe, Integer y, Integer expected, boolean smart, Boolean strict) {
-        Map<TemporalField, Long> fieldValues = new HashMap<>();
-        if (e != null) {
-            fieldValues.put(ChronoField.ERA, (long) e);
-        }
-        fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
         if (y != null) {
             fieldValues.put(ChronoField.YEAR, (long) y);
         }
-        if (smart) {
-            LocalDate date = IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+        if (field != null) {
+            LocalDate date = IsoChronology.INSTANCE.resolveDate(fieldValues, style);
             assertEquals(date, null);
-            assertEquals(fieldValues.get(ChronoField.YEAR), (Long) (long) expected);
+            assertEquals(fieldValues.get(field), (Long) expected.longValue());
             assertEquals(fieldValues.size(), 1);
         } else {
             try {
-                IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
-                fail("Should have failed");
-            } catch (DateTimeException ex) {
-                // expected
-            }
-        }
-    }
-
-    @Test(dataProvider = "resolve_yearOfEra")
-    public void test_resolve_yearOfEra_strict(Integer e, int yoe, Integer y, Integer expected, boolean smart, Boolean strict) {
-        Map<TemporalField, Long> fieldValues = new HashMap<>();
-        if (e != null) {
-            fieldValues.put(ChronoField.ERA, (long) e);
-        }
-        fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
-        if (y != null) {
-            fieldValues.put(ChronoField.YEAR, (long) y);
-        }
-        if (strict == null) {
-            LocalDate date = IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
-            assertEquals(date, null);
-            assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (Long) (long) yoe);
-        } else if (strict) {
-            LocalDate date = IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
-            assertEquals(date, null);
-            assertEquals(fieldValues.get(ChronoField.YEAR), (Long) (long) expected);
-            assertEquals(fieldValues.size(), 1);
-        } else {
-            try {
-                IsoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                IsoChronology.INSTANCE.resolveDate(fieldValues, style);
                 fail("Should have failed");
             } catch (DateTimeException ex) {
                 // expected
@@ -381,6 +378,11 @@
                 {2012, 1, -30, date(2011, 12, 1), false, false},
                 {2012, 1, -12, date(2011, 12, 19), false, false},
                 {2012, 1, 1, date(2012, 1, 1), true, true},
+                {2012, 1, 27, date(2012, 1, 27), true, true},
+                {2012, 1, 28, date(2012, 1, 28), true, true},
+                {2012, 1, 29, date(2012, 1, 29), true, true},
+                {2012, 1, 30, date(2012, 1, 30), true, true},
+                {2012, 1, 31, date(2012, 1, 31), true, true},
                 {2012, 1, 59, date(2012, 2, 28), false, false},
                 {2012, 1, 60, date(2012, 2, 29), false, false},
                 {2012, 1, 61, date(2012, 3, 1), false, false},
--- a/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -57,12 +57,15 @@
 package tck.java.time.chrono;
 
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
+import static java.time.temporal.ChronoField.EPOCH_DAY;
 import static java.time.temporal.ChronoField.ERA;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
@@ -84,10 +87,19 @@
 import java.time.chrono.JapaneseEra;
 import java.time.chrono.MinguoChronology;
 import java.time.chrono.MinguoDate;
+import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
+import java.time.temporal.Temporal;
 import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalField;
+import java.time.temporal.TemporalQuery;
+import java.time.temporal.ValueRange;
+
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
@@ -155,59 +167,145 @@
     }
 
     //-----------------------------------------------------------------------
-    // creation, toLocalDate()
+    // creation and cross-checks
     //-----------------------------------------------------------------------
-    @DataProvider(name="samples")
-    Object[][] data_samples() {
+    @DataProvider(name="createByEra")
+    Object[][] data_createByEra() {
         return new Object[][] {
-            {JapaneseChronology.INSTANCE.date(1, 1, 1), LocalDate.of(1, 1, 1)},
-            {JapaneseChronology.INSTANCE.date(1, 1, 2), LocalDate.of(1, 1, 2)},
-            {JapaneseChronology.INSTANCE.date(1, 1, 3), LocalDate.of(1, 1, 3)},
-
-            {JapaneseChronology.INSTANCE.date(2, 1, 1), LocalDate.of(2, 1, 1)},
-            {JapaneseChronology.INSTANCE.date(3, 1, 1), LocalDate.of(3, 1, 1)},
-            {JapaneseChronology.INSTANCE.date(3, 12, 6), LocalDate.of(3, 12, 6)},
-            {JapaneseChronology.INSTANCE.date(4, 1, 1), LocalDate.of(4, 1, 1)},
-            {JapaneseChronology.INSTANCE.date(4, 7, 3), LocalDate.of(4, 7, 3)},
-            {JapaneseChronology.INSTANCE.date(4, 7, 4), LocalDate.of(4, 7, 4)},
-            {JapaneseChronology.INSTANCE.date(5, 1, 1), LocalDate.of(5, 1, 1)},
-            {JapaneseChronology.INSTANCE.date(1662, 3, 3), LocalDate.of(1662, 3, 3)},
-            {JapaneseChronology.INSTANCE.date(1728, 10, 28), LocalDate.of(1728, 10, 28)},
-            {JapaneseChronology.INSTANCE.date(1728, 10, 29), LocalDate.of(1728, 10, 29)},
-
-            {JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 1996 - YDIFF_HEISEI, 2, 29), LocalDate.of(1996, 2, 29)},
-            {JapaneseChronology.INSTANCE.date(JapaneseEra.HEISEI, 2000 - YDIFF_HEISEI, 2, 29), LocalDate.of(2000, 2, 29)},
-            {JapaneseChronology.INSTANCE.date(JapaneseEra.MEIJI, 1868 - YDIFF_MEIJI, 2, 29), LocalDate.of(1868, 2, 29)},
-            {JapaneseChronology.INSTANCE.date(JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 12, 25), LocalDate.of(1928, 12, 25)},
-            {JapaneseChronology.INSTANCE.date(JapaneseEra.TAISHO, 1912 - YDIFF_TAISHO, 7, 30), LocalDate.of(1912, 7, 30)},
-
-            {JapaneseChronology.INSTANCE.dateYearDay(1996, 60), LocalDate.of(1996, 2, 29)},
-            {JapaneseChronology.INSTANCE.dateYearDay(1868, 60), LocalDate.of(1868, 2, 29)},
-            {JapaneseChronology.INSTANCE.dateYearDay(1928, 60), LocalDate.of(1928, 2, 29)},
-            {JapaneseChronology.INSTANCE.dateYearDay(1912, 60), LocalDate.of(1912, 2, 29)},
-
-            {JapaneseDate.ofYearDay(1996, 60), LocalDate.of(1996, 2, 29)},
-            {JapaneseDate.ofYearDay(1868, 60), LocalDate.of(1868, 2, 29)},
-            {JapaneseDate.ofYearDay(1928, 60), LocalDate.of(1928, 2, 29)},
-            {JapaneseDate.ofYearDay(1912, 60), LocalDate.of(1912, 2, 29)},
-
-            {JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.HEISEI, 1996 - YDIFF_HEISEI, 60), LocalDate.of(1996, 2, 29)},
-            {JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.MEIJI, 1868 - YDIFF_MEIJI, 60), LocalDate.of(1868, 2, 29)},
-            {JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 60), LocalDate.of(1928, 2, 29)},
-//          {JapaneseChronology.INSTANCE.dateYearDay(JapaneseEra.TAISHO, 1916 - YDIFF_TAISHO, 60), LocalDate.of(1912, 2, 29)},
+                {JapaneseEra.HEISEI, 1996 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(1996, 2, 29)},
+                {JapaneseEra.HEISEI, 2000 - YDIFF_HEISEI, 2, 29, 60, LocalDate.of(2000, 2, 29)},
+                {JapaneseEra.MEIJI, 1874 - YDIFF_MEIJI, 2, 28, 59, LocalDate.of(1874, 2, 28)},
+                {JapaneseEra.SHOWA, 1928 - YDIFF_SHOWA, 12, 25, 360, LocalDate.of(1928, 12, 25)},
+                {JapaneseEra.TAISHO, 1916 - YDIFF_TAISHO, 7, 30, 212, LocalDate.of(1916, 7, 30)},
+                {JapaneseEra.MEIJI, 6, 1, 1, 1, LocalDate.of(1873, 1, 1)},
+                {JapaneseEra.MEIJI, 45, 7, 29, 211, LocalDate.of(1912, 7, 29)},
+                {JapaneseEra.TAISHO, 1, 7, 30, 1, LocalDate.of(1912, 7, 30)},
+                {JapaneseEra.TAISHO, 15, 12, 24, 358, LocalDate.of(1926, 12, 24)},
+                {JapaneseEra.SHOWA, 1, 12, 25, 1, LocalDate.of(1926, 12, 25)},
+                {JapaneseEra.SHOWA, 64, 1, 7, 7, LocalDate.of(1989, 1, 7)},
+                {JapaneseEra.HEISEI, 1, 1, 8, 1, LocalDate.of(1989, 1, 8)},
         };
     }
 
-    @Test(dataProvider="samples")
-    public void test_toLocalDate(JapaneseDate jdate, LocalDate iso) {
-        assertEquals(LocalDate.from(jdate), iso);
+    @Test(dataProvider="createByEra")
+    public void test_createEymd(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.date(era, yoe, moy, dom);
+        JapaneseDate dateByDateFactory = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(dateByChronoFactory, dateByDateFactory);
+        assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
+    }
+
+    @Test(dataProvider="createByEra")
+    public void test_createEyd(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.dateYearDay(era, yoe, doy);
+        JapaneseDate dateByDateFactory = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(dateByChronoFactory, dateByDateFactory);
+        assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
+    }
+
+    @Test(dataProvider="createByEra")
+    public void test_createByEra_isEqual(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(test.isEqual(iso), true);
+        assertEquals(iso.isEqual(test), true);
+    }
+
+    @Test(dataProvider="createByEra")
+    public void test_createByEra_chronologyTemporalFactory(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(IsoChronology.INSTANCE.date(test), iso);
+        assertEquals(JapaneseChronology.INSTANCE.date(iso), test);
+    }
+
+    @Test(dataProvider="createByEra")
+    public void test_createByEra_dateFrom(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(LocalDate.from(test), iso);
+        assertEquals(JapaneseDate.from(iso), test);
+    }
+
+    @Test(dataProvider="createByEra")
+    public void test_createByEra_query(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(test.query(TemporalQuery.localDate()), iso);
+    }
+
+    @Test(dataProvider="createByEra")
+    public void test_createByEra_epochDay(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom);
+        assertEquals(test.getLong(EPOCH_DAY), iso.getLong(EPOCH_DAY));
+        assertEquals(test.toEpochDay(), iso.toEpochDay());
     }
 
-    @Test(dataProvider="samples")
-    public void test_fromCalendrical(JapaneseDate jdate, LocalDate iso) {
-        assertEquals(JapaneseChronology.INSTANCE.date(iso), jdate);
+    //-----------------------------------------------------------------------
+    @DataProvider(name="createByProleptic")
+    Object[][] data_createByProleptic() {
+        return new Object[][] {
+                {1928, 2, 28, 59, LocalDate.of(1928, 2, 28)},
+                {1928, 2, 29, 60, LocalDate.of(1928, 2, 29)},
+
+                {1873, 9, 7, 250, LocalDate.of(1873, 9, 7)},
+                {1873, 9, 8, 251, LocalDate.of(1873, 9, 8)},
+                {1912, 7, 29, 211, LocalDate.of(1912, 7, 29)},
+                {1912, 7, 30, 212, LocalDate.of(1912, 7, 30)},
+                {1926, 12, 24, 358, LocalDate.of(1926, 12, 24)},
+                {1926, 12, 25, 359, LocalDate.of(1926, 12, 25)},
+                {1989, 1, 7, 7, LocalDate.of(1989, 1, 7)},
+                {1989, 1, 8, 8, LocalDate.of(1989, 1, 8)},
+        };
+    }
+
+    @Test(dataProvider="createByProleptic")
+    public void test_createYmd(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.date(y, moy, dom);
+        JapaneseDate dateByDateFactory = JapaneseDate.of(y, moy, dom);
+        assertEquals(dateByChronoFactory, dateByDateFactory);
+        assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
+    }
+
+    @Test(dataProvider="createByProleptic")
+    public void test_createYd(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate dateByChronoFactory = JapaneseChronology.INSTANCE.dateYearDay(y, doy);
+        JapaneseDate dateByDateFactory = JapaneseDate.of(y, moy, dom);
+        assertEquals(dateByChronoFactory, dateByDateFactory);
+        assertEquals(dateByChronoFactory.hashCode(), dateByDateFactory.hashCode());
     }
 
+    @Test(dataProvider="createByProleptic")
+    public void test_createByProleptic_isEqual(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(y, moy, dom);
+        assertEquals(test.isEqual(iso), true);
+        assertEquals(iso.isEqual(test), true);
+    }
+
+    @Test(dataProvider="createByProleptic")
+    public void test_createByProleptic_chronologyTemporalFactory(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(y, moy, dom);
+        assertEquals(IsoChronology.INSTANCE.date(test), iso);
+        assertEquals(JapaneseChronology.INSTANCE.date(iso), test);
+    }
+
+    @Test(dataProvider="createByProleptic")
+    public void test_createByProleptic_dateFrom(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(y, moy, dom);
+        assertEquals(LocalDate.from(test), iso);
+        assertEquals(JapaneseDate.from(iso), test);
+    }
+
+    @Test(dataProvider="createByProleptic")
+    public void test_createByProleptic_query(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(y, moy, dom);
+        assertEquals(test.query(TemporalQuery.localDate()), iso);
+    }
+
+    @Test(dataProvider="createByProleptic")
+    public void test_createByProleptic_epochDay(int y, int moy, int dom, int doy, LocalDate iso) {
+        JapaneseDate test = JapaneseDate.of(y, moy, dom);
+        assertEquals(test.getLong(EPOCH_DAY), iso.getLong(EPOCH_DAY));
+        assertEquals(test.toEpochDay(), iso.toEpochDay());
+    }
+
+    //-----------------------------------------------------------------------
     @Test
     public void test_dateNow(){
         assertEquals(JapaneseChronology.INSTANCE.dateNow(), JapaneseDate.now()) ;
@@ -228,27 +326,30 @@
         assertEquals(JapaneseChronology.INSTANCE.dateNow(ZoneId.of(ZoneOffset.UTC.getId())), JapaneseChronology.INSTANCE.dateNow(Clock.systemUTC())) ;
     }
 
+    //-----------------------------------------------------------------------
     @DataProvider(name="badDates")
     Object[][] data_badDates() {
         return new Object[][] {
-            {1728, 0, 0},
+            {1928, 0, 0},
 
-            {1728, -1, 1},
-            {1728, 0, 1},
-            {1728, 14, 1},
-            {1728, 15, 1},
+            {1928, -1, 1},
+            {1928, 0, 1},
+            {1928, 14, 1},
+            {1928, 15, 1},
 
-            {1728, 1, -1},
-            {1728, 1, 0},
-            {1728, 1, 32},
+            {1928, 1, -1},
+            {1928, 1, 0},
+            {1928, 1, 32},
 
-            {1728, 12, -1},
-            {1728, 12, 0},
-            {1728, 12, 32},
+            {1928, 12, -1},
+            {1928, 12, 0},
+            {1928, 12, 32},
 
             {1725, 2, 29},
             {500, 2, 29},
             {2100, 2, 29},
+
+            {1872, 12, 31},     // Last day of MEIJI 5
         };
     }
 
@@ -266,8 +367,8 @@
                 {2, JapaneseEra.HEISEI, 1, 1 + YDIFF_HEISEI, false},
                 {2, JapaneseEra.HEISEI, 100, 100 + YDIFF_HEISEI, true},
 
-                {-1, JapaneseEra.MEIJI, 1, 1 + YDIFF_MEIJI, true},
-                {-1, JapaneseEra.MEIJI, 4, 4 + YDIFF_MEIJI, false},
+                {-1, JapaneseEra.MEIJI, 9, 9 + YDIFF_MEIJI, true},
+                {-1, JapaneseEra.MEIJI, 10, 10 + YDIFF_MEIJI, false},
 
                 {1, JapaneseEra.SHOWA, 1, 1 + YDIFF_SHOWA, false},
                 {1, JapaneseEra.SHOWA, 7, 7 + YDIFF_SHOWA, true},
@@ -279,12 +380,24 @@
 
     @Test(dataProvider="prolepticYear")
     public void test_prolepticYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
-        Era eraObj = JapaneseChronology.INSTANCE.eraOf(eraValue) ;
+        Era eraObj = JapaneseChronology.INSTANCE.eraOf(eraValue);
         assertTrue(JapaneseChronology.INSTANCE.eras().contains(eraObj));
         assertEquals(eraObj, era);
         assertEquals(JapaneseChronology.INSTANCE.prolepticYear(era, yearOfEra), expectedProlepticYear);
-        assertEquals(JapaneseChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ;
-        assertEquals(JapaneseChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear).isLeap()) ;
+    }
+
+    @Test(dataProvider="prolepticYear")
+    public void test_isLeapYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
+        assertEquals(JapaneseChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
+        assertEquals(JapaneseChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear).isLeap());
+
+        JapaneseDate jdate = JapaneseDate.now();
+        jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
+        if (isLeapYear) {
+            assertEquals(jdate.lengthOfMonth(), 29);
+        } else {
+            assertEquals(jdate.lengthOfMonth(), 28);
+        }
     }
 
     @DataProvider(name="prolepticYearError")
@@ -327,15 +440,6 @@
                 } catch (ClassCastException cex) {
                     ; // ignore expected exception
                 }
-
-                try {
-                    @SuppressWarnings("unused")
-                    JapaneseDate jdate = JapaneseDate.of(era, 1, 1, 1);
-                    fail("JapaneseDate.of did not throw ClassCastException for Era: " + era);
-                } catch (ClassCastException cex) {
-                    ; // ignore expected exception
-                }
-
                 try {
                     @SuppressWarnings("unused")
                     int year = JapaneseChronology.INSTANCE.prolepticYear(era, 1);
@@ -388,16 +492,16 @@
     //-----------------------------------------------------------------------
     @Test
     public void test_adjust1() {
-        JapaneseDate base = JapaneseChronology.INSTANCE.date(1728, 10, 29);
+        JapaneseDate base = JapaneseChronology.INSTANCE.date(1928, 10, 29);
         JapaneseDate test = base.with(TemporalAdjuster.lastDayOfMonth());
-        assertEquals(test, JapaneseChronology.INSTANCE.date(1728, 10, 31));
+        assertEquals(test, JapaneseChronology.INSTANCE.date(1928, 10, 31));
     }
 
     @Test
     public void test_adjust2() {
-        JapaneseDate base = JapaneseChronology.INSTANCE.date(1728, 12, 2);
+        JapaneseDate base = JapaneseChronology.INSTANCE.date(1928, 12, 2);
         JapaneseDate test = base.with(TemporalAdjuster.lastDayOfMonth());
-        assertEquals(test, JapaneseChronology.INSTANCE.date(1728, 12, 31));
+        assertEquals(test, JapaneseChronology.INSTANCE.date(1928, 12, 31));
     }
 
     //-----------------------------------------------------------------------
@@ -405,14 +509,14 @@
     //-----------------------------------------------------------------------
     @Test
     public void test_adjust_toLocalDate() {
-        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1726, 1, 4);
+        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1926, 1, 4);
         JapaneseDate test = jdate.with(LocalDate.of(2012, 7, 6));
         assertEquals(test, JapaneseChronology.INSTANCE.date(2012, 7, 6));
     }
 
     @Test(expectedExceptions=DateTimeException.class)
     public void test_adjust_toMonth() {
-        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1726, 1, 4);
+        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1926, 1, 4);
         jdate.with(Month.APRIL);
     }
 
@@ -421,16 +525,16 @@
     //-----------------------------------------------------------------------
     @Test
     public void test_LocalDate_adjustToJapaneseDate() {
-        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1728, 10, 29);
+        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1928, 10, 29);
         LocalDate test = LocalDate.MIN.with(jdate);
-        assertEquals(test, LocalDate.of(1728, 10, 29));
+        assertEquals(test, LocalDate.of(1928, 10, 29));
     }
 
     @Test
     public void test_LocalDateTime_adjustToJapaneseDate() {
-        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1728, 10, 29);
+        JapaneseDate jdate = JapaneseChronology.INSTANCE.date(1928, 10, 29);
         LocalDateTime test = LocalDateTime.MIN.with(jdate);
-        assertEquals(test, LocalDateTime.of(1728, 10, 29, 0, 0));
+        assertEquals(test, LocalDateTime.of(1928, 10, 29, 0, 0));
     }
 
     //-----------------------------------------------------------------------
@@ -439,7 +543,6 @@
     @DataProvider(name="japaneseEras")
     Object[][] data_japanseseEras() {
         return new Object[][] {
-            { JapaneseEra.SEIREKI, -999, "Seireki"},
             { JapaneseEra.MEIJI, -1, "Meiji"},
             { JapaneseEra.TAISHO, 0, "Taisho"},
             { JapaneseEra.SHOWA, 1, "Showa"},
@@ -512,7 +615,7 @@
     public void test_periodUntilDate() {
         JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
         JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
-        Period period = mdate1.periodUntil(mdate2);
+        Period period = mdate1.until(mdate2);
         assertEquals(period, Period.of(1, 1, 1));
     }
 
@@ -520,7 +623,7 @@
     public void test_periodUntilUnit() {
         JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
         JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
-        long months = mdate1.periodUntil(mdate2, ChronoUnit.MONTHS);
+        long months = mdate1.until(mdate2, ChronoUnit.MONTHS);
         assertEquals(months, 13);
     }
 
@@ -529,22 +632,49 @@
         JapaneseDate mdate1 = JapaneseDate.of(1970, 1, 1);
         JapaneseDate mdate2 = JapaneseDate.of(1971, 2, 2);
         MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.periodUntil(ldate2);
+        Period period = mdate1.until(ldate2);
         assertEquals(period, Period.of(1, 1, 1));
     }
 
     //-----------------------------------------------------------------------
+    // JapaneseChronology.dateYearDay, getDayOfYear
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_getDayOfYear() {
+        // Test all the Eras
+        for (JapaneseEra era : JapaneseEra.values()) {
+            int firstYear = (era == JapaneseEra.MEIJI) ? 6 : 1;  // Until Era supports range(YEAR_OF_ERA)
+            JapaneseDate hd1 = JapaneseChronology.INSTANCE.dateYearDay(era, firstYear, 1);
+            ValueRange range = hd1.range(DAY_OF_YEAR);
+            assertEquals(range.getMaximum(), hd1.lengthOfYear(), "lengthOfYear should match range.getMaximum()");
+
+            for (int i = 1; i <= hd1.lengthOfYear(); i++) {
+                JapaneseDate hd = JapaneseChronology.INSTANCE.dateYearDay(era, firstYear, i);
+                int doy = hd.get(DAY_OF_YEAR);
+                assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i + ", of date: " + hd);
+            }
+        }
+    }
+
+    @Test
+    public void test_withDayOfYear() {
+        JapaneseDate hd = JapaneseChronology.INSTANCE.dateYearDay(1990, 1);
+        for (int i = 1; i <= hd.lengthOfYear(); i++) {
+            JapaneseDate hd2 = hd.with(DAY_OF_YEAR, i);
+            int doy = hd2.get(DAY_OF_YEAR);
+            assertEquals(doy, i, "with(DAY_OF_YEAR) incorrect for " + i + " " + hd2);
+        }
+    }
+
+    //-----------------------------------------------------------------------
     // toString()
     //-----------------------------------------------------------------------
     @DataProvider(name="toString")
     Object[][] data_toString() {
         return new Object[][] {
-            {JapaneseChronology.INSTANCE.date(0001,  1,  1), "Japanese 0001-01-01"},
-            {JapaneseChronology.INSTANCE.date(1728, 10, 28), "Japanese 1728-10-28"},
-            {JapaneseChronology.INSTANCE.date(1728, 10, 29), "Japanese 1728-10-29"},
-            {JapaneseChronology.INSTANCE.date(1727, 12,  5), "Japanese 1727-12-05"},
-            {JapaneseChronology.INSTANCE.date(1727, 12,  6), "Japanese 1727-12-06"},
-            {JapaneseChronology.INSTANCE.date(1868,  9,  8), "Japanese Meiji 1-09-08"},
+            {JapaneseChronology.INSTANCE.date(1873, 12,  5), "Japanese Meiji 6-12-05"},
+            {JapaneseChronology.INSTANCE.date(1873, 12,  6), "Japanese Meiji 6-12-06"},
+            {JapaneseChronology.INSTANCE.date(1873,  9,  8), "Japanese Meiji 6-09-08"},
             {JapaneseChronology.INSTANCE.date(1912,  7, 29), "Japanese Meiji 45-07-29"},
             {JapaneseChronology.INSTANCE.date(1912,  7, 30), "Japanese Taisho 1-07-30"},
             {JapaneseChronology.INSTANCE.date(1926, 12, 24), "Japanese Taisho 15-12-24"},
@@ -573,4 +703,476 @@
         assertFalse(JapaneseChronology.INSTANCE.equals(IsoChronology.INSTANCE));
     }
 
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_styleByEra")
+    Object[][] data_resolve_styleByEra() {
+        Object[][] result = new Object[ResolverStyle.values().length * JapaneseEra.values().length][];
+        int i = 0;
+        for (ResolverStyle style : ResolverStyle.values()) {
+            for (JapaneseEra era : JapaneseEra.values()) {
+                result[i++] = new Object[] {style, era};
+            }
+        }
+        return result;
+    }
+
+    @Test(dataProvider = "resolve_styleByEra")
+    public void test_resolve_yearOfEra_eraOnly_valid(ResolverStyle style, JapaneseEra era) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
+        assertEquals(fieldValues.size(), 1);
+    }
+
+    @Test(dataProvider = "resolve_styleByEra")
+    public void test_resolve_yearOfEra_eraAndYearOfEraOnly_valid(ResolverStyle style, JapaneseEra era) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        fieldValues.put(ChronoField.YEAR_OF_ERA, 1L);
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
+        assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (Long) 1L);
+        assertEquals(fieldValues.size(), 2);
+    }
+
+    @Test(dataProvider = "resolve_styleByEra")
+    public void test_resolve_yearOfEra_eraAndYearOnly_valid(ResolverStyle style, JapaneseEra era) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        fieldValues.put(ChronoField.YEAR, 1L);
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.ERA), (Long) (long) era.getValue());
+        assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 1L);
+        assertEquals(fieldValues.size(), 2);
+    }
+
+    @DataProvider(name = "resolve_styles")
+    Object[][] data_resolve_styles() {
+        Object[][] result = new Object[ResolverStyle.values().length][];
+        int i = 0;
+        for (ResolverStyle style : ResolverStyle.values()) {
+            result[i++] = new Object[] {style};
+        }
+        return result;
+    }
+
+    @Test(dataProvider = "resolve_styles")
+    public void test_resolve_yearOfEra_yearOfEraOnly_valid(ResolverStyle style) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR_OF_ERA, 1L);
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (Long) 1L);
+        assertEquals(fieldValues.size(), 1);
+    }
+
+    @Test(dataProvider = "resolve_styles")
+    public void test_resolve_yearOfEra_yearOfEraAndYearOnly_valid(ResolverStyle style) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR_OF_ERA, 1L);
+        fieldValues.put(ChronoField.YEAR, 2012L);
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+        assertEquals(date, null);
+        assertEquals(fieldValues.get(ChronoField.YEAR_OF_ERA), (Long) 1L);
+        assertEquals(fieldValues.get(ChronoField.YEAR), (Long) 2012L);
+        assertEquals(fieldValues.size(), 2);
+    }
+
+    public void test_resolve_yearOfEra_eraOnly_invalidTooSmall() {
+        for (ResolverStyle style : ResolverStyle.values()) {
+            Map<TemporalField, Long> fieldValues = new HashMap<>();
+            fieldValues.put(ChronoField.ERA, JapaneseEra.MEIJI.getValue() - 1L);
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+                fail("Should have failed: " + style);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    public void test_resolve_yearOfEra_eraOnly_invalidTooLarge() {
+        for (ResolverStyle style : ResolverStyle.values()) {
+            Map<TemporalField, Long> fieldValues = new HashMap<>();
+            fieldValues.put(ChronoField.ERA, JapaneseEra.values()[JapaneseEra.values().length - 1].getValue() + 1L);
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+                fail("Should have failed: " + style);
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_ymd")
+    Object[][] data_resolve_ymd() {
+        return new Object[][] {
+                {2012, 1, -365, date(2010, 12, 31), false, false},
+                {2012, 1, -364, date(2011, 1, 1), false, false},
+                {2012, 1, -31, date(2011, 11, 30), false, false},
+                {2012, 1, -30, date(2011, 12, 1), false, false},
+                {2012, 1, -12, date(2011, 12, 19), false, false},
+                {2012, 1, 1, date(2012, 1, 1), true, true},
+                {2012, 1, 59, date(2012, 2, 28), false, false},
+                {2012, 1, 60, date(2012, 2, 29), false, false},
+                {2012, 1, 61, date(2012, 3, 1), false, false},
+                {2012, 1, 365, date(2012, 12, 30), false, false},
+                {2012, 1, 366, date(2012, 12, 31), false, false},
+                {2012, 1, 367, date(2013, 1, 1), false, false},
+                {2012, 1, 367 + 364, date(2013, 12, 31), false, false},
+                {2012, 1, 367 + 365, date(2014, 1, 1), false, false},
+
+                {2012, 2, 1, date(2012, 2, 1), true, true},
+                {2012, 2, 28, date(2012, 2, 28), true, true},
+                {2012, 2, 29, date(2012, 2, 29), true, true},
+                {2012, 2, 30, date(2012, 3, 1), date(2012, 2, 29), false},
+                {2012, 2, 31, date(2012, 3, 2), date(2012, 2, 29), false},
+                {2012, 2, 32, date(2012, 3, 3), false, false},
+
+                {2012, -12, 1, date(2010, 12, 1), false, false},
+                {2012, -11, 1, date(2011, 1, 1), false, false},
+                {2012, -1, 1, date(2011, 11, 1), false, false},
+                {2012, 0, 1, date(2011, 12, 1), false, false},
+                {2012, 1, 1, date(2012, 1, 1), true, true},
+                {2012, 12, 1, date(2012, 12, 1), true, true},
+                {2012, 13, 1, date(2013, 1, 1), false, false},
+                {2012, 24, 1, date(2013, 12, 1), false, false},
+                {2012, 25, 1, date(2014, 1, 1), false, false},
+
+                {2012, 6, -31, date(2012, 4, 30), false, false},
+                {2012, 6, -30, date(2012, 5, 1), false, false},
+                {2012, 6, -1, date(2012, 5, 30), false, false},
+                {2012, 6, 0, date(2012, 5, 31), false, false},
+                {2012, 6, 1, date(2012, 6, 1), true, true},
+                {2012, 6, 30, date(2012, 6, 30), true, true},
+                {2012, 6, 31, date(2012, 7, 1), date(2012, 6, 30), false},
+                {2012, 6, 61, date(2012, 7, 31), false, false},
+                {2012, 6, 62, date(2012, 8, 1), false, false},
+
+                {2011, 2, 1, date(2011, 2, 1), true, true},
+                {2011, 2, 28, date(2011, 2, 28), true, true},
+                {2011, 2, 29, date(2011, 3, 1), date(2011, 2, 28), false},
+                {2011, 2, 30, date(2011, 3, 2), date(2011, 2, 28), false},
+                {2011, 2, 31, date(2011, 3, 3), date(2011, 2, 28), false},
+                {2011, 2, 32, date(2011, 3, 4), false, false},
+        };
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_lenient(int y, int m, int d, JapaneseDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_smart(int y, int m, int d, JapaneseDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (Boolean.TRUE.equals(smart)) {
+            JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else if (smart instanceof JapaneseDate) {
+            JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, smart);
+        } else {
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_strict(int y, int m, int d, JapaneseDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (strict) {
+            JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_yd")
+    Object[][] data_resolve_yd() {
+        return new Object[][] {
+                {2012, -365, date(2010, 12, 31), false, false},
+                {2012, -364, date(2011, 1, 1), false, false},
+                {2012, -31, date(2011, 11, 30), false, false},
+                {2012, -30, date(2011, 12, 1), false, false},
+                {2012, -12, date(2011, 12, 19), false, false},
+                {2012, -1, date(2011, 12, 30), false, false},
+                {2012, 0, date(2011, 12, 31), false, false},
+                {2012, 1, date(2012, 1, 1), true, true},
+                {2012, 2, date(2012, 1, 2), true, true},
+                {2012, 31, date(2012, 1, 31), true, true},
+                {2012, 32, date(2012, 2, 1), true, true},
+                {2012, 59, date(2012, 2, 28), true, true},
+                {2012, 60, date(2012, 2, 29), true, true},
+                {2012, 61, date(2012, 3, 1), true, true},
+                {2012, 365, date(2012, 12, 30), true, true},
+                {2012, 366, date(2012, 12, 31), true, true},
+                {2012, 367, date(2013, 1, 1), false, false},
+                {2012, 367 + 364, date(2013, 12, 31), false, false},
+                {2012, 367 + 365, date(2014, 1, 1), false, false},
+
+                {2011, 59, date(2011, 2, 28), true, true},
+                {2011, 60, date(2011, 3, 1), true, true},
+        };
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_lenient(int y, int d, JapaneseDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_smart(int y, int d, JapaneseDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (smart) {
+            JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_strict(int y, int d, JapaneseDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (strict) {
+            JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_eymd")
+    Object[][] data_resolve_eymd() {
+        return new Object[][] {
+                // lenient
+                {ResolverStyle.LENIENT, JapaneseEra.HEISEI, 1, 1, 1, date(1989, 1, 1)},  // SHOWA, not HEISEI
+                {ResolverStyle.LENIENT, JapaneseEra.HEISEI, 1, 1, 7, date(1989, 1, 7)},  // SHOWA, not HEISEI
+                {ResolverStyle.LENIENT, JapaneseEra.HEISEI, 1, 1, 8, date(1989, 1, 8)},
+                {ResolverStyle.LENIENT, JapaneseEra.HEISEI, 1, 12, 31, date(1989, 12, 31)},
+                {ResolverStyle.LENIENT, JapaneseEra.HEISEI, 2, 1, 1, date(1990, 1, 1)},
+
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 1, date(1989, 1, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 7, date(1989, 1, 7)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 8, date(1989, 1, 8)},  // HEISEI, not SHOWA
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 12, 31, date(1989, 12, 31)},  // HEISEI, not SHOWA
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 65, 1, 1, date(1990, 1, 1)},  // HEISEI, not SHOWA
+
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, -366, date(1987, 12, 31)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, -365, date(1988, 1, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, -31, date(1988, 11, 30)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, -30, date(1988, 12, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 0, date(1988, 12, 31)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 1, date(1989, 1, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 27, date(1989, 1, 27)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 28, date(1989, 1, 28)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 29, date(1989, 1, 29)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 30, date(1989, 1, 30)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 31, date(1989, 1, 31)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 32, date(1989, 2, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 58, date(1989, 2, 27)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 59, date(1989, 2, 28)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 60, date(1989, 3, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 365, date(1989, 12, 31)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 1, 366, date(1990, 1, 1)},
+
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 1, date(1988, 1, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 31, date(1988, 1, 31)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 32, date(1988, 2, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 58, date(1988, 2, 27)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 59, date(1988, 2, 28)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 60, date(1988, 2, 29)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 1, 61, date(1988, 3, 1)},
+
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 2, 1, date(1989, 2, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 2, 28, date(1989, 2, 28)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 64, 2, 29, date(1989, 3, 1)},
+
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 2, 1, date(1988, 2, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 2, 28, date(1988, 2, 28)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 2, 29, date(1988, 2, 29)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 63, 2, 30, date(1988, 3, 1)},
+
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 62, -11, 1, date(1986, 1, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 62, -1, 1, date(1986, 11, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 62, 0, 1, date(1986, 12, 1)},
+                {ResolverStyle.LENIENT, JapaneseEra.SHOWA, 62, 13, 1, date(1988, 1, 1)},
+
+                // smart
+                {ResolverStyle.SMART, JapaneseEra.HEISEI, 0, 1, 1, null},
+                {ResolverStyle.SMART, JapaneseEra.HEISEI, 1, 1, 1, date(1989, 1, 1)},  // SHOWA, not HEISEI
+                {ResolverStyle.SMART, JapaneseEra.HEISEI, 1, 1, 7, date(1989, 1, 7)},  // SHOWA, not HEISEI
+                {ResolverStyle.SMART, JapaneseEra.HEISEI, 1, 1, 8, date(1989, 1, 8)},
+                {ResolverStyle.SMART, JapaneseEra.HEISEI, 1, 12, 31, date(1989, 12, 31)},
+                {ResolverStyle.SMART, JapaneseEra.HEISEI, 2, 1, 1, date(1990, 1, 1)},
+
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 64, 1, 1, date(1989, 1, 1)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 64, 1, 7, date(1989, 1, 7)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 64, 1, 8, date(1989, 1, 8)},  // HEISEI, not SHOWA
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 64, 12, 31, date(1989, 12, 31)},  // HEISEI, not SHOWA
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 65, 1, 1, null},  // HEISEI, not SHOWA
+
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 0, null},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 1, date(1987, 1, 1)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 27, date(1987, 1, 27)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 28, date(1987, 1, 28)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 29, date(1987, 1, 29)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 30, date(1987, 1, 30)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 31, date(1987, 1, 31)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 1, 32, null},
+
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 0, null},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 1, date(1987, 2, 1)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 27, date(1987, 2, 27)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 28, date(1987, 2, 28)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 29, date(1987, 2, 28)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 30, date(1987, 2, 28)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 31, date(1987, 2, 28)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 2, 32, null},
+
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 0, null},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 1, date(1988, 2, 1)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 27, date(1988, 2, 27)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 28, date(1988, 2, 28)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 29, date(1988, 2, 29)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 30, date(1988, 2, 29)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 31, date(1988, 2, 29)},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 63, 2, 32, null},
+
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, -12, 1, null},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, -1, 1, null},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 0, 1, null},
+                {ResolverStyle.SMART, JapaneseEra.SHOWA, 62, 13, 1, null},
+
+                // strict
+                {ResolverStyle.STRICT, JapaneseEra.HEISEI, 0, 1, 1, null},
+                {ResolverStyle.STRICT, JapaneseEra.HEISEI, 1, 1, 1, null},  // SHOWA, not HEISEI
+                {ResolverStyle.STRICT, JapaneseEra.HEISEI, 1, 1, 7, null},  // SHOWA, not HEISEI
+                {ResolverStyle.STRICT, JapaneseEra.HEISEI, 1, 1, 8, date(1989, 1, 8)},
+                {ResolverStyle.STRICT, JapaneseEra.HEISEI, 1, 12, 31, date(1989, 12, 31)},
+                {ResolverStyle.STRICT, JapaneseEra.HEISEI, 2, 1, 1, date(1990, 1, 1)},
+
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 64, 1, 1, date(1989, 1, 1)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 64, 1, 7, date(1989, 1, 7)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 64, 1, 8, null},  // HEISEI, not SHOWA
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 64, 12, 31, null},  // HEISEI, not SHOWA
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 65, 1, 1, null},  // HEISEI, not SHOWA
+
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 0, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 1, date(1987, 1, 1)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 27, date(1987, 1, 27)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 28, date(1987, 1, 28)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 29, date(1987, 1, 29)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 30, date(1987, 1, 30)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 31, date(1987, 1, 31)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 1, 32, null},
+
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 0, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 1, date(1987, 2, 1)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 27, date(1987, 2, 27)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 28, date(1987, 2, 28)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 29, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 30, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 31, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 2, 32, null},
+
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 0, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 1, date(1988, 2, 1)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 27, date(1988, 2, 27)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 28, date(1988, 2, 28)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 29, date(1988, 2, 29)},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 30, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 31, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 63, 2, 32, null},
+
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, -12, 1, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, -1, 1, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 0, 1, null},
+                {ResolverStyle.STRICT, JapaneseEra.SHOWA, 62, 13, 1, null},
+        };
+    }
+
+    @Test(dataProvider = "resolve_eymd")
+    public void test_resolve_eymd(ResolverStyle style, JapaneseEra era, int yoe, int m, int d, JapaneseDate expected) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.ERA, (long) era.getValue());
+        fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (expected != null) {
+            JapaneseDate date = JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                JapaneseChronology.INSTANCE.resolveDate(fieldValues, style);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    private static JapaneseDate date(int y, int m, int d) {
+        return JapaneseDate.of(y, m, d);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKJapaneseEra.java	Tue Aug 06 16:54:56 2013 -0700
@@ -81,7 +81,6 @@
                     {JapaneseEra.SHOWA, "Showa", 1},
                     {JapaneseEra.TAISHO, "Taisho", 0},
                     {JapaneseEra.MEIJI, "Meiji", -1},
-                    {JapaneseEra.SEIREKI, "Seireki", -999},
         };
     }
 
@@ -112,8 +111,8 @@
     public void test_range() {
         // eras may be added after release
         for (JapaneseEra era : JapaneseEra.values()) {
-            assertEquals(era.range(ERA).getMinimum(), -999);
-            assertEquals(era.range(ERA).getLargestMinimum(), -999);
+            assertEquals(era.range(ERA).getMinimum(), -1);
+            assertEquals(era.range(ERA).getLargestMinimum(), -1);
             assertEquals(era.range(ERA).getSmallestMaximum(), era.range(ERA).getMaximum());
             assertEquals(era.range(ERA).getMaximum() >= 2, true);
         }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -58,6 +58,7 @@
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
@@ -83,12 +84,19 @@
 import java.time.chrono.MinguoChronology;
 import java.time.chrono.MinguoDate;
 import java.time.chrono.MinguoEra;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.MinguoDate;
 import java.time.chrono.ThaiBuddhistChronology;
 import java.time.chrono.ThaiBuddhistDate;
+import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalField;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
@@ -162,6 +170,18 @@
     @Test(dataProvider="samples")
     public void test_fromCalendrical(MinguoDate minguo, LocalDate iso) {
         assertEquals(MinguoChronology.INSTANCE.date(iso), minguo);
+        assertEquals(MinguoDate.from(iso), minguo);
+    }
+
+    @Test(dataProvider="samples")
+    public void test_isEqual(MinguoDate minguo, LocalDate iso) {
+        assertTrue(minguo.isEqual(iso));
+    }
+
+    @Test(dataProvider="samples")
+    public void test_date_equals(MinguoDate minguo, LocalDate iso) {
+        assertFalse(minguo.equals(iso));
+        assertNotEquals(minguo.hashCode(), iso.hashCode());
     }
 
     @Test
@@ -276,12 +296,24 @@
 
     @Test(dataProvider="prolepticYear")
     public void test_prolepticYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
-        Era eraObj = MinguoChronology.INSTANCE.eraOf(eraValue) ;
+        Era eraObj = MinguoChronology.INSTANCE.eraOf(eraValue);
         assertTrue(MinguoChronology.INSTANCE.eras().contains(eraObj));
         assertEquals(eraObj, era);
         assertEquals(MinguoChronology.INSTANCE.prolepticYear(era, yearOfEra), expectedProlepticYear);
-        assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ;
-        assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap()) ;
+    }
+
+    @Test(dataProvider="prolepticYear")
+    public void test_isLeapYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
+        assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear);
+        assertEquals(MinguoChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear + YDIFF).isLeap());
+
+        MinguoDate minguo = MinguoDate.now();
+        minguo = minguo.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
+        if (isLeapYear) {
+            assertEquals(minguo.lengthOfMonth(), 29);
+        } else {
+            assertEquals(minguo.lengthOfMonth(), 28);
+        }
     }
 
     //-----------------------------------------------------------------------
@@ -467,7 +499,7 @@
     public void test_periodUntilDate() {
         MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
         MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
-        Period period = mdate1.periodUntil(mdate2);
+        Period period = mdate1.until(mdate2);
         assertEquals(period, Period.of(1, 1, 1));
     }
 
@@ -475,7 +507,7 @@
     public void test_periodUntilUnit() {
         MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
         MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
-        long months = mdate1.periodUntil(mdate2, ChronoUnit.MONTHS);
+        long months = mdate1.until(mdate2, ChronoUnit.MONTHS);
         assertEquals(months, 13);
     }
 
@@ -484,7 +516,7 @@
         MinguoDate mdate1 = MinguoDate.of(1970, 1, 1);
         MinguoDate mdate2 = MinguoDate.of(1971, 2, 2);
         ThaiBuddhistDate ldate2 = ThaiBuddhistChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.periodUntil(ldate2);
+        Period period = mdate1.until(ldate2);
         assertEquals(period, Period.of(1, 1, 1));
     }
 
@@ -520,4 +552,409 @@
         assertFalse(MinguoChronology.INSTANCE.equals(IsoChronology.INSTANCE));
     }
 
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_yearOfEra")
+    Object[][] data_resolve_yearOfEra() {
+        return new Object[][] {
+                // era only
+                {ResolverStyle.STRICT, -1, null, null, null, null},
+                {ResolverStyle.SMART, -1, null, null, null, null},
+                {ResolverStyle.LENIENT, -1, null, null, null, null},
+
+                {ResolverStyle.STRICT, 0, null, null, ChronoField.ERA, 0},
+                {ResolverStyle.SMART, 0, null, null, ChronoField.ERA, 0},
+                {ResolverStyle.LENIENT, 0, null, null, ChronoField.ERA, 0},
+
+                {ResolverStyle.STRICT, 1, null, null, ChronoField.ERA, 1},
+                {ResolverStyle.SMART, 1, null, null, ChronoField.ERA, 1},
+                {ResolverStyle.LENIENT, 1, null, null, ChronoField.ERA, 1},
+
+                {ResolverStyle.STRICT, 2, null, null, null, null},
+                {ResolverStyle.SMART, 2, null, null, null, null},
+                {ResolverStyle.LENIENT, 2, null, null, null, null},
+
+                // era and year-of-era
+                {ResolverStyle.STRICT, -1, 2012, null, null, null},
+                {ResolverStyle.SMART, -1, 2012, null, null, null},
+                {ResolverStyle.LENIENT, -1, 2012, null, null, null},
+
+                {ResolverStyle.STRICT, 0, 2012, null, ChronoField.YEAR, -2011},
+                {ResolverStyle.SMART, 0, 2012, null, ChronoField.YEAR, -2011},
+                {ResolverStyle.LENIENT, 0, 2012, null, ChronoField.YEAR, -2011},
+
+                {ResolverStyle.STRICT, 1, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.SMART, 1, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, 1, 2012, null, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, 2, 2012, null, null, null},
+                {ResolverStyle.SMART, 2, 2012, null, null, null},
+                {ResolverStyle.LENIENT, 2, 2012, null, null, null},
+
+                // year-of-era only
+                {ResolverStyle.STRICT, null, 2012, null, ChronoField.YEAR_OF_ERA, 2012},
+                {ResolverStyle.SMART, null, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, null, 2012, null, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, null, Integer.MAX_VALUE, null, null, null},
+                {ResolverStyle.SMART, null, Integer.MAX_VALUE, null, null, null},
+                {ResolverStyle.LENIENT, null, Integer.MAX_VALUE, null, ChronoField.YEAR, Integer.MAX_VALUE},
+
+                // year-of-era and year
+                {ResolverStyle.STRICT, null, 2012, 2012, ChronoField.YEAR, 2012},
+                {ResolverStyle.SMART, null, 2012, 2012, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, null, 2012, 2012, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, null, 2012, -2011, ChronoField.YEAR, -2011},
+                {ResolverStyle.SMART, null, 2012, -2011, ChronoField.YEAR, -2011},
+                {ResolverStyle.LENIENT, null, 2012, -2011, ChronoField.YEAR, -2011},
+
+                {ResolverStyle.STRICT, null, 2012, 2013, null, null},
+                {ResolverStyle.SMART, null, 2012, 2013, null, null},
+                {ResolverStyle.LENIENT, null, 2012, 2013, null, null},
+
+                {ResolverStyle.STRICT, null, 2012, -2013, null, null},
+                {ResolverStyle.SMART, null, 2012, -2013, null, null},
+                {ResolverStyle.LENIENT, null, 2012, -2013, null, null},
+        };
+    }
+
+    @Test(dataProvider = "resolve_yearOfEra")
+    public void test_resolve_yearOfEra(ResolverStyle style, Integer e, Integer yoe, Integer y, ChronoField field, Integer expected) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        if (e != null) {
+            fieldValues.put(ChronoField.ERA, (long) e);
+        }
+        if (yoe != null) {
+            fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
+        }
+        if (y != null) {
+            fieldValues.put(ChronoField.YEAR, (long) y);
+        }
+        if (field != null) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, style);
+            assertEquals(date, null);
+            assertEquals(fieldValues.get(field), (Long) expected.longValue());
+            assertEquals(fieldValues.size(), 1);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, style);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_ymd")
+    Object[][] data_resolve_ymd() {
+        return new Object[][] {
+                {2012 - YDIFF, 1, -365, date(2010 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, -364, date(2011 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 1, -31, date(2011 - YDIFF, 11, 30), false, false},
+                {2012 - YDIFF, 1, -30, date(2011 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, 1, -12, date(2011 - YDIFF, 12, 19), false, false},
+                {2012 - YDIFF, 1, 1, date(2012 - YDIFF, 1, 1), true, true},
+                {2012 - YDIFF, 1, 27, date(2012 - YDIFF, 1, 27), true, true},
+                {2012 - YDIFF, 1, 28, date(2012 - YDIFF, 1, 28), true, true},
+                {2012 - YDIFF, 1, 29, date(2012 - YDIFF, 1, 29), true, true},
+                {2012 - YDIFF, 1, 30, date(2012 - YDIFF, 1, 30), true, true},
+                {2012 - YDIFF, 1, 31, date(2012 - YDIFF, 1, 31), true, true},
+                {2012 - YDIFF, 1, 59, date(2012 - YDIFF, 2, 28), false, false},
+                {2012 - YDIFF, 1, 60, date(2012 - YDIFF, 2, 29), false, false},
+                {2012 - YDIFF, 1, 61, date(2012 - YDIFF, 3, 1), false, false},
+                {2012 - YDIFF, 1, 365, date(2012 - YDIFF, 12, 30), false, false},
+                {2012 - YDIFF, 1, 366, date(2012 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, 367, date(2013 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 1, 367 + 364, date(2013 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, 367 + 365, date(2014 - YDIFF, 1, 1), false, false},
+
+                {2012 - YDIFF, 2, 1, date(2012 - YDIFF, 2, 1), true, true},
+                {2012 - YDIFF, 2, 28, date(2012 - YDIFF, 2, 28), true, true},
+                {2012 - YDIFF, 2, 29, date(2012 - YDIFF, 2, 29), true, true},
+                {2012 - YDIFF, 2, 30, date(2012 - YDIFF, 3, 1), date(2012 - YDIFF, 2, 29), false},
+                {2012 - YDIFF, 2, 31, date(2012 - YDIFF, 3, 2), date(2012 - YDIFF, 2, 29), false},
+                {2012 - YDIFF, 2, 32, date(2012 - YDIFF, 3, 3), false, false},
+
+                {2012 - YDIFF, -12, 1, date(2010 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, -11, 1, date(2011 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, -1, 1, date(2011 - YDIFF, 11, 1), false, false},
+                {2012 - YDIFF, 0, 1, date(2011 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, 1, 1, date(2012 - YDIFF, 1, 1), true, true},
+                {2012 - YDIFF, 12, 1, date(2012 - YDIFF, 12, 1), true, true},
+                {2012 - YDIFF, 13, 1, date(2013 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 24, 1, date(2013 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, 25, 1, date(2014 - YDIFF, 1, 1), false, false},
+
+                {2012 - YDIFF, 6, -31, date(2012 - YDIFF, 4, 30), false, false},
+                {2012 - YDIFF, 6, -30, date(2012 - YDIFF, 5, 1), false, false},
+                {2012 - YDIFF, 6, -1, date(2012 - YDIFF, 5, 30), false, false},
+                {2012 - YDIFF, 6, 0, date(2012 - YDIFF, 5, 31), false, false},
+                {2012 - YDIFF, 6, 1, date(2012 - YDIFF, 6, 1), true, true},
+                {2012 - YDIFF, 6, 30, date(2012 - YDIFF, 6, 30), true, true},
+                {2012 - YDIFF, 6, 31, date(2012 - YDIFF, 7, 1), date(2012 - YDIFF, 6, 30), false},
+                {2012 - YDIFF, 6, 61, date(2012 - YDIFF, 7, 31), false, false},
+                {2012 - YDIFF, 6, 62, date(2012 - YDIFF, 8, 1), false, false},
+
+                {2011 - YDIFF, 2, 1, date(2011 - YDIFF, 2, 1), true, true},
+                {2011 - YDIFF, 2, 28, date(2011 - YDIFF, 2, 28), true, true},
+                {2011 - YDIFF, 2, 29, date(2011 - YDIFF, 3, 1), date(2011 - YDIFF, 2, 28), false},
+                {2011 - YDIFF, 2, 30, date(2011 - YDIFF, 3, 2), date(2011 - YDIFF, 2, 28), false},
+                {2011 - YDIFF, 2, 31, date(2011 - YDIFF, 3, 3), date(2011 - YDIFF, 2, 28), false},
+                {2011 - YDIFF, 2, 32, date(2011 - YDIFF, 3, 4), false, false},
+        };
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_lenient(int y, int m, int d, MinguoDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_smart(int y, int m, int d, MinguoDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (Boolean.TRUE.equals(smart)) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else if (smart instanceof MinguoDate) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, smart);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_strict(int y, int m, int d, MinguoDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (strict) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_yd")
+    Object[][] data_resolve_yd() {
+        return new Object[][] {
+                {2012 - YDIFF, -365, date(2010 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, -364, date(2011 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, -31, date(2011 - YDIFF, 11, 30), false, false},
+                {2012 - YDIFF, -30, date(2011 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, -12, date(2011 - YDIFF, 12, 19), false, false},
+                {2012 - YDIFF, -1, date(2011 - YDIFF, 12, 30), false, false},
+                {2012 - YDIFF, 0, date(2011 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, date(2012 - YDIFF, 1, 1), true, true},
+                {2012 - YDIFF, 2, date(2012 - YDIFF, 1, 2), true, true},
+                {2012 - YDIFF, 31, date(2012 - YDIFF, 1, 31), true, true},
+                {2012 - YDIFF, 32, date(2012 - YDIFF, 2, 1), true, true},
+                {2012 - YDIFF, 59, date(2012 - YDIFF, 2, 28), true, true},
+                {2012 - YDIFF, 60, date(2012 - YDIFF, 2, 29), true, true},
+                {2012 - YDIFF, 61, date(2012 - YDIFF, 3, 1), true, true},
+                {2012 - YDIFF, 365, date(2012 - YDIFF, 12, 30), true, true},
+                {2012 - YDIFF, 366, date(2012 - YDIFF, 12, 31), true, true},
+                {2012 - YDIFF, 367, date(2013 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 367 + 364, date(2013 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 367 + 365, date(2014 - YDIFF, 1, 1), false, false},
+
+                {2011 - YDIFF, 59, date(2011 - YDIFF, 2, 28), true, true},
+                {2011 - YDIFF, 60, date(2011 - YDIFF, 3, 1), true, true},
+        };
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_lenient(int y, int d, MinguoDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_smart(int y, int d, MinguoDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (smart) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_strict(int y, int d, MinguoDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (strict) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_ymaa")
+    Object[][] data_resolve_ymaa() {
+        return new Object[][] {
+                {2012 - YDIFF, 1, 1, -365, date(2010 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, 1, -364, date(2011 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 1, 1, -31, date(2011 - YDIFF, 11, 30), false, false},
+                {2012 - YDIFF, 1, 1, -30, date(2011 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, 1, 1, -12, date(2011 - YDIFF, 12, 19), false, false},
+                {2012 - YDIFF, 1, 1, 1, date(2012 - YDIFF, 1, 1), true, true},
+                {2012 - YDIFF, 1, 1, 59, date(2012 - YDIFF, 2, 28), false, false},
+                {2012 - YDIFF, 1, 1, 60, date(2012 - YDIFF, 2, 29), false, false},
+                {2012 - YDIFF, 1, 1, 61, date(2012 - YDIFF, 3, 1), false, false},
+                {2012 - YDIFF, 1, 1, 365, date(2012 - YDIFF, 12, 30), false, false},
+                {2012 - YDIFF, 1, 1, 366, date(2012 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, 1, 367, date(2013 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 1, 1, 367 + 364, date(2013 - YDIFF, 12, 31), false, false},
+                {2012 - YDIFF, 1, 1, 367 + 365, date(2014 - YDIFF, 1, 1), false, false},
+
+                {2012 - YDIFF, 2, 0, 1, date(2012 - YDIFF, 1, 25), false, false},
+                {2012 - YDIFF, 2, 0, 7, date(2012 - YDIFF, 1, 31), false, false},
+                {2012 - YDIFF, 2, 1, 1, date(2012 - YDIFF, 2, 1), true, true},
+                {2012 - YDIFF, 2, 1, 7, date(2012 - YDIFF, 2, 7), true, true},
+                {2012 - YDIFF, 2, 2, 1, date(2012 - YDIFF, 2, 8), true, true},
+                {2012 - YDIFF, 2, 2, 7, date(2012 - YDIFF, 2, 14), true, true},
+                {2012 - YDIFF, 2, 3, 1, date(2012 - YDIFF, 2, 15), true, true},
+                {2012 - YDIFF, 2, 3, 7, date(2012 - YDIFF, 2, 21), true, true},
+                {2012 - YDIFF, 2, 4, 1, date(2012 - YDIFF, 2, 22), true, true},
+                {2012 - YDIFF, 2, 4, 7, date(2012 - YDIFF, 2, 28), true, true},
+                {2012 - YDIFF, 2, 5, 1, date(2012 - YDIFF, 2, 29), true, true},
+                {2012 - YDIFF, 2, 5, 2, date(2012 - YDIFF, 3, 1), true, false},
+                {2012 - YDIFF, 2, 5, 7, date(2012 - YDIFF, 3, 6), true, false},
+                {2012 - YDIFF, 2, 6, 1, date(2012 - YDIFF, 3, 7), false, false},
+                {2012 - YDIFF, 2, 6, 7, date(2012 - YDIFF, 3, 13), false, false},
+
+                {2012 - YDIFF, 12, 1, 1, date(2012 - YDIFF, 12, 1), true, true},
+                {2012 - YDIFF, 12, 5, 1, date(2012 - YDIFF, 12, 29), true, true},
+                {2012 - YDIFF, 12, 5, 2, date(2012 - YDIFF, 12, 30), true, true},
+                {2012 - YDIFF, 12, 5, 3, date(2012 - YDIFF, 12, 31), true, true},
+                {2012 - YDIFF, 12, 5, 4, date(2013 - YDIFF, 1, 1), true, false},
+                {2012 - YDIFF, 12, 5, 7, date(2013 - YDIFF, 1, 4), true, false},
+
+                {2012 - YDIFF, -12, 1, 1, date(2010 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, -11, 1, 1, date(2011 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, -1, 1, 1, date(2011 - YDIFF, 11, 1), false, false},
+                {2012 - YDIFF, 0, 1, 1, date(2011 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, 1, 1, 1, date(2012 - YDIFF, 1, 1), true, true},
+                {2012 - YDIFF, 12, 1, 1, date(2012 - YDIFF, 12, 1), true, true},
+                {2012 - YDIFF, 13, 1, 1, date(2013 - YDIFF, 1, 1), false, false},
+                {2012 - YDIFF, 24, 1, 1, date(2013 - YDIFF, 12, 1), false, false},
+                {2012 - YDIFF, 25, 1, 1, date(2014 - YDIFF, 1, 1), false, false},
+
+                {2011 - YDIFF, 2, 1, 1, date(2011 - YDIFF, 2, 1), true, true},
+                {2011 - YDIFF, 2, 4, 7, date(2011 - YDIFF, 2, 28), true, true},
+                {2011 - YDIFF, 2, 5, 1, date(2011 - YDIFF, 3, 1), true, false},
+        };
+    }
+
+    @Test(dataProvider = "resolve_ymaa")
+    public void test_resolve_ymaa_lenient(int y, int m, int w, int d, MinguoDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
+        fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
+        MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_ymaa")
+    public void test_resolve_ymaa_smart(int y, int m, int w, int d, MinguoDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
+        fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
+        if (smart) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymaa")
+    public void test_resolve_ymaa_strict(int y, int m, int w, int d, MinguoDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
+        fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
+        if (strict) {
+            MinguoDate date = MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                MinguoChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    private static MinguoDate date(int y, int m, int d) {
+        return MinguoDate.of(y, m, d);
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -63,6 +63,7 @@
 import static java.time.temporal.ChronoField.YEAR_OF_ERA;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
@@ -84,12 +85,16 @@
 import java.time.chrono.ThaiBuddhistChronology;
 import java.time.chrono.ThaiBuddhistDate;
 import java.time.chrono.ThaiBuddhistEra;
+import java.time.format.ResolverStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
 import java.time.temporal.TemporalAdjuster;
+import java.time.temporal.TemporalField;
 import java.time.temporal.ValueRange;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
@@ -200,6 +205,18 @@
     @Test(dataProvider="samples")
     public void test_fromCalendrical(ThaiBuddhistDate jdate, LocalDate iso) {
         assertEquals(ThaiBuddhistChronology.INSTANCE.date(iso), jdate);
+        assertEquals(ThaiBuddhistDate.from(iso), jdate);
+    }
+
+    @Test(dataProvider="samples")
+    public void test_isEqual(ThaiBuddhistDate jdate, LocalDate iso) {
+        assertTrue(jdate.isEqual(iso));
+    }
+
+    @Test(dataProvider="samples")
+    public void test_date_equals(ThaiBuddhistDate jdate, LocalDate iso) {
+        assertFalse(jdate.equals(iso));
+        assertNotEquals(jdate.hashCode(), iso.hashCode());
     }
 
     @Test
@@ -251,46 +268,58 @@
         ThaiBuddhistChronology.INSTANCE.date(year, month, dom);
     }
 
-  //-----------------------------------------------------------------------
-  // prolepticYear() and is LeapYear()
-  //-----------------------------------------------------------------------
-  @DataProvider(name="prolepticYear")
-  Object[][] data_prolepticYear() {
-      return new Object[][] {
-          {1, ThaiBuddhistEra.BE, 4 + YDIFF, 4 + YDIFF, true},
-          {1, ThaiBuddhistEra.BE, 7 + YDIFF, 7 + YDIFF, false},
-          {1, ThaiBuddhistEra.BE, 8 + YDIFF, 8 + YDIFF, true},
-          {1, ThaiBuddhistEra.BE, 1000 + YDIFF, 1000 + YDIFF, false},
-          {1, ThaiBuddhistEra.BE, 2000 + YDIFF, 2000 + YDIFF, true},
-          {1, ThaiBuddhistEra.BE, 0, 0, false},
-          {1, ThaiBuddhistEra.BE, -4 + YDIFF, -4 + YDIFF, true},
-          {1, ThaiBuddhistEra.BE, -7 + YDIFF, -7 + YDIFF, false},
-          {1, ThaiBuddhistEra.BE, -100 + YDIFF, -100 + YDIFF, false},
-          {1, ThaiBuddhistEra.BE, -800 + YDIFF, -800 + YDIFF, true},
+    //-----------------------------------------------------------------------
+    // prolepticYear() and is LeapYear()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="prolepticYear")
+    Object[][] data_prolepticYear() {
+        return new Object[][] {
+            {1, ThaiBuddhistEra.BE, 4 + YDIFF, 4 + YDIFF, true},
+            {1, ThaiBuddhistEra.BE, 7 + YDIFF, 7 + YDIFF, false},
+            {1, ThaiBuddhistEra.BE, 8 + YDIFF, 8 + YDIFF, true},
+            {1, ThaiBuddhistEra.BE, 1000 + YDIFF, 1000 + YDIFF, false},
+            {1, ThaiBuddhistEra.BE, 2000 + YDIFF, 2000 + YDIFF, true},
+            {1, ThaiBuddhistEra.BE, 0, 0, false},
+            {1, ThaiBuddhistEra.BE, -4 + YDIFF, -4 + YDIFF, true},
+            {1, ThaiBuddhistEra.BE, -7 + YDIFF, -7 + YDIFF, false},
+            {1, ThaiBuddhistEra.BE, -100 + YDIFF, -100 + YDIFF, false},
+            {1, ThaiBuddhistEra.BE, -800 + YDIFF, -800 + YDIFF, true},
 
-          {0, ThaiBuddhistEra.BEFORE_BE, -3 - YDIFF, 4 + YDIFF, true},
-          {0, ThaiBuddhistEra.BEFORE_BE, -6 - YDIFF, 7 + YDIFF, false},
-          {0, ThaiBuddhistEra.BEFORE_BE, -7 - YDIFF, 8 + YDIFF, true},
-          {0, ThaiBuddhistEra.BEFORE_BE, -999 - YDIFF, 1000 + YDIFF, false},
-          {0, ThaiBuddhistEra.BEFORE_BE, -1999 - YDIFF, 2000 + YDIFF, true},
-          {0, ThaiBuddhistEra.BEFORE_BE, 1, 0, false},
-          {0, ThaiBuddhistEra.BEFORE_BE, 5 - YDIFF, -4 + YDIFF, true},
-          {0, ThaiBuddhistEra.BEFORE_BE, 8 - YDIFF, -7 + YDIFF, false},
-          {0, ThaiBuddhistEra.BEFORE_BE, 101 - YDIFF, -100 + YDIFF, false},
-          {0, ThaiBuddhistEra.BEFORE_BE, 801 - YDIFF, -800 + YDIFF, true},
+            {0, ThaiBuddhistEra.BEFORE_BE, -3 - YDIFF, 4 + YDIFF, true},
+            {0, ThaiBuddhistEra.BEFORE_BE, -6 - YDIFF, 7 + YDIFF, false},
+            {0, ThaiBuddhistEra.BEFORE_BE, -7 - YDIFF, 8 + YDIFF, true},
+            {0, ThaiBuddhistEra.BEFORE_BE, -999 - YDIFF, 1000 + YDIFF, false},
+            {0, ThaiBuddhistEra.BEFORE_BE, -1999 - YDIFF, 2000 + YDIFF, true},
+            {0, ThaiBuddhistEra.BEFORE_BE, 1, 0, false},
+            {0, ThaiBuddhistEra.BEFORE_BE, 5 - YDIFF, -4 + YDIFF, true},
+            {0, ThaiBuddhistEra.BEFORE_BE, 8 - YDIFF, -7 + YDIFF, false},
+            {0, ThaiBuddhistEra.BEFORE_BE, 101 - YDIFF, -100 + YDIFF, false},
+            {0, ThaiBuddhistEra.BEFORE_BE, 801 - YDIFF, -800 + YDIFF, true},
+
+        };
+    }
 
-      };
-  }
+    @Test(dataProvider="prolepticYear")
+    public void test_prolepticYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
+        Era eraObj = ThaiBuddhistChronology.INSTANCE.eraOf(eraValue);
+        assertTrue(ThaiBuddhistChronology.INSTANCE.eras().contains(eraObj));
+        assertEquals(eraObj, era);
+        assertEquals(ThaiBuddhistChronology.INSTANCE.prolepticYear(era, yearOfEra), expectedProlepticYear);
+    }
 
-  @Test(dataProvider="prolepticYear")
-  public void test_prolepticYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
-      Era eraObj = ThaiBuddhistChronology.INSTANCE.eraOf(eraValue) ;
-      assertTrue(ThaiBuddhistChronology.INSTANCE.eras().contains(eraObj));
-      assertEquals(eraObj, era);
-      assertEquals(ThaiBuddhistChronology.INSTANCE.prolepticYear(era, yearOfEra), expectedProlepticYear);
-      assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ;
-      assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap()) ;
-  }
+    @Test(dataProvider="prolepticYear")
+    public void test_isLeapYear(int eraValue, Era  era, int yearOfEra, int expectedProlepticYear, boolean isLeapYear) {
+        assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), isLeapYear) ;
+        assertEquals(ThaiBuddhistChronology.INSTANCE.isLeapYear(expectedProlepticYear), Year.of(expectedProlepticYear - YDIFF).isLeap());
+
+        ThaiBuddhistDate jdate = ThaiBuddhistDate.now();
+        jdate = jdate.with(ChronoField.YEAR, expectedProlepticYear).with(ChronoField.MONTH_OF_YEAR, 2);
+        if (isLeapYear) {
+            assertEquals(jdate.lengthOfMonth(), 29);
+        } else {
+            assertEquals(jdate.lengthOfMonth(), 28);
+        }
+    }
 
     //-----------------------------------------------------------------------
     // Bad Era for Chronology.date(era,...) and Chronology.prolepticYear(Era,...)
@@ -429,7 +458,7 @@
     public void test_periodUntilDate() {
         ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
         ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
-        Period period = mdate1.periodUntil(mdate2);
+        Period period = mdate1.until(mdate2);
         assertEquals(period, Period.of(1, 1, 1));
     }
 
@@ -437,7 +466,7 @@
     public void test_periodUntilUnit() {
         ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
         ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
-        long months = mdate1.periodUntil(mdate2, ChronoUnit.MONTHS);
+        long months = mdate1.until(mdate2, ChronoUnit.MONTHS);
         assertEquals(months, 13);
     }
 
@@ -446,7 +475,7 @@
         ThaiBuddhistDate mdate1 = ThaiBuddhistDate.of(1, 1, 1);
         ThaiBuddhistDate mdate2 = ThaiBuddhistDate.of(2, 2, 2);
         MinguoDate ldate2 = MinguoChronology.INSTANCE.date(mdate2);
-        Period period = mdate1.periodUntil(ldate2);
+        Period period = mdate1.until(ldate2);
         assertEquals(period, Period.of(1, 1, 1));
     }
 
@@ -497,4 +526,409 @@
         assertFalse(ThaiBuddhistChronology.INSTANCE.equals(IsoChronology.INSTANCE));
     }
 
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_yearOfEra")
+    Object[][] data_resolve_yearOfEra() {
+        return new Object[][] {
+                // era only
+                {ResolverStyle.STRICT, -1, null, null, null, null},
+                {ResolverStyle.SMART, -1, null, null, null, null},
+                {ResolverStyle.LENIENT, -1, null, null, null, null},
+
+                {ResolverStyle.STRICT, 0, null, null, ChronoField.ERA, 0},
+                {ResolverStyle.SMART, 0, null, null, ChronoField.ERA, 0},
+                {ResolverStyle.LENIENT, 0, null, null, ChronoField.ERA, 0},
+
+                {ResolverStyle.STRICT, 1, null, null, ChronoField.ERA, 1},
+                {ResolverStyle.SMART, 1, null, null, ChronoField.ERA, 1},
+                {ResolverStyle.LENIENT, 1, null, null, ChronoField.ERA, 1},
+
+                {ResolverStyle.STRICT, 2, null, null, null, null},
+                {ResolverStyle.SMART, 2, null, null, null, null},
+                {ResolverStyle.LENIENT, 2, null, null, null, null},
+
+                // era and year-of-era
+                {ResolverStyle.STRICT, -1, 2012, null, null, null},
+                {ResolverStyle.SMART, -1, 2012, null, null, null},
+                {ResolverStyle.LENIENT, -1, 2012, null, null, null},
+
+                {ResolverStyle.STRICT, 0, 2012, null, ChronoField.YEAR, -2011},
+                {ResolverStyle.SMART, 0, 2012, null, ChronoField.YEAR, -2011},
+                {ResolverStyle.LENIENT, 0, 2012, null, ChronoField.YEAR, -2011},
+
+                {ResolverStyle.STRICT, 1, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.SMART, 1, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, 1, 2012, null, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, 2, 2012, null, null, null},
+                {ResolverStyle.SMART, 2, 2012, null, null, null},
+                {ResolverStyle.LENIENT, 2, 2012, null, null, null},
+
+                // year-of-era only
+                {ResolverStyle.STRICT, null, 2012, null, ChronoField.YEAR_OF_ERA, 2012},
+                {ResolverStyle.SMART, null, 2012, null, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, null, 2012, null, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, null, Integer.MAX_VALUE, null, null, null},
+                {ResolverStyle.SMART, null, Integer.MAX_VALUE, null, null, null},
+                {ResolverStyle.LENIENT, null, Integer.MAX_VALUE, null, ChronoField.YEAR, Integer.MAX_VALUE},
+
+                // year-of-era and year
+                {ResolverStyle.STRICT, null, 2012, 2012, ChronoField.YEAR, 2012},
+                {ResolverStyle.SMART, null, 2012, 2012, ChronoField.YEAR, 2012},
+                {ResolverStyle.LENIENT, null, 2012, 2012, ChronoField.YEAR, 2012},
+
+                {ResolverStyle.STRICT, null, 2012, -2011, ChronoField.YEAR, -2011},
+                {ResolverStyle.SMART, null, 2012, -2011, ChronoField.YEAR, -2011},
+                {ResolverStyle.LENIENT, null, 2012, -2011, ChronoField.YEAR, -2011},
+
+                {ResolverStyle.STRICT, null, 2012, 2013, null, null},
+                {ResolverStyle.SMART, null, 2012, 2013, null, null},
+                {ResolverStyle.LENIENT, null, 2012, 2013, null, null},
+
+                {ResolverStyle.STRICT, null, 2012, -2013, null, null},
+                {ResolverStyle.SMART, null, 2012, -2013, null, null},
+                {ResolverStyle.LENIENT, null, 2012, -2013, null, null},
+        };
+    }
+
+    @Test(dataProvider = "resolve_yearOfEra")
+    public void test_resolve_yearOfEra(ResolverStyle style, Integer e, Integer yoe, Integer y, ChronoField field, Integer expected) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        if (e != null) {
+            fieldValues.put(ChronoField.ERA, (long) e);
+        }
+        if (yoe != null) {
+            fieldValues.put(ChronoField.YEAR_OF_ERA, (long) yoe);
+        }
+        if (y != null) {
+            fieldValues.put(ChronoField.YEAR, (long) y);
+        }
+        if (field != null) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, style);
+            assertEquals(date, null);
+            assertEquals(fieldValues.get(field), (Long) expected.longValue());
+            assertEquals(fieldValues.size(), 1);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, style);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_ymd")
+    Object[][] data_resolve_ymd() {
+        return new Object[][] {
+                {YDIFF + 2012, 1, -365, date(YDIFF + 2010, 12, 31), false, false},
+                {YDIFF + 2012, 1, -364, date(YDIFF + 2011, 1, 1), false, false},
+                {YDIFF + 2012, 1, -31, date(YDIFF + 2011, 11, 30), false, false},
+                {YDIFF + 2012, 1, -30, date(YDIFF + 2011, 12, 1), false, false},
+                {YDIFF + 2012, 1, -12, date(YDIFF + 2011, 12, 19), false, false},
+                {YDIFF + 2012, 1, 1, date(YDIFF + 2012, 1, 1), true, true},
+                {YDIFF + 2012, 1, 27, date(YDIFF + 2012, 1, 27), true, true},
+                {YDIFF + 2012, 1, 28, date(YDIFF + 2012, 1, 28), true, true},
+                {YDIFF + 2012, 1, 29, date(YDIFF + 2012, 1, 29), true, true},
+                {YDIFF + 2012, 1, 30, date(YDIFF + 2012, 1, 30), true, true},
+                {YDIFF + 2012, 1, 31, date(YDIFF + 2012, 1, 31), true, true},
+                {YDIFF + 2012, 1, 59, date(YDIFF + 2012, 2, 28), false, false},
+                {YDIFF + 2012, 1, 60, date(YDIFF + 2012, 2, 29), false, false},
+                {YDIFF + 2012, 1, 61, date(YDIFF + 2012, 3, 1), false, false},
+                {YDIFF + 2012, 1, 365, date(YDIFF + 2012, 12, 30), false, false},
+                {YDIFF + 2012, 1, 366, date(YDIFF + 2012, 12, 31), false, false},
+                {YDIFF + 2012, 1, 367, date(YDIFF + 2013, 1, 1), false, false},
+                {YDIFF + 2012, 1, 367 + 364, date(YDIFF + 2013, 12, 31), false, false},
+                {YDIFF + 2012, 1, 367 + 365, date(YDIFF + 2014, 1, 1), false, false},
+
+                {YDIFF + 2012, 2, 1, date(YDIFF + 2012, 2, 1), true, true},
+                {YDIFF + 2012, 2, 28, date(YDIFF + 2012, 2, 28), true, true},
+                {YDIFF + 2012, 2, 29, date(YDIFF + 2012, 2, 29), true, true},
+                {YDIFF + 2012, 2, 30, date(YDIFF + 2012, 3, 1), date(YDIFF + 2012, 2, 29), false},
+                {YDIFF + 2012, 2, 31, date(YDIFF + 2012, 3, 2), date(YDIFF + 2012, 2, 29), false},
+                {YDIFF + 2012, 2, 32, date(YDIFF + 2012, 3, 3), false, false},
+
+                {YDIFF + 2012, -12, 1, date(YDIFF + 2010, 12, 1), false, false},
+                {YDIFF + 2012, -11, 1, date(YDIFF + 2011, 1, 1), false, false},
+                {YDIFF + 2012, -1, 1, date(YDIFF + 2011, 11, 1), false, false},
+                {YDIFF + 2012, 0, 1, date(YDIFF + 2011, 12, 1), false, false},
+                {YDIFF + 2012, 1, 1, date(YDIFF + 2012, 1, 1), true, true},
+                {YDIFF + 2012, 12, 1, date(YDIFF + 2012, 12, 1), true, true},
+                {YDIFF + 2012, 13, 1, date(YDIFF + 2013, 1, 1), false, false},
+                {YDIFF + 2012, 24, 1, date(YDIFF + 2013, 12, 1), false, false},
+                {YDIFF + 2012, 25, 1, date(YDIFF + 2014, 1, 1), false, false},
+
+                {YDIFF + 2012, 6, -31, date(YDIFF + 2012, 4, 30), false, false},
+                {YDIFF + 2012, 6, -30, date(YDIFF + 2012, 5, 1), false, false},
+                {YDIFF + 2012, 6, -1, date(YDIFF + 2012, 5, 30), false, false},
+                {YDIFF + 2012, 6, 0, date(YDIFF + 2012, 5, 31), false, false},
+                {YDIFF + 2012, 6, 1, date(YDIFF + 2012, 6, 1), true, true},
+                {YDIFF + 2012, 6, 30, date(YDIFF + 2012, 6, 30), true, true},
+                {YDIFF + 2012, 6, 31, date(YDIFF + 2012, 7, 1), date(YDIFF + 2012, 6, 30), false},
+                {YDIFF + 2012, 6, 61, date(YDIFF + 2012, 7, 31), false, false},
+                {YDIFF + 2012, 6, 62, date(YDIFF + 2012, 8, 1), false, false},
+
+                {YDIFF + 2011, 2, 1, date(YDIFF + 2011, 2, 1), true, true},
+                {YDIFF + 2011, 2, 28, date(YDIFF + 2011, 2, 28), true, true},
+                {YDIFF + 2011, 2, 29, date(YDIFF + 2011, 3, 1), date(YDIFF + 2011, 2, 28), false},
+                {YDIFF + 2011, 2, 30, date(YDIFF + 2011, 3, 2), date(YDIFF + 2011, 2, 28), false},
+                {YDIFF + 2011, 2, 31, date(YDIFF + 2011, 3, 3), date(YDIFF + 2011, 2, 28), false},
+                {YDIFF + 2011, 2, 32, date(YDIFF + 2011, 3, 4), false, false},
+        };
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_lenient(int y, int m, int d, ThaiBuddhistDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_smart(int y, int m, int d, ThaiBuddhistDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (Boolean.TRUE.equals(smart)) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else if (smart instanceof ThaiBuddhistDate) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, smart);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymd")
+    public void test_resolve_ymd_strict(int y, int m, int d, ThaiBuddhistDate expected, Object smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.DAY_OF_MONTH, (long) d);
+        if (strict) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_yd")
+    Object[][] data_resolve_yd() {
+        return new Object[][] {
+                {YDIFF + 2012, -365, date(YDIFF + 2010, 12, 31), false, false},
+                {YDIFF + 2012, -364, date(YDIFF + 2011, 1, 1), false, false},
+                {YDIFF + 2012, -31, date(YDIFF + 2011, 11, 30), false, false},
+                {YDIFF + 2012, -30, date(YDIFF + 2011, 12, 1), false, false},
+                {YDIFF + 2012, -12, date(YDIFF + 2011, 12, 19), false, false},
+                {YDIFF + 2012, -1, date(YDIFF + 2011, 12, 30), false, false},
+                {YDIFF + 2012, 0, date(YDIFF + 2011, 12, 31), false, false},
+                {YDIFF + 2012, 1, date(YDIFF + 2012, 1, 1), true, true},
+                {YDIFF + 2012, 2, date(YDIFF + 2012, 1, 2), true, true},
+                {YDIFF + 2012, 31, date(YDIFF + 2012, 1, 31), true, true},
+                {YDIFF + 2012, 32, date(YDIFF + 2012, 2, 1), true, true},
+                {YDIFF + 2012, 59, date(YDIFF + 2012, 2, 28), true, true},
+                {YDIFF + 2012, 60, date(YDIFF + 2012, 2, 29), true, true},
+                {YDIFF + 2012, 61, date(YDIFF + 2012, 3, 1), true, true},
+                {YDIFF + 2012, 365, date(YDIFF + 2012, 12, 30), true, true},
+                {YDIFF + 2012, 366, date(YDIFF + 2012, 12, 31), true, true},
+                {YDIFF + 2012, 367, date(YDIFF + 2013, 1, 1), false, false},
+                {YDIFF + 2012, 367 + 364, date(YDIFF + 2013, 12, 31), false, false},
+                {YDIFF + 2012, 367 + 365, date(YDIFF + 2014, 1, 1), false, false},
+
+                {YDIFF + 2011, 59, date(YDIFF + 2011, 2, 28), true, true},
+                {YDIFF + 2011, 60, date(YDIFF + 2011, 3, 1), true, true},
+        };
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_lenient(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_smart(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (smart) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_yd")
+    public void test_resolve_yd_strict(int y, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.DAY_OF_YEAR, (long) d);
+        if (strict) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    @DataProvider(name = "resolve_ymaa")
+    Object[][] data_resolve_ymaa() {
+        return new Object[][] {
+                {YDIFF + 2012, 1, 1, -365, date(YDIFF + 2010, 12, 31), false, false},
+                {YDIFF + 2012, 1, 1, -364, date(YDIFF + 2011, 1, 1), false, false},
+                {YDIFF + 2012, 1, 1, -31, date(YDIFF + 2011, 11, 30), false, false},
+                {YDIFF + 2012, 1, 1, -30, date(YDIFF + 2011, 12, 1), false, false},
+                {YDIFF + 2012, 1, 1, -12, date(YDIFF + 2011, 12, 19), false, false},
+                {YDIFF + 2012, 1, 1, 1, date(YDIFF + 2012, 1, 1), true, true},
+                {YDIFF + 2012, 1, 1, 59, date(YDIFF + 2012, 2, 28), false, false},
+                {YDIFF + 2012, 1, 1, 60, date(YDIFF + 2012, 2, 29), false, false},
+                {YDIFF + 2012, 1, 1, 61, date(YDIFF + 2012, 3, 1), false, false},
+                {YDIFF + 2012, 1, 1, 365, date(YDIFF + 2012, 12, 30), false, false},
+                {YDIFF + 2012, 1, 1, 366, date(YDIFF + 2012, 12, 31), false, false},
+                {YDIFF + 2012, 1, 1, 367, date(YDIFF + 2013, 1, 1), false, false},
+                {YDIFF + 2012, 1, 1, 367 + 364, date(YDIFF + 2013, 12, 31), false, false},
+                {YDIFF + 2012, 1, 1, 367 + 365, date(YDIFF + 2014, 1, 1), false, false},
+
+                {YDIFF + 2012, 2, 0, 1, date(YDIFF + 2012, 1, 25), false, false},
+                {YDIFF + 2012, 2, 0, 7, date(YDIFF + 2012, 1, 31), false, false},
+                {YDIFF + 2012, 2, 1, 1, date(YDIFF + 2012, 2, 1), true, true},
+                {YDIFF + 2012, 2, 1, 7, date(YDIFF + 2012, 2, 7), true, true},
+                {YDIFF + 2012, 2, 2, 1, date(YDIFF + 2012, 2, 8), true, true},
+                {YDIFF + 2012, 2, 2, 7, date(YDIFF + 2012, 2, 14), true, true},
+                {YDIFF + 2012, 2, 3, 1, date(YDIFF + 2012, 2, 15), true, true},
+                {YDIFF + 2012, 2, 3, 7, date(YDIFF + 2012, 2, 21), true, true},
+                {YDIFF + 2012, 2, 4, 1, date(YDIFF + 2012, 2, 22), true, true},
+                {YDIFF + 2012, 2, 4, 7, date(YDIFF + 2012, 2, 28), true, true},
+                {YDIFF + 2012, 2, 5, 1, date(YDIFF + 2012, 2, 29), true, true},
+                {YDIFF + 2012, 2, 5, 2, date(YDIFF + 2012, 3, 1), true, false},
+                {YDIFF + 2012, 2, 5, 7, date(YDIFF + 2012, 3, 6), true, false},
+                {YDIFF + 2012, 2, 6, 1, date(YDIFF + 2012, 3, 7), false, false},
+                {YDIFF + 2012, 2, 6, 7, date(YDIFF + 2012, 3, 13), false, false},
+
+                {YDIFF + 2012, 12, 1, 1, date(YDIFF + 2012, 12, 1), true, true},
+                {YDIFF + 2012, 12, 5, 1, date(YDIFF + 2012, 12, 29), true, true},
+                {YDIFF + 2012, 12, 5, 2, date(YDIFF + 2012, 12, 30), true, true},
+                {YDIFF + 2012, 12, 5, 3, date(YDIFF + 2012, 12, 31), true, true},
+                {YDIFF + 2012, 12, 5, 4, date(YDIFF + 2013, 1, 1), true, false},
+                {YDIFF + 2012, 12, 5, 7, date(YDIFF + 2013, 1, 4), true, false},
+
+                {YDIFF + 2012, -12, 1, 1, date(YDIFF + 2010, 12, 1), false, false},
+                {YDIFF + 2012, -11, 1, 1, date(YDIFF + 2011, 1, 1), false, false},
+                {YDIFF + 2012, -1, 1, 1, date(YDIFF + 2011, 11, 1), false, false},
+                {YDIFF + 2012, 0, 1, 1, date(YDIFF + 2011, 12, 1), false, false},
+                {YDIFF + 2012, 1, 1, 1, date(YDIFF + 2012, 1, 1), true, true},
+                {YDIFF + 2012, 12, 1, 1, date(YDIFF + 2012, 12, 1), true, true},
+                {YDIFF + 2012, 13, 1, 1, date(YDIFF + 2013, 1, 1), false, false},
+                {YDIFF + 2012, 24, 1, 1, date(YDIFF + 2013, 12, 1), false, false},
+                {YDIFF + 2012, 25, 1, 1, date(YDIFF + 2014, 1, 1), false, false},
+
+                {YDIFF + 2011, 2, 1, 1, date(YDIFF + 2011, 2, 1), true, true},
+                {YDIFF + 2011, 2, 4, 7, date(YDIFF + 2011, 2, 28), true, true},
+                {YDIFF + 2011, 2, 5, 1, date(YDIFF + 2011, 3, 1), true, false},
+        };
+    }
+
+    @Test(dataProvider = "resolve_ymaa")
+    public void test_resolve_ymaa_lenient(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
+        fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
+        ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.LENIENT);
+        assertEquals(date, expected);
+        assertEquals(fieldValues.size(), 0);
+    }
+
+    @Test(dataProvider = "resolve_ymaa")
+    public void test_resolve_ymaa_smart(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
+        fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
+        if (smart) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.SMART);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    @Test(dataProvider = "resolve_ymaa")
+    public void test_resolve_ymaa_strict(int y, int m, int w, int d, ThaiBuddhistDate expected, boolean smart, boolean strict) {
+        Map<TemporalField, Long> fieldValues = new HashMap<>();
+        fieldValues.put(ChronoField.YEAR, (long) y);
+        fieldValues.put(ChronoField.MONTH_OF_YEAR, (long) m);
+        fieldValues.put(ChronoField.ALIGNED_WEEK_OF_MONTH, (long) w);
+        fieldValues.put(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH, (long) d);
+        if (strict) {
+            ThaiBuddhistDate date = ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+            assertEquals(date, expected);
+            assertEquals(fieldValues.size(), 0);
+        } else {
+            try {
+                ThaiBuddhistChronology.INSTANCE.resolveDate(fieldValues, ResolverStyle.STRICT);
+                fail("Should have failed");
+            } catch (DateTimeException ex) {
+                // expected
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    private static ThaiBuddhistDate date(int y, int m, int d) {
+        return ThaiBuddhistDate.of(y, m, d);
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKFormatStyle.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.format;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.FormatStyle;
+import java.time.temporal.Temporal;
+import java.util.Locale;
+
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test.
+ */
+@Test
+public class TCKFormatStyle {
+
+    private static final ZoneId ZONEID_PARIS = ZoneId.of("Europe/Paris");
+    private static final ZoneId OFFSET_PTWO = ZoneOffset.of("+02:00");
+
+    //-----------------------------------------------------------------------
+    // valueOf()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_valueOf() {
+        for (FormatStyle style : FormatStyle.values()) {
+            assertEquals(FormatStyle.valueOf(style.name()), style);
+        }
+    }
+
+    @DataProvider(name="formatStyle")
+    Object[][] data_formatStyle() {
+        return new Object[][] {
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), ZONEID_PARIS), FormatStyle.FULL, "Tuesday, October 2, 2001 1:02:03 AM CEST Europe/Paris"},
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), ZONEID_PARIS), FormatStyle.LONG, "October 2, 2001 1:02:03 AM CEST Europe/Paris"},
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), ZONEID_PARIS), FormatStyle.MEDIUM, "Oct 2, 2001 1:02:03 AM Europe/Paris"},
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), ZONEID_PARIS), FormatStyle.SHORT, "10/2/01 1:02 AM Europe/Paris"},
+
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), OFFSET_PTWO), FormatStyle.FULL, "Tuesday, October 2, 2001 1:02:03 AM +02:00 +02:00"},
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), OFFSET_PTWO), FormatStyle.LONG, "October 2, 2001 1:02:03 AM +02:00 +02:00"},
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), OFFSET_PTWO), FormatStyle.MEDIUM, "Oct 2, 2001 1:02:03 AM +02:00"},
+                {ZonedDateTime.of(LocalDateTime.of(2001, 10, 2, 1, 2, 3), OFFSET_PTWO), FormatStyle.SHORT, "10/2/01 1:02 AM +02:00"},
+        };
+    }
+
+    @Test(dataProvider = "formatStyle")
+    public void test_formatStyle(Temporal temporal, FormatStyle style, String formattedStr) {
+        DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
+        DateTimeFormatter formatter = builder.appendLocalized(style, style).appendLiteral(" ").appendZoneOrOffsetId().toFormatter();
+        formatter = formatter.withLocale(Locale.US);
+        assertEquals(formatter.format(temporal), formattedStr);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKResolverStyle.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.format;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import java.time.DateTimeException;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.ResolverStyle;
+import java.time.temporal.ChronoField;
+import java.time.temporal.TemporalAccessor;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test.
+ */
+@Test
+public class TCKResolverStyle {
+
+    //-----------------------------------------------------------------------
+    // valueOf()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_valueOf() {
+        for (ResolverStyle style : ResolverStyle.values()) {
+            assertEquals(ResolverStyle.valueOf(style.name()), style);
+        }
+    }
+
+    @DataProvider(name="resolverStyle")
+    Object[][] data_resolverStyle() {
+        return new Object[][] {
+                {"2000/15/30", ResolverStyle.LENIENT, null, 2001, 3, 30},
+                {"2000/02/30", ResolverStyle.SMART, null, 2000, 2, 29},
+                {"2000/02/29", ResolverStyle.STRICT, null, 2000, 2, 29},
+
+                {"2000/15/30 CE", ResolverStyle.LENIENT, null, 2001, 3, 30},
+                {"2000/02/30 CE", ResolverStyle.SMART, null, 2000, 2, 29},
+                {"5/02/29 BCE", ResolverStyle.STRICT, null, 5, 2, 29},
+
+                {"4/02/29 BCE", ResolverStyle.STRICT, DateTimeException.class, -1, -1, -1},
+                {"2000/02/30 CE", ResolverStyle.STRICT, DateTimeException.class, -1, -1, -1},
+
+        };
+    }
+
+    @Test(dataProvider = "resolverStyle")
+    public void test_resolverStyle(String str, ResolverStyle style, Class<?> expectedEx, int year, int month, int day) {
+        DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
+        builder.appendValue(ChronoField.YEAR_OF_ERA);
+        builder.appendLiteral("/");
+        builder.appendValue(ChronoField.MONTH_OF_YEAR);
+        builder.appendLiteral("/");
+        builder.appendValue(ChronoField.DAY_OF_MONTH);
+
+        Map<Long, String> eraMap = new HashMap<Long, String>();
+        eraMap.put(1L, "CE");
+        eraMap.put(0L, "BCE");
+        DateTimeFormatter optionalFormatter = new DateTimeFormatterBuilder().appendLiteral(" ").appendText(ChronoField.ERA, eraMap).toFormatter();
+
+        DateTimeFormatter formatter = builder.appendOptional(optionalFormatter).toFormatter();
+        formatter = formatter.withResolverStyle(style);
+        if (expectedEx == null) {
+            TemporalAccessor accessor = formatter.parse(str);
+            assertEquals(accessor.get(ChronoField.YEAR_OF_ERA), year);
+            assertEquals(accessor.get(ChronoField.MONTH_OF_YEAR), month);
+            assertEquals(accessor.get(ChronoField.DAY_OF_MONTH), day);
+        } else {
+            try {
+                formatter.parse(str);
+                fail();
+            } catch (Exception ex) {
+                assertTrue(expectedEx.isInstance(ex));
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/format/TCKSignStyle.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.format;
+
+import java.time.DateTimeException;
+import java.time.LocalDate;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeFormatterBuilder;
+import java.time.format.SignStyle;
+import java.time.temporal.ChronoField;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test.
+ */
+@Test
+public class TCKSignStyle {
+
+    //-----------------------------------------------------------------------
+    // valueOf()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_valueOf() {
+        for (SignStyle style : SignStyle.values()) {
+            assertEquals(SignStyle.valueOf(style.name()), style);
+        }
+    }
+
+    @DataProvider(name="signStyle")
+    Object[][] data_signStyle() {
+        return new Object[][] {
+                {LocalDate.of(0, 10, 2), SignStyle.ALWAYS, null, "+00"},
+                {LocalDate.of(2001, 10, 2), SignStyle.ALWAYS, null, "+2001"},
+                {LocalDate.of(-2001, 10, 2), SignStyle.ALWAYS, null, "-2001"},
+
+                {LocalDate.of(2001, 10, 2), SignStyle.NORMAL, null, "2001"},
+                {LocalDate.of(-2001, 10, 2), SignStyle.NORMAL, null, "-2001"},
+
+                {LocalDate.of(2001, 10, 2), SignStyle.NEVER, null, "2001"},
+                {LocalDate.of(-2001, 10, 2), SignStyle.NEVER, null, "2001"},
+
+                {LocalDate.of(2001, 10, 2), SignStyle.NOT_NEGATIVE, null, "2001"},
+                {LocalDate.of(-2001, 10, 2), SignStyle.NOT_NEGATIVE, DateTimeException.class, ""},
+
+                {LocalDate.of(0, 10, 2), SignStyle.EXCEEDS_PAD, null, "00"},
+                {LocalDate.of(1, 10, 2), SignStyle.EXCEEDS_PAD, null, "01"},
+                {LocalDate.of(-1, 10, 2), SignStyle.EXCEEDS_PAD, null, "-01"},
+
+                {LocalDate.of(20001, 10, 2), SignStyle.ALWAYS, DateTimeException.class, ""},
+                {LocalDate.of(20001, 10, 2), SignStyle.NORMAL, DateTimeException.class, ""},
+                {LocalDate.of(20001, 10, 2), SignStyle.NEVER, DateTimeException.class, ""},
+                {LocalDate.of(20001, 10, 2), SignStyle.EXCEEDS_PAD, DateTimeException.class, ""},
+                {LocalDate.of(20001, 10, 2), SignStyle.NOT_NEGATIVE, DateTimeException.class, ""},
+        };
+    }
+
+    @Test(dataProvider = "signStyle")
+    public void test_signStyle(LocalDate localDate, SignStyle style, Class<?> expectedEx, String expectedStr) {
+        DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
+        DateTimeFormatter formatter = builder.appendValue(ChronoField.YEAR, 2, 4, style)
+                                             .toFormatter();
+        formatter = formatter.withZone(ZoneOffset.UTC);
+        if (expectedEx == null) {
+            String output = formatter.format(localDate);
+            assertEquals(output, expectedStr);
+        } else {
+            try {
+                formatter.format(localDate);
+                fail();
+            } catch (Exception ex) {
+                assertTrue(expectedEx.isInstance(ex));
+            }
+        }
+    }
+
+}
--- a/jdk/test/java/time/tck/java/time/format/TCKTextStyle.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/format/TCKTextStyle.java	Tue Aug 06 16:54:56 2013 -0700
@@ -91,4 +91,14 @@
         assertTrue(!TextStyle.NARROW.isStandalone());
     }
 
+    //-----------------------------------------------------------------------
+    // valueOf()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_valueOf() {
+        for (TextStyle style : TextStyle.values()) {
+            assertEquals(TextStyle.valueOf(style.name()), style);
+        }
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java	Tue Aug 06 16:54:56 2013 -0700
@@ -60,16 +60,20 @@
 package tck.java.time.format;
 
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
 
 import java.text.ParsePosition;
+import java.time.DateTimeException;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
 import java.time.format.DateTimeFormatterBuilder;
 import java.time.temporal.TemporalAccessor;
 import java.time.temporal.TemporalQuery;
 import java.util.Locale;
+import java.util.Objects;
 
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.DataProvider;
@@ -148,43 +152,44 @@
     @DataProvider(name="parseSuccess")
     Object[][] data_parseSuccess() {
         return new Object[][] {
-                {"Z", 1, -1, ZoneOffset.UTC},
-                {"UTC", 3, -1, ZoneOffset.UTC},
-                {"UT", 2, -1, ZoneOffset.UTC},
-                {"GMT", 3, -1, ZoneOffset.UTC},
-                {"UTC0", 4, -1, ZoneOffset.UTC},
-                {"UT0", 3, -1, ZoneOffset.UTC},
-                {"GMT0", 4, -1, ZoneOffset.UTC},
+                {"Z", 1, -1, ZoneId.of("Z")},
+                {"UTC", 3, -1, ZoneId.of("UTC")},
+                {"UT", 2, -1, ZoneId.of("UT")},
+                {"GMT", 3, -1, ZoneId.of("GMT")},
 
                 {"+00:00", 6, -1, ZoneOffset.UTC},
-                {"UTC+00:00", 9, -1, ZoneOffset.UTC},
-                {"UT+00:00", 8, -1, ZoneOffset.UTC},
-                {"GMT+00:00", 9, -1, ZoneOffset.UTC},
+                {"UTC+00:00", 9, -1, ZoneId.of("UTC")},
+                {"UT+00:00", 8, -1, ZoneId.of("UT")},
+                {"GMT+00:00", 9, -1, ZoneId.of("GMT")},
                 {"-00:00", 6, -1, ZoneOffset.UTC},
-                {"UTC-00:00", 9, -1, ZoneOffset.UTC},
-                {"UT-00:00", 8, -1, ZoneOffset.UTC},
-                {"GMT-00:00", 9, -1, ZoneOffset.UTC},
+                {"UTC-00:00", 9, -1, ZoneId.of("UTC")},
+                {"UT-00:00", 8, -1, ZoneId.of("UT")},
+                {"GMT-00:00", 9, -1, ZoneId.of("GMT")},
 
                 {"+01:30", 6, -1, ZoneOffset.ofHoursMinutes(1, 30)},
-                {"UTC+01:30", 9, -1, ZoneOffset.ofHoursMinutes(1, 30)},
-                {"UT+02:30", 8, -1, ZoneOffset.ofHoursMinutes(2, 30)},
-                {"GMT+03:30", 9, -1, ZoneOffset.ofHoursMinutes(3, 30)},
+                {"UTC+01:30", 9, -1, ZoneId.of("UTC+01:30")},
+                {"UT+02:30", 8, -1, ZoneId.of("UT+02:30")},
+                {"GMT+03:30", 9, -1, ZoneId.of("GMT+03:30")},
                 {"-01:30", 6, -1, ZoneOffset.ofHoursMinutes(-1, -30)},
-                {"UTC-01:30", 9, -1, ZoneOffset.ofHoursMinutes(-1, -30)},
-                {"UT-02:30", 8, -1, ZoneOffset.ofHoursMinutes(-2, -30)},
-                {"GMT-03:30", 9, -1, ZoneOffset.ofHoursMinutes(-3, -30)},
+                {"UTC-01:30", 9, -1, ZoneId.of("UTC-01:30")},
+                {"UT-02:30", 8, -1, ZoneId.of("UT-02:30")},
+                {"GMT-03:30", 9, -1, ZoneId.of("GMT-03:30")},
 
                 // fallback to UTC
-                {"UTC-01:WW", 3, -1, ZoneOffset.UTC},
-                {"UT-02:WW", 2, -1, ZoneOffset.UTC},
-                {"GMT-03:WW", 3, -1, ZoneOffset.UTC},
+                {"UTC-01:WW", 3, -1, ZoneId.of("UTC")},
+                {"UT-02:WW", 2, -1, ZoneId.of("UT")},
+                {"GMT-03:WW", 3, -1, ZoneId.of("GMT")},
                 {"Z0", 1, -1, ZoneOffset.UTC},
-                {"UTC1", 3, -1, ZoneOffset.UTC},
+                {"UTC1", 3, -1, ZoneId.of("UTC")},
 
                 // Z not parsed as zero
-                {"UTCZ", 3, -1, ZoneOffset.UTC},
-                {"UTZ", 2, -1, ZoneOffset.UTC},
-                {"GMTZ", 3, -1, ZoneOffset.UTC},
+                {"UTCZ", 3, -1, ZoneId.of("UTC")},
+                {"UTZ", 2, -1, ZoneId.of("UT")},
+                {"GMTZ", 3, -1, ZoneId.of("GMT")},
+
+                // 0 not parsed
+                {"UTC0", 3, -1, ZoneId.of("UTC")},
+                {"UT0", 2, -1, ZoneId.of("UT")},
 
                 // fail to parse
                 {"", 0, 0, null},
@@ -206,12 +211,12 @@
     public void test_parseSuccess_plain(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
         builder.appendZoneId();
         TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex);
-        assertEquals(pos.getIndex(), expectedIndex);
+        assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text);
+        assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text);
         if (expected != null) {
-            assertEquals(parsed.query(TemporalQuery.zoneId()), expected);
-            assertEquals(parsed.query(TemporalQuery.offset()), null);
-            assertEquals(parsed.query(TemporalQuery.zone()), expected);
+            assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + text);
+            assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + text);
+            assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + text);
         } else {
             assertEquals(parsed, null);
         }
@@ -221,13 +226,14 @@
     public void test_parseSuccess_prefix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
         builder.appendZoneId();
         pos.setIndex(3);
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved("XXX" + text, pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0  ? expectedErrorIndex + 3 : expectedErrorIndex);
-        assertEquals(pos.getIndex(), expectedIndex + 3);
+        String prefixText = "XXX" + text;
+        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(prefixText, pos);
+        assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0  ? expectedErrorIndex + 3 : expectedErrorIndex, "Incorrect error index parsing: " + prefixText);
+        assertEquals(pos.getIndex(), expectedIndex + 3, "Incorrect index parsing: " + prefixText);
         if (expected != null) {
-            assertEquals(parsed.query(TemporalQuery.zoneId()), expected);
-            assertEquals(parsed.query(TemporalQuery.offset()), null);
-            assertEquals(parsed.query(TemporalQuery.zone()), expected);
+            assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText);
+            assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + prefixText);
+            assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + prefixText);
         } else {
             assertEquals(parsed, null);
         }
@@ -236,13 +242,14 @@
     @Test(dataProvider="parseSuccess")
     public void test_parseSuccess_suffix(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
         builder.appendZoneId();
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text + "XXX", pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex);
-        assertEquals(pos.getIndex(), expectedIndex);
+        String suffixText = text + "XXX";
+        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(suffixText, pos);
+        assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + suffixText);
+        assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + suffixText);
         if (expected != null) {
-            assertEquals(parsed.query(TemporalQuery.zoneId()), expected);
-            assertEquals(parsed.query(TemporalQuery.offset()), null);
-            assertEquals(parsed.query(TemporalQuery.zone()), expected);
+            assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText);
+            assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + suffixText);
+            assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + suffixText);
         } else {
             assertEquals(parsed, null);
         }
@@ -251,15 +258,16 @@
     @Test(dataProvider="parseSuccess")
     public void test_parseSuccess_caseSensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
         builder.parseCaseSensitive().appendZoneId();
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text.toLowerCase(Locale.ENGLISH), pos);
+        String lcText = text.toLowerCase(Locale.ENGLISH);
+        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
         if (text.matches("[^A-Z]*[A-Z].*")) {  // if input has letters
             assertEquals(pos.getErrorIndex() >= 0, true);
             assertEquals(pos.getIndex(), 0);
             assertEquals(parsed, null);
         } else {
             // case sensitive made no difference
-            assertEquals(pos.getIndex(), expectedIndex);
-            assertEquals(pos.getErrorIndex(), expectedErrorIndex);
+            assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
+            assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
             if (expected != null) {
                 assertEquals(parsed.query(TemporalQuery.zoneId()), expected);
                 assertEquals(parsed.query(TemporalQuery.offset()), null);
@@ -273,13 +281,15 @@
     @Test(dataProvider="parseSuccess")
     public void test_parseSuccess_caseInsensitive(String text, int expectedIndex, int expectedErrorIndex, ZoneId expected) {
         builder.parseCaseInsensitive().appendZoneId();
-        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text.toLowerCase(Locale.ENGLISH), pos);
-        assertEquals(pos.getErrorIndex(), expectedErrorIndex);
-        assertEquals(pos.getIndex(), expectedIndex);
+        String lcText = text.toLowerCase(Locale.ENGLISH);
+        TemporalAccessor parsed = builder.toFormatter().parseUnresolved(lcText, pos);
+        assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText);
+        assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText);
         if (expected != null) {
-            assertEquals(parsed.query(TemporalQuery.zoneId()), expected);
-            assertEquals(parsed.query(TemporalQuery.offset()), null);
-            assertEquals(parsed.query(TemporalQuery.zone()), expected);
+            ZoneId zid = parsed.query(TemporalQuery.zoneId());
+            assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + lcText);
+            assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + lcText);
+            assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + lcText);
         } else {
             assertEquals(parsed, null);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKChronoField.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal;
+
+import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH;
+import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR;
+import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH;
+import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
+import static java.time.temporal.ChronoField.AMPM_OF_DAY;
+import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_DAY;
+import static java.time.temporal.ChronoField.CLOCK_HOUR_OF_AMPM;
+import static java.time.temporal.ChronoField.DAY_OF_MONTH;
+import static java.time.temporal.ChronoField.DAY_OF_WEEK;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
+import static java.time.temporal.ChronoField.EPOCH_DAY;
+import static java.time.temporal.ChronoField.HOUR_OF_DAY;
+import static java.time.temporal.ChronoField.HOUR_OF_AMPM;
+import static java.time.temporal.ChronoField.MICRO_OF_DAY;
+import static java.time.temporal.ChronoField.MICRO_OF_SECOND;
+import static java.time.temporal.ChronoField.MILLI_OF_DAY;
+import static java.time.temporal.ChronoField.MILLI_OF_SECOND;
+import static java.time.temporal.ChronoField.MINUTE_OF_DAY;
+import static java.time.temporal.ChronoField.MINUTE_OF_HOUR;
+import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
+import static java.time.temporal.ChronoField.NANO_OF_DAY;
+import static java.time.temporal.ChronoField.NANO_OF_SECOND;
+import static java.time.temporal.ChronoField.PROLEPTIC_MONTH;
+import static java.time.temporal.ChronoField.SECOND_OF_DAY;
+import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
+import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.YEAR_OF_ERA;
+import static java.time.temporal.ChronoField.ERA;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.FOREVER;
+import static java.time.temporal.ChronoUnit.HOURS;
+import static java.time.temporal.ChronoUnit.MICROS;
+import static java.time.temporal.ChronoUnit.MILLIS;
+import static java.time.temporal.ChronoUnit.MINUTES;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.NANOS;
+import static java.time.temporal.ChronoUnit.SECONDS;
+import static java.time.temporal.ChronoUnit.WEEKS;
+import static java.time.temporal.ChronoUnit.YEARS;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.temporal.ChronoField;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalAccessor;
+import java.time.temporal.ValueRange;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test.
+ */
+@Test
+public class TCKChronoField {
+
+    //-----------------------------------------------------------------------
+    // getBaseUnit() and getRangeUnit()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="fieldUnit")
+    Object[][] data_fieldUnit() {
+        return new Object[][] {
+                {YEAR, YEARS, FOREVER},
+                {MONTH_OF_YEAR, MONTHS, YEARS},
+                {DAY_OF_MONTH, DAYS, MONTHS},
+                {DAY_OF_WEEK, DAYS, WEEKS},
+                {DAY_OF_YEAR, DAYS, YEARS},
+                {HOUR_OF_DAY, HOURS, DAYS},
+                {MINUTE_OF_DAY, MINUTES, DAYS},
+                {MINUTE_OF_HOUR, MINUTES, HOURS},
+                {SECOND_OF_DAY, SECONDS, DAYS},
+                {SECOND_OF_MINUTE, SECONDS, MINUTES},
+                {MILLI_OF_DAY, MILLIS, DAYS},
+                {MILLI_OF_SECOND, MILLIS, SECONDS},
+                {MICRO_OF_SECOND, MICROS, SECONDS},
+                {MICRO_OF_DAY, MICROS, DAYS},
+                {NANO_OF_SECOND, NANOS, SECONDS},
+                {NANO_OF_DAY, NANOS, DAYS},
+
+        };
+    }
+
+    @Test(dataProvider = "fieldUnit")
+    public void test_getBaseUnit(ChronoField field, ChronoUnit baseUnit, ChronoUnit rangeUnit) {
+        assertEquals(field.getBaseUnit(), baseUnit);
+        assertEquals(field.getRangeUnit(), rangeUnit);
+    }
+
+    //-----------------------------------------------------------------------
+    // isDateBased() and isTimeBased()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="fieldBased")
+    Object[][] data_fieldBased() {
+        return new Object[][] {
+                {DAY_OF_WEEK, true, false},
+                {ALIGNED_DAY_OF_WEEK_IN_MONTH, true, false},
+                {ALIGNED_DAY_OF_WEEK_IN_YEAR, true, false},
+                {DAY_OF_MONTH, true, false},
+                {DAY_OF_YEAR, true, false},
+                {EPOCH_DAY, true, false},
+                {ALIGNED_WEEK_OF_MONTH, true, false},
+                {ALIGNED_WEEK_OF_YEAR, true, false},
+                {MONTH_OF_YEAR, true, false},
+                {PROLEPTIC_MONTH, true, false},
+                {YEAR_OF_ERA, true, false},
+                {YEAR, true, false},
+                {ERA, true, false},
+
+                {AMPM_OF_DAY, false, true},
+                {CLOCK_HOUR_OF_DAY, false, true},
+                {HOUR_OF_DAY, false, true},
+                {CLOCK_HOUR_OF_AMPM, false, true},
+                {HOUR_OF_AMPM, false, true},
+                {MINUTE_OF_DAY, false, true},
+                {MINUTE_OF_HOUR, false, true},
+                {SECOND_OF_DAY, false, true},
+                {SECOND_OF_MINUTE, false, true},
+                {MILLI_OF_DAY, false, true},
+                {MILLI_OF_SECOND, false, true},
+                {MICRO_OF_DAY, false, true},
+                {MICRO_OF_SECOND, false, true},
+                {NANO_OF_DAY, false, true},
+                {NANO_OF_SECOND, false, true},
+        };
+    }
+
+    @Test(dataProvider = "fieldBased")
+    public void test_isDateBased(ChronoField field, boolean isDateBased, boolean isTimeBased) {
+        assertEquals(field.isDateBased(), isDateBased);
+        assertEquals(field.isTimeBased(), isTimeBased);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupportedBy(TemporalAccessor temporal) and getFrom(TemporalAccessor temporal)
+    //-----------------------------------------------------------------------
+    @DataProvider(name="fieldAndAccessor")
+    Object[][] data_fieldAndAccessor() {
+        return new Object[][] {
+                {YEAR, LocalDate.of(2000, 2, 29), true, 2000},
+                {YEAR, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 2000},
+                {MONTH_OF_YEAR, LocalDate.of(2000, 2, 29), true, 2},
+                {MONTH_OF_YEAR, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 2},
+                {DAY_OF_MONTH, LocalDate.of(2000, 2, 29), true, 29},
+                {DAY_OF_MONTH, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 29},
+                {DAY_OF_YEAR, LocalDate.of(2000, 2, 29), true, 60},
+                {DAY_OF_YEAR, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 60},
+
+                {HOUR_OF_DAY, LocalTime.of(5, 4, 3, 200), true, 5},
+                {HOUR_OF_DAY, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 5},
+
+                {MINUTE_OF_DAY, LocalTime.of(5, 4, 3, 200), true, 5*60 + 4},
+                {MINUTE_OF_DAY, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 5*60 + 4},
+                {MINUTE_OF_HOUR, LocalTime.of(5, 4, 3, 200), true, 4},
+                {MINUTE_OF_HOUR, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 4},
+
+                {SECOND_OF_DAY, LocalTime.of(5, 4, 3, 200), true, 5*3600 + 4*60 + 3},
+                {SECOND_OF_DAY, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 5*3600 + 4*60 + 3},
+                {SECOND_OF_MINUTE, LocalTime.of(5, 4, 3, 200), true, 3},
+                {SECOND_OF_MINUTE, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 3},
+
+                {NANO_OF_SECOND, LocalTime.of(5, 4, 3, 200), true, 200},
+                {NANO_OF_SECOND, LocalDateTime.of(2000, 2, 29, 5, 4, 3, 200), true, 200},
+
+                {YEAR, LocalTime.of(5, 4, 3, 200), false, -1},
+                {MONTH_OF_YEAR, LocalTime.of(5, 4, 3, 200), false, -1},
+                {DAY_OF_MONTH, LocalTime.of(5, 4, 3, 200), false, -1},
+                {DAY_OF_YEAR, LocalTime.of(5, 4, 3, 200), false, -1},
+                {HOUR_OF_DAY, LocalDate.of(2000, 2, 29), false, -1},
+                {MINUTE_OF_DAY, LocalDate.of(2000, 2, 29), false, -1},
+                {MINUTE_OF_HOUR, LocalDate.of(2000, 2, 29), false, -1},
+                {SECOND_OF_DAY, LocalDate.of(2000, 2, 29), false, -1},
+                {SECOND_OF_MINUTE, LocalDate.of(2000, 2, 29), false, -1},
+                {NANO_OF_SECOND, LocalDate.of(2000, 2, 29), false, -1},
+        };
+    }
+
+    @Test(dataProvider = "fieldAndAccessor")
+    public void test_supportedAccessor(ChronoField field, TemporalAccessor accessor, boolean isSupported, long value) {
+        assertEquals(field.isSupportedBy(accessor), isSupported);
+        if (isSupported) {
+            assertEquals(field.getFrom(accessor), value);
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    // range() and rangeRefinedBy(TemporalAccessor temporal)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_range() {
+        assertEquals(MONTH_OF_YEAR.range(), ValueRange.of(1, 12));
+        assertEquals(MONTH_OF_YEAR.rangeRefinedBy(LocalDate.of(2000, 2, 29)), ValueRange.of(1, 12));
+
+        assertEquals(DAY_OF_MONTH.range(), ValueRange.of(1, 28, 31));
+        assertEquals(DAY_OF_MONTH.rangeRefinedBy(LocalDate.of(2000, 2, 29)), ValueRange.of(1, 29));
+    }
+
+    //-----------------------------------------------------------------------
+    // valueOf()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_valueOf() {
+        for (ChronoField field : ChronoField.values()) {
+            assertEquals(ChronoField.valueOf(field.name()), field);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKChronoUnit.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Copyright (c) 2008-2012, Stephen Colebourne & Michael Nascimento Santos
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ *  * Neither the name of JSR-310 nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package tck.java.time.temporal;
+
+import static java.time.temporal.ChronoUnit.CENTURIES;
+import static java.time.temporal.ChronoUnit.DAYS;
+import static java.time.temporal.ChronoUnit.DECADES;
+import static java.time.temporal.ChronoUnit.ERAS;
+import static java.time.temporal.ChronoUnit.FOREVER;
+import static java.time.temporal.ChronoUnit.HALF_DAYS;
+import static java.time.temporal.ChronoUnit.HOURS;
+import static java.time.temporal.ChronoUnit.MICROS;
+import static java.time.temporal.ChronoUnit.MILLENNIA;
+import static java.time.temporal.ChronoUnit.MILLIS;
+import static java.time.temporal.ChronoUnit.MINUTES;
+import static java.time.temporal.ChronoUnit.MONTHS;
+import static java.time.temporal.ChronoUnit.NANOS;
+import static java.time.temporal.ChronoUnit.SECONDS;
+import static java.time.temporal.ChronoUnit.WEEKS;
+import static java.time.temporal.ChronoUnit.YEARS;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.time.LocalDate;
+import java.time.LocalTime;
+import java.time.temporal.ChronoField;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.Temporal;
+import java.time.temporal.TemporalAccessor;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test.
+ */
+@Test
+public class TCKChronoUnit {
+
+    //-----------------------------------------------------------------------
+    // isDateBased(), isTimeBased() and isDurationEstimated()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="chronoUnit")
+    Object[][] data_chronoUnit() {
+        return new Object[][] {
+                {FOREVER, false, false, true},
+                {ERAS, true, false, true},
+                {MILLENNIA, true, false, true},
+                {CENTURIES, true, false, true},
+                {DECADES, true, false, true},
+                {YEARS, true, false, true},
+                {MONTHS, true, false, true},
+                {WEEKS, true, false, true},
+                {DAYS, true, false, true},
+
+                {HALF_DAYS, false, true, false},
+                {HOURS, false, true, false},
+                {MINUTES, false, true, false},
+                {SECONDS, false, true, false},
+                {MICROS, false, true, false},
+                {MILLIS, false, true, false},
+                {NANOS, false, true, false},
+
+        };
+    }
+
+    @Test(dataProvider = "chronoUnit")
+    public void test_unitType(ChronoUnit unit, boolean isDateBased, boolean isTimeBased, boolean isDurationEstimated) {
+        assertEquals(unit.isDateBased(), isDateBased);
+        assertEquals(unit.isTimeBased(), isTimeBased);
+        assertEquals(unit.isDurationEstimated(), isDurationEstimated);
+    }
+
+    //-----------------------------------------------------------------------
+    // isSupportedBy(), addTo() and between()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="unitAndTemporal")
+    Object[][] data_unitAndTemporal() {
+        return new Object[][] {
+                {CENTURIES, LocalDate.of(2000, 1, 10), true, 1, LocalDate.of(2100, 1, 10)},
+                {DECADES, LocalDate.of(2000, 1, 10), true, 1, LocalDate.of(2010, 1, 10)},
+                {YEARS, LocalDate.of(2000, 1, 10), true, 1, LocalDate.of(2001, 1, 10)},
+                {MONTHS, LocalDate.of(2000, 1, 10), true, 1, LocalDate.of(2000, 2, 10)},
+                {WEEKS, LocalDate.of(2000, 1, 10), true, 1, LocalDate.of(2000, 1, 17)},
+                {DAYS, LocalDate.of(2000, 1, 10), true, 1, LocalDate.of(2000, 1, 11)},
+
+                {HALF_DAYS, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(13, 2, 3, 400)},
+                {HOURS, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(2, 2, 3, 400)},
+                {MINUTES, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(1, 3, 3, 400)},
+                {SECONDS, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(1, 2, 4, 400)},
+                {MICROS, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(1, 2, 3, 1000 + 400)},
+                {MILLIS, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(1, 2, 3, 1000*1000 + 400)},
+                {NANOS, LocalTime.of(1, 2, 3, 400), true, 1, LocalTime.of(1, 2, 3, 1 + 400)},
+
+                {CENTURIES, LocalTime.of(1, 2, 3, 400), false, 1, null},
+                {DECADES, LocalTime.of(1, 2, 3, 400), false, 1, null},
+                {YEARS, LocalTime.of(1, 2, 3, 400), false, 1, null},
+                {MONTHS, LocalTime.of(1, 2, 3, 400), false, 1, null},
+                {WEEKS, LocalTime.of(1, 2, 3, 400), false, 1, null},
+                {DAYS, LocalTime.of(1, 2, 3, 400), false, 1, null},
+
+                {HALF_DAYS, LocalDate.of(2000, 2, 29), false, 1, null},
+                {HOURS, LocalDate.of(2000, 2, 29), false, 1, null},
+                {MINUTES, LocalDate.of(2000, 2, 29), false, 1, null},
+                {SECONDS, LocalDate.of(2000, 2, 29), false, 1, null},
+                {MICROS, LocalDate.of(2000, 2, 29), false, 1, null},
+                {MILLIS, LocalDate.of(2000, 2, 29), false, 1, null},
+                {NANOS, LocalDate.of(2000, 2, 29), false, 1, null},
+
+        };
+    }
+
+    @Test(dataProvider = "unitAndTemporal")
+    public void test_unitAndTemporal(ChronoUnit unit, Temporal base, boolean isSupportedBy, long amount,  Temporal target) {
+        assertEquals(unit.isSupportedBy(base), isSupportedBy);
+        if (isSupportedBy) {
+            Temporal result = unit.addTo(base, amount);
+            assertEquals(result, target);
+            assertEquals(unit.between(base, result), amount);
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    // valueOf()
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_valueOf() {
+        for (ChronoUnit unit : ChronoUnit.values()) {
+            assertEquals(ChronoUnit.valueOf(unit.name()), unit);
+        }
+    }
+}
--- a/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/temporal/TCKWeekFields.java	Tue Aug 06 16:54:56 2013 -0700
@@ -56,16 +56,22 @@
  */
 package tck.java.time.temporal;
 
+import static java.time.format.ResolverStyle.LENIENT;
+import static java.time.format.ResolverStyle.SMART;
+import static java.time.format.ResolverStyle.STRICT;
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
 import static java.time.temporal.ChronoField.DAY_OF_WEEK;
 import static java.time.temporal.ChronoField.DAY_OF_YEAR;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
-
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
 import static org.testng.Assert.assertSame;
+import static org.testng.Assert.assertTrue;
 
 import java.io.IOException;
+import java.time.DateTimeException;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
@@ -376,14 +382,13 @@
         TemporalField womField = week.weekOfMonth();
 
         for (int i = 1; i <= 60; i++) {
-            // Test that with dayOfWeek and Week of month it computes the date
             DateTimeFormatter f = new DateTimeFormatterBuilder()
-                    .appendValue(YEAR).appendLiteral('-')
-                    .appendValue(MONTH_OF_YEAR).appendLiteral('-')
-                    .appendValue(womField).appendLiteral('-')
-                    .appendValue(DAY_OF_WEEK).toFormatter();
-            String str = date.getYear() + "-" + date.getMonthValue() + "-" +
-                    date.get(womField) + "-" + date.get(DAY_OF_WEEK);
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(MONTH_OF_YEAR).appendLiteral(':')
+                    .appendValue(womField).appendLiteral(':')
+                    .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(SMART);
+            String str = date.getYear() + ":" + date.getMonthValue() + ":" +
+                    date.get(womField) + ":" + date.get(DAY_OF_WEEK);
             LocalDate parsed = LocalDate.parse(str, f);
             assertEquals(parsed, date, " ::" + str + "::" + i);
 
@@ -392,6 +397,52 @@
     }
 
     @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWom_lenient(DayOfWeek firstDayOfWeek, int minDays) {
+        LocalDate date = LocalDate.of(2012, 12, 15);
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField womField = week.weekOfMonth();
+
+        for (int i = 1; i <= 60; i++) {
+            DateTimeFormatter f = new DateTimeFormatterBuilder()
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(MONTH_OF_YEAR).appendLiteral(':')
+                    .appendValue(womField).appendLiteral(':')
+                    .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(LENIENT);
+            int wom = date.get(womField);
+            int dow = date.get(DAY_OF_WEEK);
+            for (int j = wom - 10; j < wom + 10; j++) {
+                String str = date.getYear() + ":" + date.getMonthValue() + ":" + j + ":" + dow;
+                LocalDate parsed = LocalDate.parse(str, f);
+                assertEquals(parsed, date.plusWeeks(j - wom), " ::" + str + ": :" + i + "::" + j);
+            }
+
+            date = date.plusDays(1);
+        }
+    }
+
+    @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWom_strict(DayOfWeek firstDayOfWeek, int minDays) {
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField womField = week.weekOfMonth();
+        DateTimeFormatter f = new DateTimeFormatterBuilder()
+                .appendValue(YEAR).appendLiteral(':')
+                .appendValue(MONTH_OF_YEAR).appendLiteral(':')
+                .appendValue(womField).appendLiteral(':')
+                .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(STRICT);
+        String str = "2012:1:0:1";
+        try {
+            LocalDate date = LocalDate.parse(str, f);
+            assertEquals(date.getYear(), 2012);
+            assertEquals(date.getMonthValue(), 1);
+            assertEquals(date.get(womField), 0);
+            assertEquals(date.get(DAY_OF_WEEK), 1);
+        } catch (DateTimeException ex) {
+            // expected
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="weekFields")
     public void test_parse_resolve_localizedWomDow(DayOfWeek firstDayOfWeek, int minDays) {
         LocalDate date = LocalDate.of(2012, 12, 15);
         WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
@@ -399,14 +450,13 @@
         TemporalField womField = week.weekOfMonth();
 
         for (int i = 1; i <= 15; i++) {
-            // Test that with dayOfWeek and Week of month it computes the date
             DateTimeFormatter f = new DateTimeFormatterBuilder()
-                    .appendValue(YEAR).appendLiteral('-')
-                    .appendValue(MONTH_OF_YEAR).appendLiteral('-')
-                    .appendValue(womField).appendLiteral('-')
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(MONTH_OF_YEAR).appendLiteral(':')
+                    .appendValue(womField).appendLiteral(':')
                     .appendValue(dowField).toFormatter();
-            String str = date.getYear() + "-" + date.getMonthValue() + "-" +
-                    date.get(womField) + "-" + date.get(dowField);
+            String str = date.getYear() + ":" + date.getMonthValue() + ":" +
+                    date.get(womField) + ":" + date.get(dowField);
             LocalDate parsed = LocalDate.parse(str, f);
             assertEquals(parsed, date, " :: " + str + " " + i);
 
@@ -415,20 +465,44 @@
     }
 
     @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWomDow_lenient(DayOfWeek firstDayOfWeek, int minDays) {
+        LocalDate date = LocalDate.of(2012, 12, 15);
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField dowField = week.dayOfWeek();
+        TemporalField womField = week.weekOfMonth();
+
+        for (int i = 1; i <= 60; i++) {
+            DateTimeFormatter f = new DateTimeFormatterBuilder()
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(MONTH_OF_YEAR).appendLiteral(':')
+                    .appendValue(womField).appendLiteral(':')
+                    .appendValue(dowField).toFormatter().withResolverStyle(LENIENT);
+            int wom = date.get(womField);
+            int dow = date.get(dowField);
+            for (int j = wom - 10; j < wom + 10; j++) {
+                String str = date.getYear() + ":" + date.getMonthValue() + ":" + j + ":" + dow;
+                LocalDate parsed = LocalDate.parse(str, f);
+                assertEquals(parsed, date.plusWeeks(j - wom), " ::" + str + ": :" + i + "::" + j);
+            }
+
+            date = date.plusDays(1);
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="weekFields")
     public void test_parse_resolve_localizedWoy(DayOfWeek firstDayOfWeek, int minDays) {
         LocalDate date = LocalDate.of(2012, 12, 15);
         WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
         TemporalField woyField = week.weekOfYear();
 
         for (int i = 1; i <= 60; i++) {
-            // Test that with dayOfWeek and Week of month it computes the date
             DateTimeFormatter f = new DateTimeFormatterBuilder()
-                    .appendValue(YEAR).appendLiteral('-')
-                    .appendValue(MONTH_OF_YEAR).appendLiteral('-')
-                    .appendValue(woyField).appendLiteral('-')
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(woyField).appendLiteral(':')
                     .appendValue(DAY_OF_WEEK).toFormatter();
-            String str = date.getYear() + "-" + date.getMonthValue() + "-" +
-                    date.get(woyField) + "-" + date.get(DAY_OF_WEEK);
+            String str = date.getYear() + ":" +
+                    date.get(woyField) + ":" + date.get(DAY_OF_WEEK);
             LocalDate parsed = LocalDate.parse(str, f);
             assertEquals(parsed, date, " :: " + str + " " + i);
 
@@ -437,6 +511,49 @@
     }
 
     @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWoy_lenient(DayOfWeek firstDayOfWeek, int minDays) {
+        LocalDate date = LocalDate.of(2012, 12, 15);
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField woyField = week.weekOfYear();
+
+        for (int i = 1; i <= 60; i++) {
+            DateTimeFormatter f = new DateTimeFormatterBuilder()
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(woyField).appendLiteral(':')
+                    .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(LENIENT);
+            int woy = date.get(woyField);
+            int dow = date.get(DAY_OF_WEEK);
+            for (int j = woy - 60; j < woy + 60; j++) {
+                String str = date.getYear() + ":" + j + ":" + dow;
+                LocalDate parsed = LocalDate.parse(str, f);
+                assertEquals(parsed, date.plusWeeks(j - woy), " ::" + str + ": :" + i + "::" + j);
+            }
+
+            date = date.plusDays(1);
+        }
+    }
+
+    @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWoy_strict(DayOfWeek firstDayOfWeek, int minDays) {
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField woyField = week.weekOfYear();
+        DateTimeFormatter f = new DateTimeFormatterBuilder()
+                .appendValue(YEAR).appendLiteral(':')
+                .appendValue(woyField).appendLiteral(':')
+                .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(STRICT);
+        String str = "2012:0:1";
+        try {
+            LocalDate date = LocalDate.parse(str, f);
+            assertEquals(date.getYear(), 2012);
+            assertEquals(date.get(woyField), 0);
+            assertEquals(date.get(DAY_OF_WEEK), 1);
+        } catch (DateTimeException ex) {
+            // expected
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="weekFields")
     public void test_parse_resolve_localizedWoyDow(DayOfWeek firstDayOfWeek, int minDays) {
         LocalDate date = LocalDate.of(2012, 12, 15);
         WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
@@ -444,14 +561,13 @@
         TemporalField woyField = week.weekOfYear();
 
         for (int i = 1; i <= 60; i++) {
-            // Test that with dayOfWeek and Week of month it computes the date
             DateTimeFormatter f = new DateTimeFormatterBuilder()
-                    .appendValue(YEAR).appendLiteral('-')
-                    .appendValue(MONTH_OF_YEAR).appendLiteral('-')
-                    .appendValue(woyField).appendLiteral('-')
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(MONTH_OF_YEAR).appendLiteral(':')
+                    .appendValue(woyField).appendLiteral(':')
                     .appendValue(dowField).toFormatter();
-            String str = date.getYear() + "-" + date.getMonthValue() + "-" +
-                    date.get(woyField) + "-" + date.get(dowField);
+            String str = date.getYear() + ":" + date.getMonthValue() + ":" +
+                    date.get(woyField) + ":" + date.get(dowField);
             LocalDate parsed = LocalDate.parse(str, f);
             assertEquals(parsed, date, " :: " + str + " " + i);
 
@@ -460,6 +576,31 @@
     }
 
     @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWoyDow_lenient(DayOfWeek firstDayOfWeek, int minDays) {
+        LocalDate date = LocalDate.of(2012, 12, 15);
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField dowField = week.dayOfWeek();
+        TemporalField woyField = week.weekOfYear();
+
+        for (int i = 1; i <= 60; i++) {
+            DateTimeFormatter f = new DateTimeFormatterBuilder()
+                    .appendValue(YEAR).appendLiteral(':')
+                    .appendValue(woyField).appendLiteral(':')
+                    .appendValue(dowField).toFormatter().withResolverStyle(LENIENT);
+            int woy = date.get(woyField);
+            int dow = date.get(dowField);
+            for (int j = woy - 60; j < woy + 60; j++) {
+                String str = date.getYear() + ":" + j + ":" + dow;
+                LocalDate parsed = LocalDate.parse(str, f);
+                assertEquals(parsed, date.plusWeeks(j - woy), " ::" + str + ": :" + i + "::" + j);
+            }
+
+            date = date.plusDays(1);
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="weekFields")
     public void test_parse_resolve_localizedWoWBY(DayOfWeek firstDayOfWeek, int minDays) {
         LocalDate date = LocalDate.of(2012, 12, 31);
         WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
@@ -467,12 +608,11 @@
         TemporalField yowbyField = week.weekBasedYear();
 
         for (int i = 1; i <= 60; i++) {
-            // Test that with dayOfWeek, week of year and year of week-based-year it computes the date
             DateTimeFormatter f = new DateTimeFormatterBuilder()
-                    .appendValue(yowbyField).appendLiteral('-')
-                    .appendValue(wowbyField).appendLiteral('-')
+                    .appendValue(yowbyField).appendLiteral(':')
+                    .appendValue(wowbyField).appendLiteral(':')
                     .appendValue(DAY_OF_WEEK).toFormatter();
-            String str = date.get(yowbyField) + "-" + date.get(wowbyField) + "-" +
+            String str = date.get(yowbyField) + ":" + date.get(wowbyField) + ":" +
                     date.get(DAY_OF_WEEK);
             LocalDate parsed = LocalDate.parse(str, f);
             assertEquals(parsed, date, " :: " + str + " " + i);
@@ -482,6 +622,51 @@
     }
 
     @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWoWBY_lenient(DayOfWeek firstDayOfWeek, int minDays) {
+        LocalDate date = LocalDate.of(2012, 12, 31);
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField wowbyField = week.weekOfWeekBasedYear();
+        TemporalField yowbyField = week.weekBasedYear();
+
+        for (int i = 1; i <= 60; i++) {
+            DateTimeFormatter f = new DateTimeFormatterBuilder()
+                    .appendValue(yowbyField).appendLiteral(':')
+                    .appendValue(wowbyField).appendLiteral(':')
+                    .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(LENIENT);
+            int wowby = date.get(wowbyField);
+            int dow = date.get(DAY_OF_WEEK);
+            for (int j = wowby - 60; j < wowby + 60; j++) {
+                String str = date.get(yowbyField) + ":" + j + ":" + dow;
+                LocalDate parsed = LocalDate.parse(str, f);
+                assertEquals(parsed, date.plusWeeks(j - wowby), " ::" + str + ": :" + i + "::" + j);
+            }
+
+            date = date.plusDays(1);
+        }
+    }
+
+    @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWoWBY_strict(DayOfWeek firstDayOfWeek, int minDays) {
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField wowbyField = week.weekOfWeekBasedYear();
+        TemporalField yowbyField = week.weekBasedYear();
+        DateTimeFormatter f = new DateTimeFormatterBuilder()
+                .appendValue(yowbyField).appendLiteral(':')
+                .appendValue(wowbyField).appendLiteral(':')
+                .appendValue(DAY_OF_WEEK).toFormatter().withResolverStyle(STRICT);
+        String str = "2012:0:1";
+        try {
+            LocalDate date = LocalDate.parse(str, f);
+            assertEquals(date.get(yowbyField), 2012);
+            assertEquals(date.get(wowbyField), 0);
+            assertEquals(date.get(DAY_OF_WEEK), 1);
+        } catch (DateTimeException ex) {
+            // expected
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    @Test(dataProvider="weekFields")
     public void test_parse_resolve_localizedWoWBYDow(DayOfWeek firstDayOfWeek, int minDays) {
         LocalDate date = LocalDate.of(2012, 12, 31);
         WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
@@ -490,12 +675,11 @@
         TemporalField yowbyField = week.weekBasedYear();
 
         for (int i = 1; i <= 60; i++) {
-            // Test that with dayOfWeek, week of year and year of week-based-year it computes the date
             DateTimeFormatter f = new DateTimeFormatterBuilder()
-                    .appendValue(yowbyField).appendLiteral('-')
-                    .appendValue(wowbyField).appendLiteral('-')
+                    .appendValue(yowbyField).appendLiteral(':')
+                    .appendValue(wowbyField).appendLiteral(':')
                     .appendValue(dowField).toFormatter();
-            String str = date.get(yowbyField) + "-" + date.get(wowbyField) + "-" +
+            String str = date.get(yowbyField) + ":" + date.get(wowbyField) + ":" +
                     date.get(dowField);
             LocalDate parsed = LocalDate.parse(str, f);
             assertEquals(parsed, date, " :: " + str + " " + i);
@@ -504,6 +688,31 @@
         }
     }
 
+    @Test(dataProvider="weekFields")
+    public void test_parse_resolve_localizedWoWBYDow_lenient(DayOfWeek firstDayOfWeek, int minDays) {
+        LocalDate date = LocalDate.of(2012, 12, 31);
+        WeekFields week = WeekFields.of(firstDayOfWeek, minDays);
+        TemporalField dowField = week.dayOfWeek();
+        TemporalField wowbyField = week.weekOfWeekBasedYear();
+        TemporalField yowbyField = week.weekBasedYear();
+
+        for (int i = 1; i <= 60; i++) {
+            DateTimeFormatter f = new DateTimeFormatterBuilder()
+                    .appendValue(yowbyField).appendLiteral(':')
+                    .appendValue(wowbyField).appendLiteral(':')
+                    .appendValue(dowField).toFormatter().withResolverStyle(LENIENT);
+            int wowby = date.get(wowbyField);
+            int dow = date.get(dowField);
+            for (int j = wowby - 60; j < wowby + 60; j++) {
+                String str = date.get(yowbyField) + ":" + j + ":" + dow;
+                LocalDate parsed = LocalDate.parse(str, f);
+                assertEquals(parsed, date.plusWeeks(j - wowby), " ::" + str + ": :" + i + "::" + j);
+            }
+
+            date = date.plusDays(1);
+        }
+    }
+
     //-----------------------------------------------------------------------
     @Test(dataProvider="weekFields")
     public void test_serializable_singleton(DayOfWeek firstDayOfWeek, int minDays) throws IOException, ClassNotFoundException {
@@ -587,4 +796,21 @@
         assertEquals(date.get(yowbyField), wby);
     }
 
+    //-----------------------------------------------------------------------
+    // equals() and hashCode().
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_equals() {
+        WeekFields weekDef_iso = WeekFields.ISO;
+        WeekFields weekDef_sundayStart = WeekFields.SUNDAY_START;
+
+        assertTrue(weekDef_iso.equals(WeekFields.of(DayOfWeek.MONDAY, 4)));
+        assertTrue(weekDef_sundayStart.equals(WeekFields.of(DayOfWeek.SUNDAY, 1)));
+        assertEquals(weekDef_iso.hashCode(), WeekFields.of(DayOfWeek.MONDAY, 4).hashCode());
+        assertEquals(weekDef_sundayStart.hashCode(), WeekFields.of(DayOfWeek.SUNDAY, 1).hashCode());
+
+        assertFalse(weekDef_iso.equals(weekDef_sundayStart));
+        assertNotEquals(weekDef_iso.hashCode(), weekDef_sundayStart.hashCode());
+    }
+
 }
--- a/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/tck/java/time/zone/TCKZoneRules.java	Tue Aug 06 16:54:56 2013 -0700
@@ -75,6 +75,7 @@
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.Month;
+import java.time.OffsetDateTime;
 import java.time.Year;
 import java.time.ZoneId;
 import java.time.ZoneOffset;
@@ -83,6 +84,7 @@
 import java.time.zone.ZoneOffsetTransitionRule;
 import java.time.zone.ZoneOffsetTransitionRule.TimeDefinition;
 import java.time.zone.ZoneRules;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
@@ -918,6 +920,65 @@
         assertEquals(test.nextTransition(last.getInstant()), null);
     }
 
+    //-----------------------------------------------------------------------
+    // Apia
+    //-----------------------------------------------------------------------
+    private ZoneRules pacificApia() {
+        return ZoneId.of("Pacific/Apia").getRules();
+    }
+
+    public void test_Apia_nextTransition_historic() {
+        ZoneRules test = pacificApia();
+        List<ZoneOffsetTransition> trans = test.getTransitions();
+
+        ZoneOffsetTransition first = trans.get(0);
+        assertEquals(test.nextTransition(first.getInstant().minusNanos(1)), first);
+
+        for (int i = 0; i < trans.size() - 1; i++) {
+            ZoneOffsetTransition cur = trans.get(i);
+            ZoneOffsetTransition next = trans.get(i + 1);
+
+            assertEquals(test.nextTransition(cur.getInstant()), next);
+            assertEquals(test.nextTransition(next.getInstant().minusNanos(1)), next);
+        }
+    }
+
+    public void test_Apia_jumpOverInternationalDateLine_M10_to_P14() {
+        // transition occurred at 2011-12-30T00:00-10:00
+        ZoneRules test = pacificApia();
+        Instant instantBefore = LocalDate.of(2011, 12, 27).atStartOfDay(ZoneOffset.UTC).toInstant();
+        ZoneOffsetTransition trans = test.nextTransition(instantBefore);
+        assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(2011, 12, 30, 0, 0));
+        assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(2011, 12, 31, 0, 0));
+        assertEquals(trans.isGap(), true);
+        assertEquals(trans.isOverlap(), false);
+        assertEquals(trans.isValidOffset(ZoneOffset.ofHours(-10)), false);
+        assertEquals(trans.isValidOffset(ZoneOffset.ofHours(+14)), false);
+        assertEquals(trans.getDuration(), Duration.ofHours(24));
+        assertEquals(trans.getInstant(), LocalDateTime.of(2011, 12, 31, 0, 0).toInstant(ZoneOffset.ofHours(+14)));
+
+        ZonedDateTime zdt = ZonedDateTime.of(2011, 12, 29, 23, 0, 0, 0, ZoneId.of("Pacific/Apia"));
+        assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(2011, 12, 31, 1, 0));
+    }
+
+    public void test_Apia_jumpForwardOverInternationalDateLine_P12_to_M12() {
+        // transition occurred at 1879-07-04T00:00+12:33:04
+        ZoneRules test = pacificApia();
+        Instant instantBefore = LocalDate.of(1879, 7, 2).atStartOfDay(ZoneOffset.UTC).toInstant();
+        ZoneOffsetTransition trans = test.nextTransition(instantBefore);
+        assertEquals(trans.getDateTimeBefore(), LocalDateTime.of(1879, 7, 5, 0, 0));
+        assertEquals(trans.getDateTimeAfter(), LocalDateTime.of(1879, 7, 4, 0, 0));
+        assertEquals(trans.isGap(), false);
+        assertEquals(trans.isOverlap(), true);
+        assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(+12, 33, 4)), true);
+        assertEquals(trans.isValidOffset(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)), true);
+        assertEquals(trans.getDuration(), Duration.ofHours(-24));
+        assertEquals(trans.getInstant(), LocalDateTime.of(1879, 7, 4, 0, 0).toInstant(ZoneOffset.ofHoursMinutesSeconds(-11, -26, -56)));
+
+        ZonedDateTime zdt = ZonedDateTime.of(1879, 7, 4, 23, 0, 0, 0, ZoneId.of("Pacific/Apia"));
+        assertEquals(zdt.plusHours(2).toLocalDateTime(), LocalDateTime.of(1879, 7, 4, 1, 0, 0));
+    }
+
     //-------------------------------------------------------------------------
     @Test(expectedExceptions=UnsupportedOperationException.class)
     public void test_getTransitions_immutable() {
@@ -932,6 +993,81 @@
     }
 
     //-----------------------------------------------------------------------
+    // of()
+    //-----------------------------------------------------------------------
+    public void test_of(){
+        //used for standard offset
+        ZoneOffset stdOffset1 = ZoneOffset.UTC;
+        ZoneOffset stdOffset2 = ZoneOffset.ofHours(1);
+        LocalDateTime time_of_stdOffsetTransition1 = LocalDateTime.of(2013, 1, 5, 1, 0);
+        ZoneOffsetTransition  stdOffsetTransition1 = ZoneOffsetTransition.of(time_of_stdOffsetTransition1, stdOffset1, stdOffset2);
+        List<ZoneOffsetTransition> stdOffsetTransition_list = new ArrayList<ZoneOffsetTransition>();
+        stdOffsetTransition_list.add(stdOffsetTransition1);
+
+        //used for wall offset
+        ZoneOffset wallOffset1 = ZoneOffset.ofHours(2);
+        ZoneOffset wallOffset2 = ZoneOffset.ofHours(4);
+        ZoneOffset wallOffset3 = ZoneOffset.ofHours(7);
+
+        LocalDateTime time_of_wallOffsetTransition1 = LocalDateTime.of(2013, 2, 5, 1, 0);
+        LocalDateTime time_of_wallOffsetTransition2 = LocalDateTime.of(2013, 3, 5, 1, 0);
+        LocalDateTime time_of_wallOffsetTransition3 = LocalDateTime.of(2013, 10, 5, 1, 0);
+
+        ZoneOffsetTransition  wallOffsetTransition1 = ZoneOffsetTransition.of(time_of_wallOffsetTransition1, wallOffset1, wallOffset2);
+        ZoneOffsetTransition  wallOffsetTransition2 = ZoneOffsetTransition.of(time_of_wallOffsetTransition2, wallOffset2, wallOffset3);
+        ZoneOffsetTransition  wallOffsetTransition3 = ZoneOffsetTransition.of(time_of_wallOffsetTransition3, wallOffset3, wallOffset1);
+
+        List<ZoneOffsetTransition> wallOffsetTransition_list = new ArrayList<ZoneOffsetTransition>();
+        wallOffsetTransition_list.add(wallOffsetTransition1);
+        wallOffsetTransition_list.add(wallOffsetTransition2);
+        wallOffsetTransition_list.add(wallOffsetTransition3);
+
+        //used for ZoneOffsetTransitionRule
+        ZoneOffset ruleOffset = ZoneOffset.ofHours(3);
+        ZoneOffsetTransitionRule.TimeDefinition timeDefinition = ZoneOffsetTransitionRule.TimeDefinition.valueOf("WALL");
+        ZoneOffsetTransitionRule rule1 = ZoneOffsetTransitionRule.of(Month.FEBRUARY,
+                                                                     2,
+                                                                     DayOfWeek.MONDAY,
+                                                                     LocalTime.of(1, 0),
+                                                                     false,
+                                                                     timeDefinition,
+                                                                     ZoneOffset.UTC,
+                                                                     ZoneOffset.UTC,
+                                                                     ruleOffset
+                                                                     );
+         List<ZoneOffsetTransitionRule> rule_list = new ArrayList<ZoneOffsetTransitionRule>();
+         rule_list.add(rule1);
+
+         //Begin verification
+         ZoneRules zoneRule = ZoneRules.of(stdOffset1,
+                                           wallOffset1,
+                                           stdOffsetTransition_list,
+                                           wallOffsetTransition_list,
+                                           rule_list
+                                           );
+
+         OffsetDateTime before_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).minusSeconds(1);
+         OffsetDateTime after_time_of_stdOffsetTransition1 = OffsetDateTime.of(time_of_stdOffsetTransition1, stdOffset1).plusSeconds(1);;
+         assertEquals(zoneRule.getStandardOffset(before_time_of_stdOffsetTransition1.toInstant()), stdOffset1);
+         assertEquals(zoneRule.getStandardOffset(after_time_of_stdOffsetTransition1.toInstant()), stdOffset2);
+
+         OffsetDateTime  before_time_of_wallOffsetTransition1 = OffsetDateTime.of(time_of_wallOffsetTransition1, wallOffset1).minusSeconds(1);
+         OffsetDateTime  after_time_of_wallOffsetTransition1 = OffsetDateTime.of(time_of_wallOffsetTransition1, wallOffset1).plusSeconds(1);
+         assertEquals(zoneRule.nextTransition(before_time_of_wallOffsetTransition1.toInstant()), wallOffsetTransition1);
+         assertEquals(zoneRule.nextTransition(after_time_of_wallOffsetTransition1.toInstant()), wallOffsetTransition2);
+
+         OffsetDateTime  before_time_of_wallOffsetTransition2 = OffsetDateTime.of(time_of_wallOffsetTransition2, wallOffset2).minusSeconds(1);
+         OffsetDateTime  after_time_of_wallOffsetTransition2 = OffsetDateTime.of(time_of_wallOffsetTransition2, wallOffset2).plusSeconds(1);
+         assertEquals(zoneRule.nextTransition(before_time_of_wallOffsetTransition2.toInstant()), wallOffsetTransition2);
+         assertEquals(zoneRule.nextTransition(after_time_of_wallOffsetTransition2.toInstant()), wallOffsetTransition3);
+
+         OffsetDateTime  before_time_of_wallOffsetTransition3 = OffsetDateTime.of(time_of_wallOffsetTransition3, wallOffset3).minusSeconds(1);
+         OffsetDateTime  after_time_of_wallOffsetTransition3 = OffsetDateTime.of(time_of_wallOffsetTransition3, wallOffset3).plusSeconds(1);
+         assertEquals(zoneRule.nextTransition(before_time_of_wallOffsetTransition3.toInstant()), wallOffsetTransition3);
+         assertEquals(zoneRule.nextTransition(after_time_of_wallOffsetTransition3.toInstant()), rule1.createTransition(2014));
+    }
+
+    //-----------------------------------------------------------------------
     // equals() / hashCode()
     //-----------------------------------------------------------------------
     public void test_equals() {
--- a/jdk/test/java/time/test/java/time/MockSimplePeriod.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/MockSimplePeriod.java	Tue Aug 06 16:54:56 2013 -0700
@@ -176,7 +176,7 @@
 
     @Override
     public String toString() {
-        return amount + " " + unit.getName();
+        return amount + " " + unit;
     }
 
 }
--- a/jdk/test/java/time/test/java/time/chrono/TestChronoLocalDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/chrono/TestChronoLocalDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -60,7 +60,9 @@
 import static org.testng.Assert.assertTrue;
 
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
 import java.time.chrono.Chronology;
 import java.time.chrono.ThaiBuddhistChronology;
 import java.time.chrono.ThaiBuddhistDate;
@@ -80,8 +82,8 @@
 
     //-----------------------------------------------------------------------
     public void test_date_comparator_checkGenerics_ISO() {
-        List<ChronoLocalDate<LocalDate>> dates = new ArrayList<>();
-        ChronoLocalDate<LocalDate> date = LocalDate.of(2013, 1, 1);
+        List<ChronoLocalDate> dates = new ArrayList<>();
+        ChronoLocalDate date = LocalDate.of(2013, 1, 1);
 
         // Insert dates in order, no duplicates
         dates.add(date.minus(10, ChronoUnit.YEARS));
@@ -96,55 +98,7 @@
         dates.add(date.plus(1, ChronoUnit.YEARS));
         dates.add(date.plus(10, ChronoUnit.YEARS));
 
-        List<ChronoLocalDate<LocalDate>> copy = new ArrayList<>(dates);
-        Collections.shuffle(copy);
-        Collections.sort(copy, ChronoLocalDate.timeLineOrder());
-        assertEquals(copy, dates);
-        assertTrue(ChronoLocalDate.timeLineOrder().compare(copy.get(0), copy.get(1)) < 0);
-    }
-
-    public void test_date_comparator_checkGenerics_unknown() {
-        List<ChronoLocalDate<?>> dates = new ArrayList<>();
-        ChronoLocalDate<?> date = LocalDate.of(2013, 1, 1);
-
-        // Insert dates in order, no duplicates
-        dates.add(date.minus(10, ChronoUnit.YEARS));
-        dates.add(date.minus(1, ChronoUnit.YEARS));
-        dates.add(date.minus(1, ChronoUnit.MONTHS));
-        dates.add(date.minus(1, ChronoUnit.WEEKS));
-        dates.add(date.minus(1, ChronoUnit.DAYS));
-        dates.add(date);
-        dates.add(date.plus(1, ChronoUnit.DAYS));
-        dates.add(date.plus(1, ChronoUnit.WEEKS));
-        dates.add(date.plus(1, ChronoUnit.MONTHS));
-        dates.add(date.plus(1, ChronoUnit.YEARS));
-        dates.add(date.plus(10, ChronoUnit.YEARS));
-
-        List<ChronoLocalDate<?>> copy = new ArrayList<>(dates);
-        Collections.shuffle(copy);
-        Collections.sort(copy, ChronoLocalDate.timeLineOrder());
-        assertEquals(copy, dates);
-        assertTrue(ChronoLocalDate.timeLineOrder().compare(copy.get(0), copy.get(1)) < 0);
-    }
-
-    public <D extends ChronoLocalDate<D>> void test_date_comparator_checkGenerics_unknownExtends() {
-        List<ChronoLocalDate<D>> dates = new ArrayList<>();
-        ChronoLocalDate<D> date = (ChronoLocalDate) LocalDate.of(2013, 1, 1);  // TODO generics raw type
-
-        // Insert dates in order, no duplicates
-        dates.add(date.minus(10, ChronoUnit.YEARS));
-        dates.add(date.minus(1, ChronoUnit.YEARS));
-        dates.add(date.minus(1, ChronoUnit.MONTHS));
-        dates.add(date.minus(1, ChronoUnit.WEEKS));
-        dates.add(date.minus(1, ChronoUnit.DAYS));
-        dates.add(date);
-        dates.add(date.plus(1, ChronoUnit.DAYS));
-        dates.add(date.plus(1, ChronoUnit.WEEKS));
-        dates.add(date.plus(1, ChronoUnit.MONTHS));
-        dates.add(date.plus(1, ChronoUnit.YEARS));
-        dates.add(date.plus(10, ChronoUnit.YEARS));
-
-        List<ChronoLocalDate<D>> copy = new ArrayList<>(dates);
+        List<ChronoLocalDate> copy = new ArrayList<>(dates);
         Collections.shuffle(copy);
         Collections.sort(copy, ChronoLocalDate.timeLineOrder());
         assertEquals(copy, dates);
@@ -178,13 +132,12 @@
     //-----------------------------------------------------------------------
     public void test_date_checkGenerics_genericsMethod() {
         Chronology chrono = ThaiBuddhistChronology.INSTANCE;
-        ChronoLocalDate<?> date = chrono.dateNow();
-        // date = processOK(date);  // does not compile
+        ChronoLocalDate date = chrono.dateNow();
+        date = processOK(date);
         date = processClassOK(ThaiBuddhistDate.class);
         date = dateSupplier();
 
-        // date = processWeird(date);  // does not compile (correct)
-        // date = processClassWeird(ThaiBuddhistDate.class);  // does not compile (correct)
+        date = processClassWeird(ThaiBuddhistDate.class);
     }
 
     public void test_date_checkGenerics_genericsMethod_concreteType() {
@@ -195,12 +148,12 @@
         date = processClassOK(ThaiBuddhistDate.class);
         date = dateSupplier();
 
-        // date = processWeird(date);  // does not compile (correct)
         // date = processClassWeird(ThaiBuddhistDate.class);  // does not compile (correct)
     }
 
-    public <D extends ChronoLocalDate<D>> void test_date_checkGenerics_genericsMethod_withType() {
+    public <D extends ChronoLocalDate> void test_date_checkGenerics_genericsMethod_withType() {
         Chronology chrono = ThaiBuddhistChronology.INSTANCE;
+        @SuppressWarnings("unchecked")
         D date = (D) chrono.dateNow();
         date = processOK(date);
         // date = processClassOK(ThaiBuddhistDate.class);  // does not compile (correct)
@@ -210,24 +163,40 @@
         // date = processClassWeird(ThaiBuddhistDate.class);  // does not compile (correct)
     }
 
-    private <D extends ChronoLocalDate<D>> D dateSupplier() {
-        return (D) (ChronoLocalDate) ThaiBuddhistChronology.INSTANCE.dateNow();  // TODO raw types
+    @SuppressWarnings("unchecked")
+    private <D extends ChronoLocalDate> D dateSupplier() {
+        return (D) ThaiBuddhistChronology.INSTANCE.dateNow();
     }
 
     // decent generics signatures that need to work
-    private <D extends ChronoLocalDate<D>> D processOK(D date) {
-        return date;
+    @SuppressWarnings("unchecked")
+    private <D extends ChronoLocalDate> D processOK(D date) {
+        return (D) date.plus(1, ChronoUnit.DAYS);
     }
-    private <D extends ChronoLocalDate<D>> D processClassOK(Class<D> cls) {
+    private <D extends ChronoLocalDate> D processClassOK(Class<D> cls) {
         return null;
     }
 
     // weird generics signatures that shouldn't really work
-    private <D extends ChronoLocalDate<D>> ChronoLocalDate<D> processWeird(ChronoLocalDate<D> date) {
-        return date;
-    }
-    private <D extends ChronoLocalDate<D>> ChronoLocalDate<D> processClassWeird(Class<D> cls) {
+    private <D extends ChronoLocalDate> ChronoLocalDate processClassWeird(Class<D> cls) {
         return null;
     }
 
+    public void test_date_checkGenerics_chronoLocalDateTime1() {
+        LocalDateTime now = LocalDateTime.now();
+        Chronology chrono = ThaiBuddhistChronology.INSTANCE;
+        ChronoLocalDateTime<?> ldt = chrono.localDateTime(now);
+        ldt = processCLDT(ldt);
+    }
+
+    public void test_date_checkGenerics_chronoLocalDateTime2() {
+        LocalDateTime now = LocalDateTime.now();
+        Chronology chrono = ThaiBuddhistChronology.INSTANCE;
+        ChronoLocalDateTime<? extends ChronoLocalDate> ldt = chrono.localDateTime(now);
+        ldt = processCLDT(ldt);
+    }
+
+    private <D extends ChronoLocalDate> ChronoLocalDateTime<D> processCLDT(ChronoLocalDateTime<D> dt) {
+        return dt;
+    }
 }
--- a/jdk/test/java/time/test/java/time/chrono/TestExampleCode.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/chrono/TestExampleCode.java	Tue Aug 06 16:54:56 2013 -0700
@@ -59,10 +59,14 @@
 
 import static org.testng.Assert.assertEquals;
 
+import java.time.LocalDate;
 import java.time.LocalTime;
+import java.time.ZoneId;
 import java.time.chrono.ChronoLocalDate;
 import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoZonedDateTime;
 import java.time.chrono.Chronology;
+import java.time.chrono.HijrahChronology;
 import java.time.chrono.HijrahDate;
 import java.time.chrono.ThaiBuddhistDate;
 import java.time.temporal.ChronoField;
@@ -82,7 +86,7 @@
     @Test
     public void test_chronoPackageExample() {
         // Print the Thai Buddhist date
-        ChronoLocalDate<?> now1 = Chronology.of("ThaiBuddhist").dateNow();
+        ChronoLocalDate now1 = Chronology.of("ThaiBuddhist").dateNow();
         int day = now1.get(ChronoField.DAY_OF_MONTH);
         int dow = now1.get(ChronoField.DAY_OF_WEEK);
         int month = now1.get(ChronoField.MONTH_OF_YEAR);
@@ -93,15 +97,15 @@
         // Enumerate the list of available calendars and print today for each
         Set<Chronology> chronos = Chronology.getAvailableChronologies();
         for (Chronology chrono : chronos) {
-            ChronoLocalDate<?> date = chrono.dateNow();
+            ChronoLocalDate date = chrono.dateNow();
             System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
         }
 
         // Print today's date and the last day of the year for the Thai Buddhist Calendar.
-        ChronoLocalDate<?> first = now1
+        ChronoLocalDate first = now1
                 .with(ChronoField.DAY_OF_MONTH, 1)
                 .with(ChronoField.MONTH_OF_YEAR, 1);
-        ChronoLocalDate<?> last = first
+        ChronoLocalDate last = first
                 .plus(1, ChronoUnit.YEARS)
                 .minus(1, ChronoUnit.DAYS);
         System.out.printf("  %s: 1st of year: %s; end of year: %s%n", last.getChronology().getId(),
@@ -137,7 +141,7 @@
         // Enumerate the list of available calendars and print today for each
         Set<Chronology> chronos = Chronology.getAvailableChronologies();
         for (Chronology chrono : chronos) {
-            ChronoLocalDate<?> date = chrono.dateNow();
+            ChronoLocalDate date = chrono.dateNow();
             System.out.printf("   %20s: %s%n", chrono.getId(), date.toString());
         }
 
@@ -161,11 +165,31 @@
                 first, last);
     }
 
+    void HijrahExample1() {
+        HijrahDate hd2 = HijrahChronology.INSTANCE.date(1200, 1, 1);
+
+        ChronoLocalDateTime<HijrahDate> hdt = hd2.atTime(LocalTime.MIDNIGHT);
+        ChronoZonedDateTime<HijrahDate> zhdt = hdt.atZone(ZoneId.of("GMT"));
+        HijrahDate hd3 = zhdt.toLocalDate();
+        ChronoLocalDateTime<HijrahDate> hdt2 = zhdt.toLocalDateTime();
+        HijrahDate hd4 = hdt2.toLocalDate();
+
+        HijrahDate hd5 = next(hd2);
+    }
+
+    void test_unknownChronologyWithDateTime() {
+        ChronoLocalDate date = LocalDate.now();
+        ChronoLocalDateTime<?> cldt = date.atTime(LocalTime.NOON);
+        ChronoLocalDate ld = cldt.toLocalDate();
+        ChronoLocalDateTime<?> noonTomorrow = tomorrowNoon(ld);
+    }
+
     @Test
     public void test_library() {
         HijrahDate date = HijrahDate.now();
         HijrahDate next = next(date);
         ChronoLocalDateTime<HijrahDate> noonTomorrow = tomorrowNoon(date);
+        HijrahDate hd3 = noonTomorrow.toLocalDate();
         System.out.printf("  now: %s, noon tomorrow: %s%n", date, noonTomorrow);
     }
 
@@ -175,8 +199,9 @@
      * @param date a specific date extending ChronoLocalDate
      * @return a new date in the same chronology.
      */
-    private <D extends ChronoLocalDate<D>> D next(D date) {
-        return date.plus(1, ChronoUnit.DAYS);
+    @SuppressWarnings("unchecked")
+    private <D extends ChronoLocalDate> D next(D date) {
+        return (D) date.plus(1, ChronoUnit.DAYS);
     }
 
     /**
@@ -186,7 +211,8 @@
      * @param date a specific date extending ChronoLocalDate
      * @return a [@code ChronoLocalDateTime<D>} using the change chronology.
      */
-    private <D extends ChronoLocalDate<D>> ChronoLocalDateTime<D> tomorrowNoon(D date) {
-        return date.plus(1, ChronoUnit.DAYS).atTime(LocalTime.of(12, 0));
+    @SuppressWarnings("unchecked")
+    private <D extends ChronoLocalDate> ChronoLocalDateTime<D> tomorrowNoon(D date) {
+        return (ChronoLocalDateTime<D>) date.plus(1, ChronoUnit.DAYS).atTime(LocalTime.of(12, 0));
     }
 }
--- a/jdk/test/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -61,12 +61,15 @@
 import java.time.LocalDate;
 import java.time.LocalTime;
 import java.time.OffsetDateTime;
+import java.time.ZonedDateTime;
 import java.time.ZoneOffset;
 import java.time.chrono.JapaneseChronology;
+import java.time.chrono.JapaneseEra;
 import java.time.chrono.JapaneseDate;
 import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
 import java.util.Calendar;
+import java.util.GregorianCalendar;
 import java.util.Locale;
 import java.util.TimeZone;
 
@@ -85,7 +88,7 @@
     @DataProvider(name="RangeVersusCalendar")
     Object[][] provider_rangeVersusCalendar() {
         return new Object[][] {
-            {LocalDate.of(1868, 1, 1), LocalDate.of(2100, 1, 1)},
+            {LocalDate.of(1873, 1, 1), LocalDate.of(2100, 1, 1)},
         };
     }
 
@@ -118,4 +121,32 @@
         }
     }
 
+    //-----------------------------------------------------------------------
+    // Verify  Japanese Calendar matches java.util.Calendar for number of days
+    // in years 1 and 2.
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_dayOfYearVsCalendar() {
+        Locale locale = Locale.forLanguageTag("ja-JP-u-ca-japanese");
+        Calendar cal = java.util.Calendar.getInstance(locale);
+
+        for (JapaneseEra era : JapaneseEra.values()) {
+            for (int year : new int[] {6, 7}) {
+                JapaneseDate jd = JapaneseChronology.INSTANCE.dateYearDay(era, year, 1);
+                OffsetDateTime jodt = OffsetDateTime.of(LocalDate.from(jd), LocalTime.MIN, ZoneOffset.UTC);
+                long millis = jodt.toInstant().toEpochMilli();
+                cal.setTimeZone(TimeZone.getTimeZone("GMT+00"));
+                cal.setTimeInMillis(millis);
+
+                assertEquals(jd.get(ChronoField.DAY_OF_YEAR), cal.get(Calendar.DAY_OF_YEAR),
+                        "different DAY_OF_YEAR values in " + era + ", year: " + year);
+                assertEquals(jd.range(ChronoField.DAY_OF_YEAR).getMaximum(), cal.getActualMaximum(Calendar.DAY_OF_YEAR),
+                        "different maximum for DAY_OF_YEAR in " + era + ", year: " + year);
+                assertEquals(jd.range(ChronoField.DAY_OF_YEAR).getMinimum(), cal.getActualMinimum(Calendar.DAY_OF_YEAR),
+                        "different minimum for DAY_OF_YEAR in " + era + ",  year: " + year);
+            }
+        }
+
+    }
+
 }
--- a/jdk/test/java/time/test/java/time/chrono/TestJapaneseChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/chrono/TestJapaneseChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -47,9 +47,6 @@
     Object[][] transitionData() {
         return new Object[][] {
             // Japanese era, yearOfEra, month, dayOfMonth, gregorianYear
-            { JapaneseEra.SEIREKI, Year.MIN_VALUE, 1, 1, Year.MIN_VALUE },
-            { JapaneseEra.SEIREKI, 1867, 12, 31, 1867 },
-            { JapaneseEra.MEIJI,      1,  1, 25, 1868 }, // Note: the dates of Meiji 1 to 5 are incorrect
             { JapaneseEra.MEIJI,      6,  1,  1, 1873 },
             // Meiji-Taisho transition isn't accurate. 1912-07-30 is the last day of Meiji
             // and the first day of Taisho.
@@ -84,9 +81,10 @@
     Object[][] rangeData() {
         return new Object[][] {
             // field, minSmallest, minLargest, maxSmallest, maxLargest
-            { ChronoField.ERA,         -999, -999, 2, 2},
-            { ChronoField.YEAR_OF_ERA, -999999999, 1, 15, 999999999-1989 }, // depends on the current era
+            { ChronoField.ERA,         -1, -1, 2, 2},
+            { ChronoField.YEAR_OF_ERA, 1, 1, 15, 999999999-1989 }, // depends on the current era
             { ChronoField.DAY_OF_YEAR, 1, 1, 7, 366},
+            { ChronoField.YEAR, 1873, 1873, 999999999, 999999999},
         };
     }
 
@@ -94,9 +92,6 @@
     Object[][] invalidDatesData() {
         return new Object[][] {
             // Japanese era, yearOfEra, month, dayOfMonth
-            { JapaneseEra.SEIREKI, Year.MIN_VALUE - 1, 1, 1 },
-            { JapaneseEra.SEIREKI, 1855,  2, 29 },
-            { JapaneseEra.SEIREKI, 1868,  1, 25 },
             { JapaneseEra.MEIJI,      6,  2, 29 },
             { JapaneseEra.MEIJI,     45,  7, 30 },
             { JapaneseEra.MEIJI,     46,  1,  1 },
@@ -118,8 +113,6 @@
     Object[][] invalidEraYearData() {
         return new Object[][] {
             // Japanese era, yearOfEra
-            { JapaneseEra.SEIREKI, Year.MIN_VALUE - 1 },
-            { JapaneseEra.SEIREKI, 2012 },
             { JapaneseEra.MEIJI,     -1 },
             { JapaneseEra.MEIJI,      0 },
             { JapaneseEra.MEIJI,     46 },
--- a/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java	Tue Aug 06 16:54:56 2013 -0700
@@ -28,27 +28,57 @@
 import static java.time.temporal.ChronoField.DAY_OF_MONTH;
 import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
 import static java.time.temporal.ChronoField.YEAR;
+import static java.time.temporal.ChronoField.DAY_OF_YEAR;
 import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
 
 import java.time.DateTimeException;
+import java.time.DayOfWeek;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.OffsetDateTime;
+import java.time.Period;
+import java.time.ZoneId;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.chrono.ChronoLocalDate;
+import java.time.chrono.ChronoLocalDateTime;
+import java.time.chrono.ChronoZonedDateTime;
 import java.time.chrono.Chronology;
 import java.time.chrono.HijrahChronology;
 import java.time.chrono.HijrahDate;
+import java.time.chrono.JapaneseChronology;
+import java.time.chrono.JapaneseDate;
+import java.time.chrono.MinguoChronology;
+import java.time.chrono.MinguoDate;
+import java.time.chrono.ThaiBuddhistChronology;
+import java.time.chrono.ThaiBuddhistDate;
+import java.time.format.DateTimeFormatter;
+import java.time.format.FormatStyle;
 import java.time.temporal.ChronoField;
 import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalAccessor;
+import java.time.temporal.TemporalAdjuster;
 import java.time.temporal.ValueRange;
+import java.time.temporal.WeekFields;
+import java.util.Locale;
 
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 /**
- * Tests for the Umm alQura chronology and data
+ * Tests for the Umm alQura chronology and data.
+ * Note: The dates used for testing are just a sample of calendar data.
  */
 @Test
 public class TestUmmAlQuraChronology {
 
+    private static final ZoneOffset OFFSET_PTWO = ZoneOffset.ofHours(2);
+    private static final ZoneId ZONE_RIYADH = ZoneId.of("Asia/Riyadh");
+
+    // Test for HijrahChronology Aliases
     @Test
     public void test_aliases() {
         HijrahChronology hc = (HijrahChronology) Chronology.of("Hijrah");
@@ -57,49 +87,43 @@
         assertEquals(hc, HijrahChronology.INSTANCE, "Alias for Hijrah-umalqura");
     }
 
-    //-----------------------------------------------------------------------
-    // regular data factory for Umm alQura dates and the corresponding ISO dates
-    //-----------------------------------------------------------------------
-    @DataProvider(name = "UmmalQuraVsISODates")
-    Object[][] data_of_ummalqura() {
-        return new Object[][]{
-
-            //{1318, 01, 01,   1900, 04, 30},
-            //{1318, 01, 02,   1900, 05, 01},
+    // Test to check if the exception is thrown for an incorrect chronology id
+    @Test(expectedExceptions=DateTimeException.class)
+    public void test_badChronology() {
+        Chronology test = Chronology.of("Hijrah-ummalqura");
+    }
 
-            //{1318, 12, 29,   1901, 04, 18},
-            //{1319, 01, 01,   1901, 04, 19},
-
-            //{1433, 12, 29,   2012, 11, 14},
-            //{1434, 01, 01,   2012, 11, 15},
-
-            {1434, 02, 18,   2012, 12, 31},
-            {1434, 02, 19,   2013, 01, 01},
-
-            //{1502, 12, 30,   2079, 10, 25},
-            // not in Umm alQura data {1503, 01, 01,   2079, 10, 26},
-
-            // not in Umm alQura data {1503, 06, 28,   2080, 04, 18},
-            // not in Umm alQura data ~/ws/Downloads
+    //--------------------------------------------------------------------------
+    // regular data factory for Umm alQura dates and the corresponding ISO dates
+    //--------------------------------------------------------------------------
+    @DataProvider(name = "UmmAlQuraVsISODates")
+    Object[][] data_UmmAlQuraVsISODates() {
+        return new Object[][] {
+            {HijrahDate.of(1318, 1, 1), LocalDate.of(1900, 04, 30)},
+            {HijrahDate.of(1318, 12, 29), LocalDate.of(1901, 04, 19)},
+            {HijrahDate.of(1319, 01, 01), LocalDate.of(1901, 04, 20)},
+            {HijrahDate.of(1433, 12, 29), LocalDate.of(2012, 11, 14)},
+            {HijrahDate.of(1434, 01, 01), LocalDate.of(2012, 11, 15)},
+            {HijrahDate.of(1434, 02, 18), LocalDate.of(2012, 12, 31)},
+            {HijrahDate.of(1502, 12, 29), LocalDate.of(2079, 10, 25)},
         };
     }
 
-    @Test(dataProvider="UmmalQuraVsISODates")
-        public void Test_UmmAlQuraDatesVsISO(int h_year, int h_month, int h_day, int iso_year, int iso_month, int iso_day) {
-        HijrahDate hd = HijrahDate.of(h_year, h_month, h_day);
-        LocalDate ld = LocalDate.of(iso_year, iso_month, iso_day);
+    // Test to verify the epoch days for given Hijrah & ISO date instances
+    @Test(dataProvider="UmmAlQuraVsISODates")
+        public void Test_UmmAlQuraVsISODates(HijrahDate hd, LocalDate ld) {
         assertEquals(hd.toEpochDay(), ld.toEpochDay(), "Umm alQura date and ISO date should have same epochDay");
     }
 
-
+    // UmmAlQura chronology ranges for year, month and days for the HijrahChronology
     @Test
     public void Test_UmmAlQuraChronoRange() {
         HijrahChronology chrono = HijrahChronology.INSTANCE;
         ValueRange year = chrono.range(YEAR);
-        assertEquals(year.getMinimum(), 1432, "Minimum year");
-        assertEquals(year.getLargestMinimum(), 1432, "Largest minimum year");
-        assertEquals(year.getMaximum(), 1435, "Largest year");
-        assertEquals(year.getSmallestMaximum(), 1435, "Smallest Maximum year");
+        assertEquals(year.getMinimum(), 1300, "Minimum year");
+        assertEquals(year.getLargestMinimum(), 1300, "Largest minimum year");
+        assertEquals(year.getMaximum(), 1600, "Largest year");
+        assertEquals(year.getSmallestMaximum(), 1600, "Smallest Maximum year");
 
         ValueRange month = chrono.range(MONTH_OF_YEAR);
         assertEquals(month.getMinimum(), 1, "Minimum month");
@@ -118,13 +142,17 @@
     // regular data factory for dates and the corresponding range values
     //-----------------------------------------------------------------------
     @DataProvider(name = "dates")
-    Object[][] data_of_calendars() {
+    Object[][] data_dates() {
         return new Object[][]{
-            {HijrahDate.of(1434, 5, 1), 1432, 1435, 1, 12, 1, 29, 30},
-            {HijrahDate.of(1434, 6, 1), 1432, 1435, 1, 12, 1, 30, 30},
+            {HijrahDate.of(1300, 5, 1), 1300, 1600, 1, 12, 1, 30, 30},
+            {HijrahDate.of(1300, 6, 1), 1300, 1600, 1, 12, 1, 29, 30},
+            {HijrahDate.of(1434, 12, 1), 1300, 1600, 1, 12, 1, 29, 30},
+            {HijrahDate.of(1500, 4, 1), 1300, 1600, 1, 12, 1, 30, 30},
+            {HijrahDate.of(1600, 6, 1), 1300, 1600, 1, 12, 1, 29, 30},
         };
     }
 
+    // Test to verify the min/max field ranges for given dates
     @Test(dataProvider="dates")
     public void Test_UmmAlQuraRanges(HijrahDate date,
                         int minYear, int maxYear,
@@ -163,6 +191,7 @@
 
     }
 
+    // Check the date limits
     @Test
     public void test_hijrahDateLimits() {
         HijrahChronology chrono = HijrahChronology.INSTANCE;
@@ -193,33 +222,547 @@
         }
     }
 
-    @DataProvider(name="badDates")
-    Object[][] data_badDates() {
+    // Data provider to verify the dateYearDay() method
+    @DataProvider(name="dateYearDay")
+    Object[][] data_dateYearDay() {
         return new Object[][] {
-            {1317, 12, 29},
-            {1317, 12, 30},
+            {HijrahChronology.INSTANCE.dateYearDay(1434, 42), HijrahChronology.INSTANCE.date(1434, 02, 13)},
+            {HijrahChronology.INSTANCE.dateYearDay(1330, 354), HijrahChronology.INSTANCE.date(1330, 12, 29)},
+            {HijrahChronology.INSTANCE.dateYearDay(1600, 1), HijrahChronology.INSTANCE.date(1600, 1, 1)},
+            {HijrahChronology.INSTANCE.dateYearDay(1400, 175), HijrahChronology.INSTANCE.date(1400, 6, 28)},
+            {HijrahChronology.INSTANCE.dateYearDay(1520, 190), HijrahChronology.INSTANCE.date(1520, 7, 13)},
+            {HijrahChronology.INSTANCE.dateYearDay(1521, 112), HijrahChronology.INSTANCE.date(1521, 4, 25)},
+        };
+    }
+
+    // Test to verify the dateYearDay() method
+    @Test(dataProvider="dateYearDay")
+    public void test_DateYearDay(ChronoLocalDate date1,   ChronoLocalDate date2) {
+       assertEquals(date1, date2);
+    }
+
+    //-----------------------------------------------------------------------
+    // HijrahDate.with(DAY_OF_YEAR, n)
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_getDayOfYear() {
+        HijrahDate hd1 = HijrahChronology.INSTANCE.dateYearDay(1434, 1);
+        for (int i = 1; i <= hd1.lengthOfYear(); i++) {
+            HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, i);
+            int doy = hd.get(DAY_OF_YEAR);
+            assertEquals(doy, i, "get(DAY_OF_YEAR) incorrect for " + i);
+        }
+    }
+
+    @Test
+    public void test_withDayOfYear() {
+        HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1434, 1);
+        for (int i = 1; i <= hd.lengthOfYear(); i++) {
+            HijrahDate hd2 = hd.with(DAY_OF_YEAR, i);
+            int doy = hd2.get(DAY_OF_YEAR);
+            assertEquals(doy, i, "with(DAY_OF_YEAR) incorrect for " + i + " " + hd2);
+        }
+    }
+
+    @Test(expectedExceptions=java.time.DateTimeException.class)
+    public void test_withDayOfYearTooSmall() {
+        HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1435, 1);
+        HijrahDate hd2 = hd.with(DAY_OF_YEAR, 0);
+    }
+
+    @Test(expectedExceptions=java.time.DateTimeException.class)
+    public void test_withDayOfYearTooLarge() {
+        HijrahDate hd = HijrahChronology.INSTANCE.dateYearDay(1435, 1);
+        HijrahDate hd2 = hd.with(DAY_OF_YEAR, hd.lengthOfYear() + 1);
+    }
+
+    // Test to verify the with() method with ChronoField is set to DAY_OF_WEEK
+    @Test
+    public void test_adjustWithDayOfWeek() {
+        assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_WEEK, 4), HijrahDate.of(1320, 1, 15));
+        assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_WEEK, 1), HijrahDate.of(1421, 11, 11));
+        assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_WEEK, 6), HijrahDate.of(1529, 7, 20));
+        assertEquals(HijrahChronology.INSTANCE.date(1534, 2, 10).with(ChronoField.DAY_OF_WEEK, 5), HijrahDate.of(1534, 2, 12));
+        assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_WEEK, 2), HijrahDate.of(1552, 3, 26));
+    }
+
+    // Test to verify the with() method with ChronoField is set to DAY_OF_MONTH
+    @Test
+    public void test_adjustWithDayOfMonth() {
+        assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_MONTH, 2), HijrahDate.of(1320, 1, 2));
+        assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_MONTH, 9), HijrahDate.of(1421, 11, 9));
+        assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_MONTH, 13), HijrahDate.of(1529, 7, 13));
+        assertEquals(HijrahChronology.INSTANCE.date(1534, 12, 10).with(ChronoField.DAY_OF_MONTH, 29), HijrahDate.of(1534, 12, 29));
+        assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_MONTH, 6), HijrahDate.of(1552, 4, 6));
+    }
+
+    // Test to verify the with() method with ChronoField is set to DAY_OF_YEAR
+    @Test
+    public void test_adjustWithDayOfYear() {
+        assertEquals(HijrahChronology.INSTANCE.date(1320, 1, 15).with(ChronoField.DAY_OF_YEAR, 24), HijrahDate.of(1320, 1, 24));
+        assertEquals(HijrahChronology.INSTANCE.date(1421, 11, 15).with(ChronoField.DAY_OF_YEAR, 135), HijrahDate.of(1421, 5, 18));
+        assertEquals(HijrahChronology.INSTANCE.date(1529, 7, 18).with(ChronoField.DAY_OF_YEAR, 64), HijrahDate.of(1529, 3, 5));
+        assertEquals(HijrahChronology.INSTANCE.date(1534, 2, 10).with(ChronoField.DAY_OF_YEAR, 354), HijrahDate.of(1534, 12, 29));
+        assertEquals(HijrahChronology.INSTANCE.date(1552, 4, 1).with(ChronoField.DAY_OF_YEAR, 291), HijrahDate.of(1552, 10, 26));
+    }
+
+    // Data provider to get the difference between two dates in terms of days, months and years
+    @DataProvider(name="datesForDiff")
+    Object[][] data_datesForDiffs() {
+        return new Object[][] {
+            {HijrahDate.of(1350, 5, 15), HijrahDate.of(1351, 12, 29), 574, 19, 1},
+            {HijrahDate.of(1434, 5, 1), HijrahDate.of(1434,6, 12), 40, 1, 0},
+            {HijrahDate.of(1436, 1, 1), HijrahDate.of(1475, 12, 29), 14173, 479, 39},
+            {HijrahDate.of(1500, 6, 12), HijrahDate.of(1551, 7, 12), 18102, 613, 51},
+            {HijrahDate.of(1550, 3, 11), HijrahDate.of(1551, 4, 11), 384, 13, 1},
+        };
+    }
+
+    // Test to verify the difference between two given dates in terms of days, months and years
+    @Test(dataProvider="datesForDiff")
+    public void test_diffBetweenDates(ChronoLocalDate from, ChronoLocalDate to, long days, long months, long years) {
+          assertEquals(from.until(to, ChronoUnit.DAYS), days);
+          assertEquals(from.until(to, ChronoUnit.MONTHS), months);
+          assertEquals(from.until(to, ChronoUnit.YEARS), years);
+    }
+
+    // Data provider to get the difference between two dates as a period
+    @DataProvider(name="datesForPeriod")
+    Object[][] data_Period() {
+        return new Object[][] {
+            {HijrahDate.of(1350, 5, 15), HijrahDate.of(1434, 7, 20), Period.of(84, 2, 5)},
+            {HijrahDate.of(1403, 5, 28), HijrahDate.of(1434, 7, 20), Period.of(31, 1, 22)},
+            {HijrahDate.of(1434, 7, 20), HijrahDate.of(1484, 2, 15), Period.of(49, 6, 24)},
+            {HijrahDate.of(1500, 6, 12), HijrahDate.of(1450, 4, 21), Period.of(-50, -1, -20)},
+            {HijrahDate.of(1549, 3, 11), HijrahDate.of(1550, 3, 10), Period.of(0, 11, 28)},
+        };
+    }
+
+    // Test to get the Period between two given dates
+    @Test(dataProvider="datesForPeriod")
+    public void test_until(HijrahDate h1, HijrahDate h2, Period p) {
+        Period period = h1.until(h2);
+        assertEquals(period, p);
+    }
 
-            {1320, 1, 29 + 1},
-            {1320, 2, 30 + 1},
-            {1320, 3, 29 + 1},
-            {1320, 4, 29 + 1},
-            {1320, 5, 30 + 1},
-            {1320, 6, 29 + 1},
-            {1320, 7, 30 + 1},
-            {1320, 8, 30 + 1},
-            {1320, 9, 29 + 1},
-            {1320, 10, 30 + 1},
-            {1320, 11, 30 + 1},
-            {1320, 12, 30 + 1},
+    // Test to get the Period between dates in different chronologies
+    @Test(dataProvider="datesForPeriod")
+    public void test_periodUntilDiffChrono(HijrahDate h1, HijrahDate h2, Period p) {
+        MinguoDate m = MinguoChronology.INSTANCE.date(h2);
+        Period period = h1.until(m);
+        assertEquals(period, p);
+    }
+
+    // Test to get the adjusted date from a given date using TemporalAdjuster methods
+    @Test
+    public void test_temporalDayAdjustments() {
+        HijrahDate date = HijrahDate.of(1554, 7, 21);
+        assertEquals(date.with(TemporalAdjuster.firstDayOfMonth()), HijrahDate.of(1554, 7, 1));
+        assertEquals(date.with(TemporalAdjuster.lastDayOfMonth()), HijrahDate.of(1554, 7, 29));
+        assertEquals(date.with(TemporalAdjuster.firstDayOfNextMonth()), HijrahDate.of(1554, 8, 1));
+        assertEquals(date.with(TemporalAdjuster.firstDayOfNextYear()), HijrahDate.of(1555, 1, 1));
+        assertEquals(date.with(TemporalAdjuster.firstDayOfYear()), HijrahDate.of(1554, 1, 1));
+        assertEquals(date.with(TemporalAdjuster.lastDayOfYear()), HijrahDate.of(1554, 12, 30));
+    }
+
+    // Data provider for string representation of the date instances
+    @DataProvider(name="toString")
+    Object[][] data_toString() {
+        return new Object[][] {
+            {HijrahChronology.INSTANCE.date(1320, 1, 1), "Hijrah-umalqura AH 1320-01-01"},
+            {HijrahChronology.INSTANCE.date(1500, 10, 28), "Hijrah-umalqura AH 1500-10-28"},
+            {HijrahChronology.INSTANCE.date(1500, 10, 29), "Hijrah-umalqura AH 1500-10-29"},
+            {HijrahChronology.INSTANCE.date(1434, 12, 5), "Hijrah-umalqura AH 1434-12-05"},
+            {HijrahChronology.INSTANCE.date(1434, 12, 6), "Hijrah-umalqura AH 1434-12-06"},
+        };
+    }
+
+    // Test to verify the returned string value of a given date instance
+    @Test(dataProvider="toString")
+    public void test_toString(ChronoLocalDate hijrahDate, String expected) {
+        assertEquals(hijrahDate.toString(), expected);
+    }
+
+    // Data provider for maximum number of days
+    @DataProvider(name="monthDays")
+    Object[][] data_monthDays() {
+        return new Object[][] {
+            {1432, 1, 29},
+            {1432, 4, 30},
+            {1433, 12, 29},
+            {1434, 1, 29},
+            {1435, 8, 29},
+            {1435, 9, 30},
+        };
+    }
+
+    // Test to verify the maximum number of days by adding one month to a given date
+    @Test (dataProvider="monthDays")
+    public void test_valueRange_monthDays(int year, int month, int maxlength) {
+        ChronoLocalDate date = HijrahChronology.INSTANCE.date(year, month, 1);
+        ValueRange range = null;
+        for (int i=1; i<=12; i++) {
+            range = date.range(ChronoField.DAY_OF_MONTH);
+            date = date.plus(1, ChronoUnit.MONTHS);
+            assertEquals(range.getMaximum(), month, maxlength);
+        }
+    }
+
+    // Test to get the last day of the month by adjusting the date with lastDayOfMonth() method
+    @Test(dataProvider="monthDays")
+    public void test_lastDayOfMonth(int year, int month, int numDays) {
+        HijrahDate hDate = HijrahChronology.INSTANCE.date(year, month, 1);
+        hDate = hDate.with(TemporalAdjuster.lastDayOfMonth());
+        assertEquals(hDate.get(ChronoField.DAY_OF_MONTH), numDays);
+    }
+
+    // Data provider for the 12 islamic month names in a formatted date
+    @DataProvider(name="patternMonthNames")
+    Object[][] data_patternMonthNames() {
+        return new Object[][] {
+            {1434, 1, 1, "01 AH Thu Muharram 1434"},
+            {1434, 2, 1, "01 AH Fri Safar 1434"},
+            {1434, 3, 1, "01 AH Sun Rabi\u02bb I 1434"},//the actual month name is Rabi Al-Awwal, but the locale data contains short form.
+            {1434, 4, 1, "01 AH Mon Rabi\u02bb II 1434"},//the actual month name is Rabi Al-Akhar, but the locale data contains short form.
+            {1434, 5, 1, "01 AH Wed Jumada I 1434"},//the actual month name is Jumada Al-Awwal, but the locale data contains short form.
+            {1434, 6, 1, "01 AH Thu Jumada II 1434"},//the actual month name is Jumada Al-Akhar, but the locale data contains short form.
+            {1434, 7, 1, "01 AH Sat Rajab 1434"},
+            {1434, 8, 1, "01 AH Mon Sha\u02bbban 1434"},
+            {1434, 9, 1, "01 AH Tue Ramadan 1434"},
+            {1434, 10, 1, "01 AH Thu Shawwal 1434"},
+            {1434, 11, 1, "01 AH Sat Dhu\u02bbl-Qi\u02bbdah 1434"},
+            {1434, 12, 1, "01 AH Sun Dhu\u02bbl-Hijjah 1434"},
+        };
+    }
+
+    // Test to verify the formatted dates
+    @Test(dataProvider="patternMonthNames")
+    public void test_ofPattern(int year, int month, int day, String expected) {
+        DateTimeFormatter test = DateTimeFormatter.ofPattern("dd G E MMMM yyyy");
+        assertEquals(test.format(HijrahDate.of(year, month, day)), expected);
+    }
+
+    // Data provider for localized dates
+    @DataProvider(name="chronoDateTimes")
+    Object[][] data_chronodatetimes() {
+        return new Object[][] {
+            {1432, 12, 29, "Safar 1, 1434 AH"},
+            {1433, 1, 30, "Safar 30, 1434 AH"},
+            {1434, 6, 30, "Rajab 30, 1435 AH"},
+        };
+    }
+
+    // Test to verify the localized dates using ofLocalizedDate() method
+    @Test(dataProvider="chronoDateTimes")
+    public void test_formatterOfLocalizedDate(int year, int month, int day, String expected) {
+        HijrahDate hd = HijrahChronology.INSTANCE.date(year, month, day);
+        ChronoLocalDateTime<HijrahDate> hdt = hd.atTime(LocalTime.NOON);
+        hdt = hdt.plus(1, ChronoUnit.YEARS);
+        hdt = hdt.plus(1, ChronoUnit.MONTHS);
+        hdt = hdt.plus(1, ChronoUnit.DAYS);
+        hdt = hdt.plus(1, ChronoUnit.HOURS);
+        hdt = hdt.plus(1, ChronoUnit.MINUTES);
+        hdt = hdt.plus(1, ChronoUnit.SECONDS);
+        DateTimeFormatter df = DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG).withChronology(Chronology.of("Hijrah-umalqura")).withLocale(Locale.forLanguageTag("en-US"));
+        assertEquals(df.format(hdt), expected);
+    }
+
+    // Data provider to get the day of the week in a given date
+    // The day of the week varies if the week starts with a saturday or sunday
+    @DataProvider(name="dayOfWeek")
+    Object[][] data_dayOfweek() {
+        return new Object[][] {
+            {HijrahDate.of(1434, 6, 24), 1, 7},
+            {HijrahDate.of(1432, 9, 3), 5, 4},
+            {HijrahDate.of(1334, 12, 29), 7, 6},
+            {HijrahDate.of(1354, 5, 24), 1, 7},
+            {HijrahDate.of(1465, 10, 2), 2, 1},
         };
     }
 
-    @Test(dataProvider="badDates", expectedExceptions=DateTimeException.class)
-    public void test_badDates(int year, int month, int dom) {
-        HijrahChronology.INSTANCE.date(year, month, dom);
+    // Test to get the day of the week based on a Saturday/Sunday as the first day of the week
+    @Test(dataProvider="dayOfWeek")
+    public void test_dayOfWeek(HijrahDate date, int satStart, int sunStart) {
+        assertEquals(date.get(WeekFields.of(DayOfWeek.SATURDAY, 7).dayOfWeek()), satStart);
+        assertEquals(date.get(WeekFields.of(DayOfWeek.SUNDAY, 7).dayOfWeek()), sunStart);
+    }
+
+    // Data sample to get the epoch days of a date instance
+    @DataProvider(name="epochDays")
+    Object[][] data_epochdays() {
+        return new Object[][] {
+            {1332, -20486},
+            {1334, -19777},
+            {1336, -19068},
+            {1432, 14950},
+            {1434, 15659},
+            {1534, 51096},
+            {1535, 51450},
+        };
+    }
+
+    // Test to verify the number of epoch days of a date instance
+    @Test(dataProvider="epochDays")
+    public void test_epochDays(int y, long epoch) {
+        HijrahDate date = HijrahDate.of(y, 1, 1);
+        assertEquals(date.toEpochDay(), epoch);
+    }
+
+    // Data provider to verify whether a given hijrah year is a leap year or not
+    @DataProvider(name="leapYears")
+    Object[][] data_leapyears() {
+        return new Object[][] {
+            {1302, true},
+            {1305, false},
+            {1315, false},
+            {1534, false},
+            {1411, true},
+            {1429, false},
+            {1433, true},
+            {1443, true},
+        };
+    }
+
+    // Test to verify whether a given hijrah year is a leap year or not
+    @Test(dataProvider="leapYears")
+    public void test_leapYears(int y, boolean leapyear) {
+        HijrahDate date = HijrahDate.of(y, 1, 1);
+        assertEquals(date.isLeapYear(), leapyear);
+    }
+
+    // Date samples to convert HijrahDate to LocalDate and vice versa
+    @DataProvider(name="samples")
+    Object[][] data_samples() {
+        return new Object[][] {
+            {HijrahChronology.INSTANCE.date(1319, 12, 30), LocalDate.of(1902, 4, 9)},
+            {HijrahChronology.INSTANCE.date(1320, 1, 1), LocalDate.of(1902, 4, 10)},
+            {HijrahChronology.INSTANCE.date(1321, 12, 30), LocalDate.of(1904, 3, 18)},
+            {HijrahChronology.INSTANCE.date(1433, 7, 29), LocalDate.of(2012, 6, 19)},
+            {HijrahChronology.INSTANCE.date(1434, 10, 12), LocalDate.of(2013, 8, 19)},
+            {HijrahChronology.INSTANCE.date(1500, 3, 3), LocalDate.of(2077, 1, 28)},
+        };
+    }
+
+    // Test to get LocalDate instance from a given HijrahDate
+    @Test(dataProvider="samples")
+    public void test_toLocalDate(ChronoLocalDate hijrahDate, LocalDate iso) {
+        assertEquals(LocalDate.from(hijrahDate), iso);
+    }
+
+    // Test to adjust HijrahDate with a given LocalDate
+    @Test(dataProvider="samples")
+    public void test_adjust_toLocalDate(ChronoLocalDate hijrahDate, LocalDate iso) {
+        assertEquals(hijrahDate.with(iso), hijrahDate);
+    }
+
+    // Test to get a HijrahDate from a calendrical
+    @Test(dataProvider="samples")
+    public void test_fromCalendrical(ChronoLocalDate hijrahDate, LocalDate iso) {
+        assertEquals(HijrahChronology.INSTANCE.date(iso), hijrahDate);
+    }
+
+    // Test to verify the day of week of a given HijrahDate and LocalDate
+    @Test(dataProvider="samples")
+    public void test_dayOfWeekEqualIsoDayOfWeek(ChronoLocalDate hijrahDate, LocalDate iso) {
+        assertEquals(hijrahDate.get(ChronoField.DAY_OF_WEEK), iso.get(ChronoField.DAY_OF_WEEK), "Hijrah day of week should be same as ISO day of week");
+    }
+
+    // Test to get the local date by applying the MIN adjustment with hijrah date
+    @Test(dataProvider="samples")
+    public void test_LocalDate_adjustToHijrahDate(ChronoLocalDate hijrahDate, LocalDate localDate) {
+        LocalDate test = LocalDate.MIN.with(hijrahDate);
+        assertEquals(test, localDate);
+    }
+
+    // Test to get the local date time by applying the MIN adjustment with hijrah date
+    @Test(dataProvider="samples")
+    public void test_LocalDateTime_adjustToHijrahDate(ChronoLocalDate hijrahDate, LocalDate localDate) {
+        LocalDateTime test = LocalDateTime.MIN.with(hijrahDate);
+        assertEquals(test, LocalDateTime.of(localDate, LocalTime.MIDNIGHT));
+    }
+
+    // Sample dates for comparison
+    @DataProvider(name="datesForComparison")
+    Object[][] data_datesForComparison() {
+        return new Object[][] {
+            {HijrahChronology.INSTANCE.date(1434, 6, 26), LocalDate.of(2013, 5, 5), -1, 1},
+            {HijrahChronology.INSTANCE.date(1433, 4, 15), LocalDate.of(2012, 3, 15), 1, -1},
+            {HijrahChronology.INSTANCE.date(1432, 5, 21), LocalDate.of(2011, 4, 22), -1, 1},
+            {HijrahChronology.INSTANCE.date(1433, 7, 29), LocalDate.of(2012, 6, 2), -1, 1},
+            {HijrahChronology.INSTANCE.date(1434, 10, 12), LocalDate.of(2013, 8, 2), -1, 1},
+        };
+    }
+
+    // Test to compare dates in both forward and reverse order
+    @Test(dataProvider="datesForComparison")
+    public void test_compareDates(HijrahDate hdate, LocalDate ldate, int result1, int result2) {
+        assertEquals(ldate.compareTo(hdate), result1);
+        assertEquals(hdate.compareTo(ldate), result2);
+    }
+
+    // Test to verify the values of various chrono fields for a given hijrah date instance
+    @Test
+    public void test_chronoFields() {
+        ChronoLocalDate hdate = HijrahChronology.INSTANCE.date(1434, 6, 28);
+        assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), 3);
+        assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), 7);
+        assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_MONTH), 4);
+        assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_YEAR), 25);
+        assertEquals(hdate.get(ChronoField.ERA), 1);
+        assertEquals(hdate.get(ChronoField.YEAR_OF_ERA), 1434);
+        assertEquals(hdate.get(ChronoField.MONTH_OF_YEAR), 6);
+        assertEquals(hdate.get(ChronoField.DAY_OF_MONTH), 28);
+        assertEquals(hdate.get(ChronoField.DAY_OF_WEEK), 3);
+        assertEquals(hdate.get(ChronoField.DAY_OF_YEAR), 175);
     }
 
-    void printRange(ValueRange range, Object obj, ChronoField field) {
-        System.err.printf(" range: min: %d, max: %d; of: %s, field: %s%n", range.getMinimum(), range.getMaximum(), obj.toString(), field.toString());
+    // Test to verify the returned hijrah date after adjusting the day of week as Saturday
+    @Test
+    public void test_adjustInto() {
+        assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1434, 6, 28)), HijrahDate.of(1434, 7, 1));
+        assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1432, 4, 13)), HijrahDate.of(1432, 4, 14));
+        assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1433, 11, 29)), HijrahDate.of(1433, 12, 4));
+        assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1434, 5, 10)), HijrahDate.of(1434, 5, 11));
+        assertEquals(DayOfWeek.SATURDAY.adjustInto(HijrahDate.of(1434, 9, 11)), HijrahDate.of(1434, 9, 12));
+    }
+
+    //-----------------------------------------------------------------------
+    // zonedDateTime(TemporalAccessor)
+    //-----------------------------------------------------------------------
+    @DataProvider(name="zonedDateTime")
+    Object[][] data_zonedDateTime() {
+        return new Object[][] {
+            {ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
+            {OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
+            {LocalDateTime.of(2012, 2, 29, 2, 7), null, null, DateTimeException.class},
+            {JapaneseDate.of(2012, 2, 29), null, null, DateTimeException.class},
+            {ThaiBuddhistDate.of(2012 + 543, 2, 29), null, null, DateTimeException.class},
+            {LocalDate.of(2012, 2, 29), null, null, DateTimeException.class},
+            {LocalTime.of(20, 30, 29, 0), null, null, DateTimeException.class},
+        };
+    }
+
+    // Test to check the zoned date times
+    @Test(dataProvider="zonedDateTime")
+    public void test_zonedDateTime(TemporalAccessor accessor,  HijrahDate expectedDate, LocalTime expectedTime, Class<?> expectedEx) {
+        if (expectedEx == null) {
+            ChronoZonedDateTime<HijrahDate> result = HijrahChronology.INSTANCE.zonedDateTime(accessor);
+            assertEquals(result.toLocalDate(), expectedDate);
+            assertEquals(HijrahDate.from(accessor), expectedDate);
+            assertEquals(result.toLocalTime(), expectedTime);
+
+        } else {
+            try {
+                ChronoZonedDateTime<HijrahDate> result = HijrahChronology.INSTANCE.zonedDateTime(accessor);
+                fail();
+            } catch (Exception ex) {
+                assertTrue(expectedEx.isInstance(ex));
+            }
+        }
+    }
+
+    //-----------------------------------------------------------------------
+    // zonedDateTime(Instant, ZoneId )
+    //-----------------------------------------------------------------------
+    @Test
+    public void test_Instant_zonedDateTime() {
+        OffsetDateTime offsetDateTime = OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO);
+        ZonedDateTime zonedDateTime = ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH);
+
+        ChronoZonedDateTime<HijrahDate> result = HijrahChronology.INSTANCE.zonedDateTime(offsetDateTime.toInstant(), offsetDateTime.getOffset());
+        assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7));
+        assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
+
+        result = HijrahChronology.INSTANCE.zonedDateTime(zonedDateTime.toInstant(), zonedDateTime.getOffset());
+        assertEquals(result.toLocalDate(), HijrahChronology.INSTANCE.date(1433, 4, 7));
+        assertEquals(result.toLocalTime(), LocalTime.of(2, 7, 1, 1));
+    }
+
+    //-----------------------------------------------------------------------
+    // localDateTime()
+    //-----------------------------------------------------------------------
+    @DataProvider(name="localDateTime")
+    Object[][] data_localDateTime() {
+        return new Object[][] {
+            {LocalDateTime.of(2012, 2, 29, 2, 7), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7), null},
+            {ZonedDateTime.of(2012, 2, 29, 2, 7, 1, 1, ZONE_RIYADH), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
+            {OffsetDateTime.of(2012, 2, 29, 2, 7, 1, 1, OFFSET_PTWO), HijrahChronology.INSTANCE.date(1433, 4, 7), LocalTime.of(2, 7, 1, 1), null},
+            {JapaneseDate.of(2012, 2, 29), null, null, DateTimeException.class},
+            {ThaiBuddhistDate.of(2012 + 543, 2, 29), null, null, DateTimeException.class},
+            {LocalDate.of(2012, 2, 29), null, null, DateTimeException.class},
+            {LocalTime.of(20, 30, 29, 0), null, null, DateTimeException.class},
+        };
+    }
+
+    // Test to verify local date time values from various date instances defined in the localDateTime data provider
+    @Test(dataProvider="localDateTime")
+    public void test_localDateTime(TemporalAccessor accessor,  HijrahDate expectedDate, LocalTime expectedTime, Class<?> expectedEx) {
+        if (expectedEx == null) {
+            ChronoLocalDateTime<HijrahDate> result = HijrahChronology.INSTANCE.localDateTime(accessor);
+            assertEquals(result.toLocalDate(), expectedDate);
+            assertEquals(HijrahDate.from(accessor), expectedDate);
+            assertEquals(result.toLocalTime(), expectedTime);
+        } else {
+            try {
+                ChronoLocalDateTime<HijrahDate> result = HijrahChronology.INSTANCE.localDateTime(accessor);
+                fail();
+            } catch (Exception ex) {
+                assertTrue(expectedEx.isInstance(ex));
+            }
+        }
+    }
+
+    // Sample Hijrah & Minguo Dates
+    @DataProvider(name="hijrahToMinguo")
+    Object[][] data_hijrahToMinguo() {
+        return new Object[][] {
+            {HijrahDate.of(1350,5,15), MinguoDate.of(20,9,28)},
+            {HijrahDate.of(1434,5,1), MinguoDate.of(102,3,13)},
+            {HijrahDate.of(1436,1,1), MinguoDate.of(103,10,25)},
+            {HijrahDate.of(1500,6,12), MinguoDate.of(166,5,5)},
+            {HijrahDate.of(1550,3,11), MinguoDate.of(214,8,11)},
+        };
+    }
+
+    // Test to verify the date conversion from Hijrah to Minguo chronology
+    @Test(dataProvider="hijrahToMinguo")
+    public void test_hijrahToMinguo(HijrahDate hijrah, MinguoDate minguo) {
+        assertEquals(MinguoChronology.INSTANCE.date(hijrah), minguo);
+    }
+
+    // Sample Hijrah & Thai Dates
+    @DataProvider(name="hijrahToThai")
+    Object[][] data_hijrahToThai() {
+        return new Object[][] {
+            {HijrahDate.of(1350,5,15), ThaiBuddhistDate.of(2474,9,28)},
+            {HijrahDate.of(1434,5,1), ThaiBuddhistDate.of(2556,3,13)},
+            {HijrahDate.of(1436,1,1), ThaiBuddhistDate.of(2557,10,25)},
+            {HijrahDate.of(1500,6,12), ThaiBuddhistDate.of(2620,5,5)},
+            {HijrahDate.of(1550,3,11), ThaiBuddhistDate.of(2668,8,11)},
+        };
+    }
+
+    // Test to verify the date conversion from Hijrah to Thai chronology
+    @Test(dataProvider="hijrahToThai")
+    public void test_hijrahToThai(HijrahDate hijrah, ThaiBuddhistDate thai) {
+        assertEquals(ThaiBuddhistChronology.INSTANCE.date(hijrah), thai);
+    }
+
+    // Sample Hijrah & Japanese Dates
+    @DataProvider(name="hijrahToJapanese")
+    Object[][] data_hijrahToJapanese() {
+        return new Object[][] {
+            {HijrahDate.of(1350,5,15), "Japanese Showa 6-09-28"},
+            {HijrahDate.of(1434,5,1), "Japanese Heisei 25-03-13"},
+            {HijrahDate.of(1436,1,1), "Japanese Heisei 26-10-25"},
+            {HijrahDate.of(1500,6,12), "Japanese Heisei 89-05-05"},
+            {HijrahDate.of(1550,3,11), "Japanese Heisei 137-08-11"},
+        };
+    }
+
+    // Test to verify the date conversion from Hijrah to Japanese chronology
+    @Test(dataProvider="hijrahToJapanese")
+      public void test_hijrahToJapanese(HijrahDate hijrah, String japanese) {
+          assertEquals(JapaneseChronology.INSTANCE.date(hijrah).toString(), japanese);
     }
 }
--- a/jdk/test/java/time/test/java/time/format/TestDateTimeTextProvider.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/format/TestDateTimeTextProvider.java	Tue Aug 06 16:54:56 2013 -0700
@@ -131,18 +131,18 @@
             {MONTH_OF_YEAR, 11, TextStyle.SHORT, enUS, "Nov"},
             {MONTH_OF_YEAR, 12, TextStyle.SHORT, enUS, "Dec"},
 
-            {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "Jan"},
-            {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "Fev"},
-            {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "Mar"},
-            {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "Abr"},
-            {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "Mai"},
-            {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "Jun"},
-            {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "Jul"},
-            {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "Ago"},
-            {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "Set"},
-            {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "Out"},
-            {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "Nov"},
-            {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "Dez"},
+            {MONTH_OF_YEAR, 1, TextStyle.SHORT, ptBR, "jan"},
+            {MONTH_OF_YEAR, 2, TextStyle.SHORT, ptBR, "fev"},
+            {MONTH_OF_YEAR, 3, TextStyle.SHORT, ptBR, "mar"},
+            {MONTH_OF_YEAR, 4, TextStyle.SHORT, ptBR, "abr"},
+            {MONTH_OF_YEAR, 5, TextStyle.SHORT, ptBR, "mai"},
+            {MONTH_OF_YEAR, 6, TextStyle.SHORT, ptBR, "jun"},
+            {MONTH_OF_YEAR, 7, TextStyle.SHORT, ptBR, "jul"},
+            {MONTH_OF_YEAR, 8, TextStyle.SHORT, ptBR, "ago"},
+            {MONTH_OF_YEAR, 9, TextStyle.SHORT, ptBR, "set"},
+            {MONTH_OF_YEAR, 10, TextStyle.SHORT, ptBR, "out"},
+            {MONTH_OF_YEAR, 11, TextStyle.SHORT, ptBR, "nov"},
+            {MONTH_OF_YEAR, 12, TextStyle.SHORT, ptBR, "dez"},
 
             {MONTH_OF_YEAR, 1, TextStyle.FULL, enUS, "January"},
             {MONTH_OF_YEAR, 2, TextStyle.FULL, enUS, "February"},
--- a/jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/format/TestNonIsoFormatter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -126,7 +126,7 @@
 
     @Test(dataProvider="format_data")
     public void test_formatLocalizedDate(Chronology chrono, Locale formatLocale, Locale numberingLocale,
-                                         ChronoLocalDate<?> date, String expected) {
+                                         ChronoLocalDate date, String expected) {
         DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
             .withChronology(chrono).withLocale(formatLocale)
             .withDecimalStyle(DecimalStyle.of(numberingLocale));
@@ -136,12 +136,12 @@
 
     @Test(dataProvider="format_data")
     public void test_parseLocalizedText(Chronology chrono, Locale formatLocale, Locale numberingLocale,
-                                        ChronoLocalDate<?> expected, String text) {
+                                        ChronoLocalDate expected, String text) {
         DateTimeFormatter dtf = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL)
             .withChronology(chrono).withLocale(formatLocale)
             .withDecimalStyle(DecimalStyle.of(numberingLocale));
         TemporalAccessor temporal = dtf.parse(text);
-        ChronoLocalDate<?> date = chrono.date(temporal);
+        ChronoLocalDate date = chrono.date(temporal);
         assertEquals(date, expected);
     }
 
--- a/jdk/test/java/time/test/java/time/format/TestNumberPrinter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/format/TestNumberPrinter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -191,7 +191,7 @@
             assertEquals(buf.toString(), result);
         } catch (DateTimeException ex) {
             if (result == null || value < 0) {
-                assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
+                assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true);
             } else {
                 throw ex;
             }
@@ -210,7 +210,7 @@
             if (result != null) {
                 throw ex;
             }
-            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
+            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true);
         }
     }
 
@@ -226,7 +226,7 @@
             if (result != null) {
                 throw ex;
             }
-            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
+            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true);
         }
     }
 
@@ -242,7 +242,7 @@
             if (result != null) {
                 throw ex;
             }
-            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
+            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true);
         }
     }
 
@@ -262,7 +262,7 @@
             if (result != null) {
                 throw ex;
             }
-            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.getName()), true);
+            assertEquals(ex.getMessage().contains(DAY_OF_MONTH.toString()), true);
         }
     }
 
--- a/jdk/test/java/time/test/java/time/format/TestReducedPrinter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/format/TestReducedPrinter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -185,7 +185,7 @@
             assertEquals(buf.toString(), result);
         } catch (DateTimeException ex) {
             if (result == null || value < 0) {
-                assertEquals(ex.getMessage().contains(YEAR.getName()), true);
+                assertEquals(ex.getMessage().contains(YEAR.toString()), true);
             } else {
                 throw ex;
             }
--- a/jdk/test/java/time/test/java/time/temporal/MockFieldNoValue.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/temporal/MockFieldNoValue.java	Tue Aug 06 16:54:56 2013 -0700
@@ -77,11 +77,6 @@
     INSTANCE;
 
     @Override
-    public String getName() {
-        return null;
-    }
-
-    @Override
     public TemporalUnit getBaseUnit() {
         return WEEKS;
     }
@@ -96,6 +91,16 @@
         return ValueRange.of(1, 20);
     }
 
+    @Override
+    public boolean isDateBased() {
+        return false;
+    }
+
+    @Override
+    public boolean isTimeBased() {
+        return false;
+    }
+
     //-----------------------------------------------------------------------
     @Override
     public boolean isSupportedBy(TemporalAccessor temporal) {
@@ -117,4 +122,9 @@
         throw new DateTimeException("Mock");
     }
 
+    @Override
+    public String toString() {
+        return null;
+    }
+
 }
--- a/jdk/test/java/time/test/java/time/temporal/MockFieldValue.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/time/test/java/time/temporal/MockFieldValue.java	Tue Aug 06 16:54:56 2013 -0700
@@ -89,7 +89,7 @@
             if (isSupported(field)) {
                 return field.range();
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
--- a/jdk/test/java/util/PriorityQueue/RemoveContains.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/util/PriorityQueue/RemoveContains.java	Tue Aug 06 16:54:56 2013 -0700
@@ -64,6 +64,7 @@
             public int compare(String x, String y) {
                 return x.charAt(0) - y.charAt(0); }};
 
+        test(new PriorityQueue<String>(firstChar));
         test(new PriorityQueue<String>(10, firstChar));
         test(new PriorityBlockingQueue<String>(10, firstChar));
         test(new ArrayBlockingQueue<String>(10));
--- a/jdk/test/java/util/Random/RandomStreamTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/util/Random/RandomStreamTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,23 +25,22 @@
 import org.testng.annotations.Test;
 
 import java.security.SecureRandom;
-import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.ArrayList;
+
 import java.util.Random;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
+import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
-import java.util.stream.IntStream;
-import java.util.stream.LongStream;
-import java.util.stream.DoubleStream;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Supplier;
 import java.util.stream.Stream;
 
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
+import static java.util.stream.Collectors.toList;
+import static java.util.stream.Collectors.toSet;
+import static org.testng.Assert.*;
 
 /**
  * @test
@@ -147,111 +146,43 @@
     }
 
     @Test
-    public void testThreadLocalIntStream() throws InterruptedException {
-        final ExecutorService e = Executors.newFixedThreadPool(10);
-        final ThreadLocalRandom tlr = ThreadLocalRandom.current();
-
-        final class RandomTask implements Runnable {
-            int[] randoms;
-
-            @Override
-            public void run() {
-                randoms = tlr.ints().limit(SIZE).toArray();
-            }
-        }
-        final RandomTask[] tasks = new RandomTask[10];
-        for (int i=0; i < tasks.length; i++) {
-            tasks[i] = new RandomTask();
-        }
-        for (int i=0; i < tasks.length; i++) {
-            e.submit(tasks[i]);
-        }
-        e.shutdown();
-        e.awaitTermination(3, TimeUnit.SECONDS);
-        for (int i=1; i < tasks.length; i++) {
-            assertFalse(Arrays.equals(tasks[0].randoms, tasks[i].randoms));
-        }
+    public void testThreadLocalIntStream() throws InterruptedException, ExecutionException, TimeoutException {
+        ThreadLocalRandom tlr = ThreadLocalRandom.current();
+        testRandomResultSupplierConcurrently(() -> tlr.ints().limit(SIZE).boxed().collect(toList()));
     }
 
     @Test
-    public void testThreadLocalLongStream() throws InterruptedException {
-        final ExecutorService e = Executors.newFixedThreadPool(10);
-        final ThreadLocalRandom tlr = ThreadLocalRandom.current();
-
-        final class RandomTask implements Runnable {
-            long[] randoms;
+    public void testThreadLocalLongStream() throws InterruptedException, ExecutionException, TimeoutException {
+        ThreadLocalRandom tlr = ThreadLocalRandom.current();
+        testRandomResultSupplierConcurrently(() -> tlr.longs().limit(SIZE).boxed().collect(toList()));
+    }
 
-            @Override
-            public void run() {
-                randoms = tlr.longs().limit(SIZE).toArray();
-            }
-        }
-        final RandomTask[] tasks = new RandomTask[10];
-        for (int i=0; i < tasks.length; i++) {
-            tasks[i] = new RandomTask();
-        }
-        for (int i=0; i < tasks.length; i++) {
-            e.submit(tasks[i]);
-        }
-        e.shutdown();
-        e.awaitTermination(3, TimeUnit.SECONDS);
-        for (int i=1; i < tasks.length; i++) {
-            assertFalse(Arrays.equals(tasks[0].randoms, tasks[i].randoms));
-        }
+    @Test
+    public void testThreadLocalDoubleStream() throws InterruptedException, ExecutionException, TimeoutException {
+        ThreadLocalRandom tlr = ThreadLocalRandom.current();
+        testRandomResultSupplierConcurrently(() -> tlr.doubles().limit(SIZE).boxed().collect(toList()));
     }
 
     @Test
-    public void testThreadLocalDoubleStream() throws InterruptedException {
-        final ExecutorService e = Executors.newFixedThreadPool(10);
-        final ThreadLocalRandom tlr = ThreadLocalRandom.current();
-
-        final class RandomTask implements Runnable {
-            double[] randoms;
-
-            @Override
-            public void run() {
-                randoms = tlr.doubles().limit(SIZE).toArray();
-            }
-        }
-        final RandomTask[] tasks = new RandomTask[10];
-        for (int i=0; i < tasks.length; i++) {
-            tasks[i] = new RandomTask();
-        }
-        for (int i=0; i < tasks.length; i++) {
-            e.submit(tasks[i]);
-        }
-        e.shutdown();
-        e.awaitTermination(3, TimeUnit.SECONDS);
-        for (int i=1; i < tasks.length; i++) {
-            assertFalse(Arrays.equals(tasks[0].randoms, tasks[i].randoms));
-        }
+    public void testThreadLocalGaussianStream() throws InterruptedException, ExecutionException, TimeoutException {
+        ThreadLocalRandom tlr = ThreadLocalRandom.current();
+        testRandomResultSupplierConcurrently(() -> tlr.gaussians().limit(SIZE).boxed().collect(toList()));
     }
 
-    @Test
-    public void testThreadLocalGaussianStream() throws InterruptedException {
-        final ExecutorService e = Executors.newFixedThreadPool(10);
-        final ThreadLocalRandom tlr = ThreadLocalRandom.current();
-
-        final class RandomTask implements Runnable {
-            double[] randoms;
+    <T> void testRandomResultSupplierConcurrently(Supplier<T> s) throws InterruptedException, ExecutionException, TimeoutException {
+        // Produce 10 completable future tasks
+        final int tasks = 10;
+        List<CompletableFuture<T>> cfs = Stream.generate(() -> CompletableFuture.supplyAsync(s)).
+                limit(tasks).collect(toList());
 
-            @Override
-            public void run() {
-                randoms = tlr.gaussians().limit(SIZE).toArray();
-            }
-        }
-        final RandomTask[] tasks = new RandomTask[10];
-        for (int i=0; i < tasks.length; i++) {
-            tasks[i] = new RandomTask();
-        }
-        for (int i=0; i < tasks.length; i++) {
-            e.submit(tasks[i]);
-        }
-        e.shutdown();
-        e.awaitTermination(3, TimeUnit.SECONDS);
-        for (int i=1; i < tasks.length; i++) {
-            assertFalse(Arrays.equals(tasks[0].randoms, tasks[i].randoms));
-        }
+        // Wait for all tasks to complete
+        // Timeout is beyond reasonable doubt that completion should
+        // have occurred unless there is an issue
+        CompletableFuture<Void> all = CompletableFuture.allOf(cfs.stream().toArray(CompletableFuture[]::new));
+        all.get(1, TimeUnit.MINUTES);
+
+        // Count the distinct results, which should equal the number of tasks
+        long rc = cfs.stream().map(CompletableFuture::join).distinct().count();
+        assertEquals(rc, tasks);
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Spliterator/SpliteratorCharacteristics.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8020156 8020009
+ * @run testng SpliteratorCharacteristics
+ */
+
+import org.testng.annotations.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Spliterator;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import static org.testng.Assert.*;
+
+@Test
+public class SpliteratorCharacteristics {
+
+    public void testTreeMap() {
+        TreeMap<Integer, String> tm = new TreeMap<>();
+        tm.put(1, "4");
+        tm.put(2, "3");
+        tm.put(3, "2");
+        tm.put(4, "1");
+
+        assertCharacteristics(tm.keySet(),
+                              Spliterator.SIZED | Spliterator.DISTINCT |
+                              Spliterator.SORTED | Spliterator.ORDERED);
+        assertNullComparator(tm.keySet());
+
+        assertCharacteristics(tm.values(),
+                              Spliterator.SIZED | Spliterator.ORDERED);
+        assertISEComparator(tm.values());
+
+        assertCharacteristics(tm.entrySet(),
+                              Spliterator.SIZED | Spliterator.DISTINCT |
+                              Spliterator.SORTED | Spliterator.ORDERED);
+        assertNotNullComparator(tm.entrySet());
+    }
+
+    public void testTreeMapWithComparator() {
+        TreeMap<Integer, String> tm = new TreeMap<>(Comparator.<Integer>reverseOrder());
+        tm.put(1, "4");
+        tm.put(2, "3");
+        tm.put(3, "2");
+        tm.put(4, "1");
+
+        assertCharacteristics(tm.keySet(),
+                              Spliterator.SIZED | Spliterator.DISTINCT |
+                              Spliterator.SORTED | Spliterator.ORDERED);
+        assertNotNullComparator(tm.keySet());
+
+        assertCharacteristics(tm.values(),
+                              Spliterator.SIZED | Spliterator.ORDERED);
+        assertISEComparator(tm.values());
+
+        assertCharacteristics(tm.entrySet(),
+                              Spliterator.SIZED | Spliterator.DISTINCT |
+                              Spliterator.SORTED | Spliterator.ORDERED);
+        assertNotNullComparator(tm.entrySet());
+    }
+
+    public void testTreeSet() {
+        TreeSet<Integer> ts = new TreeSet<>();
+        ts.addAll(Arrays.asList(1, 2, 3, 4));
+
+        assertCharacteristics(ts,
+                              Spliterator.SIZED | Spliterator.DISTINCT |
+                              Spliterator.SORTED | Spliterator.ORDERED);
+        assertNullComparator(ts);
+    }
+
+    public void testTreeSetWithComparator() {
+        TreeSet<Integer> ts = new TreeSet<>(Comparator.reverseOrder());
+        ts.addAll(Arrays.asList(1, 2, 3, 4));
+
+        assertCharacteristics(ts,
+                              Spliterator.SIZED | Spliterator.DISTINCT |
+                              Spliterator.SORTED | Spliterator.ORDERED);
+        assertNotNullComparator(ts);
+    }
+
+
+    void assertCharacteristics(Collection<?> c, int expectedCharacteristics) {
+        assertCharacteristics(c.spliterator(), expectedCharacteristics);
+    }
+
+    void assertCharacteristics(Spliterator<?> s, int expectedCharacteristics) {
+        assertTrue(s.hasCharacteristics(expectedCharacteristics));
+    }
+
+    void assertNullComparator(Collection<?> c) {
+        assertNullComparator(c.spliterator());
+    }
+
+    void assertNullComparator(Spliterator<?> s) {
+        assertNull(s.getComparator());
+    }
+
+    void assertNotNullComparator(Collection<?> c) {
+        assertNotNullComparator(c.spliterator());
+    }
+
+    void assertNotNullComparator(Spliterator<?> s) {
+        assertNotNull(s.getComparator());
+    }
+
+    void assertISEComparator(Collection<?> c) {
+        assertISEComparator(c.spliterator());
+    }
+
+    void assertISEComparator(Spliterator<?> s) {
+        boolean caught = false;
+        try {
+            s.getComparator();
+        }
+        catch (IllegalStateException e) {
+            caught = true;
+        }
+        assertTrue(caught);
+    }
+}
--- a/jdk/test/java/util/StringJoiner/MergeTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/util/StringJoiner/MergeTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8017231
+ * @bug 8017231 8020977
  * @summary test  StringJoiner::merge
  * @run testng MergeTest
  */
@@ -121,4 +121,13 @@
         sj.merge(other);
         assertEquals(sj.toString(), "{a,b,c,d:e:f}");
     }
-}
\ No newline at end of file
+
+    public void testMergeSelf() {
+        final StringJoiner sj = new StringJoiner(",", "[", "]").add("a").add("b");
+        assertEquals(sj.merge(sj).toString(), "[a,b,a,b]");
+        assertEquals(sj.merge(sj).toString(), "[a,b,a,b,a,b,a,b]");
+
+        final StringJoiner sj2 = new StringJoiner(",").add("c").add("d");
+        assertEquals(sj2.merge(sj2).toString(), "c,d,c,d");
+    }
+}
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ConcatOpTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ConcatOpTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -22,6 +22,8 @@
  */
 package org.openjdk.tests.java.util.stream;
 
+import java.util.Spliterator;
+import java.util.stream.BaseStream;
 import java.util.stream.OpTestCase;
 import java.util.stream.StreamTestDataProvider;
 
@@ -34,16 +36,107 @@
 import java.util.stream.TestData;
 
 import static java.util.stream.LambdaTestHelpers.*;
+import static org.testng.Assert.assertEquals;
 
+/**
+ * @test
+ * @bug 8021863
+ */
 public class ConcatOpTest extends OpTestCase {
 
     // Sanity to make sure all type of stream source works
     @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
-    public void testOpsSequential(String name, TestData.OfRef<Integer> data) {
+    public void testOps(String name, TestData.OfRef<Integer> data) {
         exerciseOpsInt(data,
                        s -> Stream.concat(s, data.stream()),
                        s -> IntStream.concat(s, data.stream().mapToInt(Integer::intValue)),
                        s -> LongStream.concat(s, data.stream().mapToLong(Integer::longValue)),
                        s -> DoubleStream.concat(s, data.stream().mapToDouble(Integer::doubleValue)));
     }
+
+    public void testSize() {
+        assertSized(Stream.concat(
+                LongStream.range(0, Long.MAX_VALUE / 2).boxed(),
+                LongStream.range(0, Long.MAX_VALUE / 2).boxed()));
+
+        assertUnsized(Stream.concat(
+                LongStream.range(0, Long.MAX_VALUE).boxed(),
+                LongStream.range(0, Long.MAX_VALUE).boxed()));
+
+        assertUnsized(Stream.concat(
+                LongStream.range(0, Long.MAX_VALUE).boxed(),
+                Stream.iterate(0, i -> i + 1)));
+
+        assertUnsized(Stream.concat(
+                Stream.iterate(0, i -> i + 1),
+                LongStream.range(0, Long.MAX_VALUE).boxed()));
+    }
+
+    public void testLongSize() {
+        assertSized(LongStream.concat(
+                LongStream.range(0, Long.MAX_VALUE / 2),
+                LongStream.range(0, Long.MAX_VALUE / 2)));
+
+        assertUnsized(LongStream.concat(
+                LongStream.range(0, Long.MAX_VALUE),
+                LongStream.range(0, Long.MAX_VALUE)));
+
+        assertUnsized(LongStream.concat(
+                LongStream.range(0, Long.MAX_VALUE),
+                LongStream.iterate(0, i -> i + 1)));
+
+        assertUnsized(LongStream.concat(
+                LongStream.iterate(0, i -> i + 1),
+                LongStream.range(0, Long.MAX_VALUE)));
+    }
+
+    public void testIntSize() {
+        assertSized(IntStream.concat(
+                IntStream.range(0, Integer.MAX_VALUE),
+                IntStream.range(0, Integer.MAX_VALUE)));
+
+        assertUnsized(IntStream.concat(
+                LongStream.range(0, Long.MAX_VALUE).mapToInt(i -> (int) i),
+                LongStream.range(0, Long.MAX_VALUE).mapToInt(i -> (int) i)));
+
+        assertUnsized(IntStream.concat(
+                LongStream.range(0, Long.MAX_VALUE).mapToInt(i -> (int) i),
+                IntStream.iterate(0, i -> i + 1)));
+
+        assertUnsized(IntStream.concat(
+                IntStream.iterate(0, i -> i + 1),
+                LongStream.range(0, Long.MAX_VALUE).mapToInt(i -> (int) i)));
+    }
+
+    public void testDoubleSize() {
+        assertSized(DoubleStream.concat(
+                IntStream.range(0, Integer.MAX_VALUE).mapToDouble(i -> i),
+                IntStream.range(0, Integer.MAX_VALUE).mapToDouble(i -> i)));
+
+        assertUnsized(DoubleStream.concat(
+                LongStream.range(0, Long.MAX_VALUE).mapToDouble(i -> i),
+                LongStream.range(0, Long.MAX_VALUE).mapToDouble(i -> i)));
+
+        assertUnsized(DoubleStream.concat(
+                LongStream.range(0, Long.MAX_VALUE).mapToDouble(i -> i),
+                DoubleStream.iterate(0, i -> i + 1)));
+
+        assertUnsized(DoubleStream.concat(
+                DoubleStream.iterate(0, i -> i + 1),
+                LongStream.range(0, Long.MAX_VALUE).mapToDouble(i -> i)));
+    }
+
+    void assertUnsized(BaseStream<?, ?> s) {
+        Spliterator<?> sp = s.spliterator();
+
+        assertFalse(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
+        assertEquals(sp.estimateSize(), Long.MAX_VALUE);
+    }
+
+    void assertSized(BaseStream<?, ?> s) {
+        Spliterator<?> sp = s.spliterator();
+
+        assertTrue(sp.hasCharacteristics(Spliterator.SIZED | Spliterator.SUBSIZED));
+        assertTrue(sp.estimateSize() < Long.MAX_VALUE);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/plugins/jpeg/JpegWriterLeakTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     8020983
+ * @summary Test verifies that jpeg writer instances are collected
+ *          even if destroy() or reset() methods is not invoked.
+ *
+ * @run main JpegWriterLeakTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.Random;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.ImageOutputStream;
+
+public class JpegWriterLeakTest {
+
+    public static void main(String[] args) {
+        final ReferenceQueue<ImageWriter> queue = new ReferenceQueue<>();
+        final ArrayList<Reference<? extends ImageWriter>> refs = new ArrayList<>();
+
+        int count = 2;
+
+        do {
+            ImageWriter writer =
+                    ImageIO.getImageWritersByFormatName("jpeg").next();
+
+            final WeakReference<? extends ImageWriter> ref =
+                    new WeakReference<>(writer, queue);
+
+            refs.add(ref);
+
+
+            try {
+                final ImageOutputStream os =
+                        ImageIO.createImageOutputStream(new ByteArrayOutputStream());
+                writer.setOutput(os);
+
+                writer.write(getImage());
+
+
+                // NB: dispose() or reset() workarounds the problem.
+            } catch (IOException e) {
+            } finally {
+                writer = null;
+            }
+            count--;
+        } while (count > 0);
+
+
+        System.out.println("Wait for GC...");
+
+        final long testTimeOut = 60000L;
+
+        final long startTime = System.currentTimeMillis();
+
+        while (!refs.isEmpty()) {
+            // check for the test timeout
+            final long now = System.currentTimeMillis();
+
+            if (now - startTime > testTimeOut) {
+                System.out.println();
+                throw new RuntimeException("Test FAILED.");
+            }
+
+            System.gc();
+
+            try {
+                System.out.print(".");
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+            };
+
+            Reference<? extends ImageWriter> r = queue.poll();
+            if (r != null) {
+                System.out.println("Got reference: " + r);
+                refs.remove(r);
+            }
+        }
+        System.out.println("Test PASSED.");
+    }
+
+    private static BufferedImage getImage() {
+        int width = 2500;
+        int height = new Random().nextInt(2500) + 1;
+        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+
+        Graphics2D g = image.createGraphics();
+        g.setColor(Color.blue);
+        g.fillRect(0, 0, width, height);
+
+        return image;
+    }
+}
--- a/jdk/test/javax/print/DialogMargins.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/javax/print/DialogMargins.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,11 +25,12 @@
 
 /**
  * @test
- * @bug 4485755 6361370 6448717 5080051 6939417
+ * @bug 4485755 6361370 6448717 5080051 6939417 8016343
  * @summary dialog doesn't have way to specify margins
  *          for 6361370, verify exception for offline printer in Windows
  *          for 6448717, faster display of print dialog
  *          for 6500903, verify status of printer if accepting jobs or not
+ *          for 8016343, verify printing to non-default printer
  * @author prr
  * @run main/manual DialogMargins
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import com.sun.java.swing.plaf.windows.WindowsComboBoxUI.WindowsComboBoxEditor;
+import java.awt.Toolkit;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import javax.swing.ComboBoxEditor;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JTextField;
+import javax.swing.UIManager;
+import sun.awt.SunToolkit;
+
+import static javax.swing.SwingUtilities.invokeAndWait;
+import static javax.swing.SwingUtilities.windowForComponent;
+import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
+
+/*
+ * @test
+ * @bug 8015300
+ * @summary Tests that editable combobox select all text
+ * @author Sergey Malenkov
+ */
+
+public class Test8015300 {
+    private static final SunToolkit STK = (SunToolkit) Toolkit.getDefaultToolkit();
+    private static final String[] ITEMS = {
+            "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
+            "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
+
+    private static JComboBox<String> combo;
+
+    public static void main(String[] args) throws Exception {
+        UIManager.LookAndFeelInfo[] array = UIManager.getInstalledLookAndFeels();
+        for (UIManager.LookAndFeelInfo info : array) {
+            UIManager.setLookAndFeel(info.getClassName());
+            System.err.println("L&F: " + info.getName());
+            invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    combo = new JComboBox<>(ITEMS);
+                    combo.addItemListener(new ItemListener() {
+                        @Override
+                        public void itemStateChanged(ItemEvent event) {
+                            if (ItemEvent.SELECTED == event.getStateChange() && combo.isEditable()) {
+                                ComboBoxEditor editor = combo.getEditor();
+                                Object component = editor.getEditorComponent();
+                                if (component instanceof JTextField) {
+                                    JTextField text = (JTextField) component;
+                                    boolean selected = null != text.getSelectedText();
+
+                                    StringBuilder sb = new StringBuilder();
+                                    sb.append(" - ").append(combo.getSelectedIndex());
+                                    sb.append(": ").append(event.getItem());
+                                    if (selected) {
+                                        sb.append("; selected");
+                                    }
+                                    System.err.println(sb);
+                                    if ((editor instanceof WindowsComboBoxEditor) == (null == text.getSelectedText())) {
+                                        throw new Error("unexpected state of text selection");
+                                    }
+                                }
+                            }
+                        }
+                    });
+                    JFrame frame = new JFrame(getClass().getSimpleName());
+                    frame.add(combo);
+                    frame.pack();
+                    frame.setLocationRelativeTo(null);
+                    frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+                    frame.setVisible(true);
+                }
+            });
+            for (int i = 0; i < ITEMS.length; ++i) {
+                select(i, true);
+                select(1, false);
+            }
+            invokeAndWait(new Runnable() {
+                @Override
+                public void run() {
+                    windowForComponent(combo).dispose();
+                }
+            });
+        }
+    }
+
+    private static void select(final int index, final boolean editable) throws Exception {
+        invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                combo.setEditable(editable);
+                combo.setSelectedIndex(index);
+            }
+        });
+        STK.realSync();
+        Thread.sleep(50L);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/Test8015926.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8015926
+ * @summary Tests that there are no NPE during painting
+ * @author Sergey Malenkov
+ */
+
+import javax.swing.JFrame;
+import javax.swing.JTree;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+
+import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
+
+public class Test8015926 implements TreeModelListener, Runnable, Thread.UncaughtExceptionHandler {
+
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
+        SwingUtilities.invokeAndWait(new Test8015926());
+        Thread.sleep(1000L);
+    }
+
+    private JTree tree;
+
+    @Override
+    public void treeStructureChanged(TreeModelEvent event) {
+    }
+
+    @Override
+    public void treeNodesRemoved(TreeModelEvent event) {
+    }
+
+    @Override
+    public void treeNodesInserted(TreeModelEvent event) {
+        this.tree.expandPath(event.getTreePath());
+    }
+
+    @Override
+    public void treeNodesChanged(TreeModelEvent event) {
+    }
+
+    @Override
+    public void run() {
+        Thread.currentThread().setUncaughtExceptionHandler(this);
+
+        DefaultMutableTreeNode root = new DefaultMutableTreeNode();
+        DefaultMutableTreeNode child = new DefaultMutableTreeNode("Child");
+        DefaultTreeModel model = new DefaultTreeModel(root);
+
+        this.tree = new JTree();
+        this.tree.setModel(model);
+
+        JFrame frame = new JFrame(getClass().getSimpleName());
+        frame.add(this.tree);
+
+        model.addTreeModelListener(this); // frame is not visible yet
+        model.insertNodeInto(child, root, root.getChildCount());
+        model.removeNodeFromParent(child);
+
+        frame.setSize(640, 480);
+        frame.setLocationRelativeTo(null);
+        frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
+        frame.setVisible(true);
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable exception) {
+        exception.printStackTrace();
+        System.exit(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/parsers/8021148/JAXPSAXParserTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8021148
+ * @summary test that JAXPSAXParser works even if referenced directly
+ * @run main/othervm JAXPSAXParserTest
+ */
+import java.io.StringReader;
+import java.io.StringWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+/**
+ * test that JAXPSAXParser works even if referenced directly as
+ * NetBeans did. **Note that JAXPSAXParser is an internal implementation, this
+ * may therefore change.
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class JAXPSAXParserTest extends TestBase {
+
+    public JAXPSAXParserTest(String name) {
+        super(name);
+    }
+
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) {
+        JAXPSAXParserTest test = new JAXPSAXParserTest("JAXP 1.5 regression");
+        test.setUp();
+        test.testTransform();
+        test.tearDown();
+    }
+
+    public final void testTransform() {
+        String data =
+                "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+                + "<r>\n"
+                + "    <e/>\n"
+                + "</r>\n";
+        String IDENTITY_XSLT_WITH_INDENT = // #5064280 workaround
+                "<xsl:stylesheet version='1.0' "
+                + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform' "
+                + "xmlns:xalan='http://xml.apache.org/xslt' "
+                + "exclude-result-prefixes='xalan'>"
+                + "<xsl:output method='xml' indent='yes' xalan:indent-amount='4'/>"
+                + "<xsl:template match='@*|node()'>"
+                + "<xsl:copy>"
+                + "<xsl:apply-templates select='@*|node()'/>"
+                + "</xsl:copy>"
+                + "</xsl:template>"
+                + "</xsl:stylesheet>";
+        try {
+            //Skip the default XMLReader
+            System.setProperty("org.xml.sax.driver", "com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser");
+
+            StringWriter sw = new StringWriter();
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer t = tf.newTransformer(new StreamSource(new StringReader(IDENTITY_XSLT_WITH_INDENT)));
+            Result result = new StreamResult(sw);
+            t.transform(new StreamSource(new StringReader(data)), result);
+            success("JAXPSAXParserTest passed");
+        } catch (Exception e) {
+            /**
+             * JAXPSAXParser throws NullPointerException since the jaxp 1.5 security
+             * manager is not initialized when JAXPSAXParser is instantiated using
+             * the default constructor.
+            */
+            fail(e.toString());
+        } finally {
+            System.clearProperty("org.xml.sax.driver");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/xml/jaxp/parsers/8021148/TestBase.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.security.Policy;
+
+/**
+ *
+ *
+ * @author huizhe.wang@oracle.com
+ */
+public class TestBase {
+    String filePath;
+    boolean hasSM;
+    String curDir;
+    Policy origPolicy;
+
+    String testName;
+    static String errMessage;
+
+    int passed = 0, failed = 0;
+
+    /**
+     * Creates a new instance of StreamReader
+     */
+    public TestBase(String name) {
+        testName = name;
+    }
+
+    //junit @Override
+    protected void setUp() {
+        if (System.getSecurityManager() != null) {
+            hasSM = true;
+            System.setSecurityManager(null);
+        }
+
+        filePath = System.getProperty("test.src");
+        if (filePath == null) {
+            //current directory
+            filePath = System.getProperty("user.dir");
+        }
+        origPolicy = Policy.getPolicy();
+
+    }
+
+    //junit @Override
+    public void tearDown() {
+        // turn off security manager and restore policy
+        System.setSecurityManager(null);
+        Policy.setPolicy(origPolicy);
+        if (hasSM) {
+            System.setSecurityManager(new SecurityManager());
+        }
+        System.out.println("\nNumber of tests passed: " + passed);
+        System.out.println("Number of tests failed: " + failed + "\n");
+
+        if (errMessage != null ) {
+            throw new RuntimeException(errMessage);
+        }
+    }
+
+    void fail(String errMsg) {
+        if (errMessage == null) {
+            errMessage = errMsg;
+        } else {
+            errMessage = errMessage + "\n" + errMsg;
+        }
+        failed++;
+    }
+
+    void success(String msg) {
+        passed++;
+        System.out.println(msg);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/image/ImagingLib/SamePackingTypeTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     8019201
+ * @summary Test verifies that medialib glue code does not throw
+ *          an ImagingOpException for certain pairs of source and
+ *          destination images.
+ *
+ * @run main SamePackingTypeTest
+ */
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR;
+import static java.awt.image.BufferedImage.TYPE_4BYTE_ABGR_PRE;
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB;
+import static java.awt.image.BufferedImage.TYPE_INT_ARGB_PRE;
+import java.awt.image.BufferedImageOp;
+import java.awt.image.ConvolveOp;
+import java.awt.image.ImagingOpException;
+import java.awt.image.Kernel;
+import java.util.Arrays;
+
+
+public class SamePackingTypeTest {
+
+    public static void main(String[] args) {
+        BufferedImageOp op = createTestOp();
+
+        try {
+            System.out.print("Integer-based images... ");
+            doTest(op, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE);
+            System.out.println("done.");
+
+            System.out.print("Byte-based images... ");
+            doTest(op, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE);
+            System.out.println("done");
+        } catch (ImagingOpException e) {
+            throw new RuntimeException("Test FAILED", e);
+        }
+    }
+
+    private static void doTest(BufferedImageOp op, int stype, int dtype) {
+        final int size = 100;
+
+        final BufferedImage src = new BufferedImage(size, size, stype);
+        Graphics2D g = src.createGraphics();
+        g.setColor(Color.red);
+        g.fillRect(0, 0, size, size);
+        g.dispose();
+
+
+        final BufferedImage dst = new BufferedImage(size, size, dtype);
+        g = dst.createGraphics();
+        g.setColor(Color.blue);
+        g.fillRect(0, 0, size, size);
+        g.dispose();
+
+        op.filter(src, dst);
+
+        final int rgb = dst.getRGB(size - 1, size - 1);
+        System.out.printf("dst: 0x%X ", rgb);
+
+        if (rgb != 0xFFFF0000) {
+            throw new RuntimeException(String.format("Wrong color in dst: 0x%X", rgb));
+        }
+    }
+
+    private static BufferedImageOp createTestOp() {
+        final int size = 1;
+        final float v = 1f / (size * size);
+        final float[] k_data = new float[size * size];
+        Arrays.fill(k_data, v);
+
+        Kernel k = new Kernel(size, size, k_data);
+        return new ConvolveOp(k);
+    }
+}
--- a/jdk/test/sun/invoke/util/ValueConversionsTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/invoke/util/ValueConversionsTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -35,7 +35,7 @@
 
 /* @test
  * @summary unit tests for value-type conversion utilities
- * @ignore This test requires a special compilation environment to access sun.inovke.util.  Run by hand.
+ * @compile -XDignore.symbol.file ValueConversionsTest.java
  * @run junit/othervm test.sun.invoke.util.ValueConversionsTest
  * @run junit/othervm
  *          -DValueConversionsTest.MAX_ARITY=255 -DValueConversionsTest.START_ARITY=250
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs/pkcs9/UnstructuredName.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016916
+ * @summary UnstructuredName should support DirectoryString
+ */
+
+import java.util.Base64;
+import sun.security.pkcs10.PKCS10;
+
+public class UnstructuredName {
+
+    // Certificate request with an Unstructured Name attribute
+    static String csrStr =
+        "MIIBtjCCAR8CAQAwEzERMA8GA1UEAxMIdGVzdE5hbWUwgZ8wDQYJKoZIhvcNAQEB\n" +
+        "BQADgY0AMIGJAoGBAMTEIVCsM8IIhvsbzn6AwQFX5C8RGAWIrL6P5XEr1z+bvHx3\n" +
+        "XhPD4tWLCR6CTKq0lTlo+QKKct7MUY7pdKShajpyYD+1YLgEve0nNd4r5kVUeoHe\n" +
+        "CyIZoImONgAlmVD7M8IJjz2Vg84WVVjkHK67H5qt7Agi1hUnFGmRbJ8rbL7jAgMB\n" +
+        "AAGgYzAXBgkqhkiG9w0BCQcxChMIcGFzc3dvcmQwHAYJKoZIhvcNAQkCMQ8TDW9w\n" +
+        "dGlvbmFsIG5hbWUwKgYJKoZIhvcNAQkOMR0wGzAMBgNVHRMBAf8EAjAAMAsGA1Ud\n" +
+        "DwQEAwIGQDANBgkqhkiG9w0BAQUFAAOBgQBc7ldGSmyCjMU+ssjglCimqknCVdig\n" +
+        "N8FsI/aNRgLqf+eXKWZOxl1v3GB9HCXWDtqOnHd6AJKFpGtK0bqRu7bIncYIiQ1a\n" +
+        "P1NW4Kup8d1fTPhw6xgYtxeHvUxRa2y4IXskPUYqp05HavfNZxmcJ5mZOLtgiDIC\n" +
+        "I3J80saqEUQKqQ==";
+
+    public static void main(String[] args) throws Exception {
+        PKCS10 req = new PKCS10(Base64.getMimeDecoder().decode(csrStr));
+
+        // If PKCS9Attribute did not accept the PrintableString ASN.1 tag,
+        // this would fail with an IOException
+        Object attr = req.getAttributes().getAttribute("1.2.840.113549.1.9.2");
+
+        // Check that the attribute exists
+        if (attr == null) {
+            throw new Exception("Attribute should not be null.");
+        }
+
+        System.out.println("Test passed.");
+    }
+}
--- a/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/KeyStore/SecretKeysBasic.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,16 +23,10 @@
 
 import java.io.*;
 import java.util.*;
-import java.lang.reflect.*;
-
 import java.security.*;
-import java.security.cert.*;
-import java.security.spec.*;
-import java.security.interfaces.*;
-import java.math.BigInteger;
-
 import javax.crypto.*;
 import javax.crypto.spec.*;
+import javax.xml.bind.DatatypeConverter;
 
 public class SecretKeysBasic extends PKCS11Test {
 
@@ -94,6 +88,17 @@
             SecretKey expected,
             boolean saveBeforeCheck)
             throws Exception {
+
+        // A bug in NSS 3.12 (Mozilla bug 471665) causes AES key lengths
+        // to be read incorrectly.  Checking for improper 16 byte length
+        // in key string.
+        if (isNSS(provider) && expected.getAlgorithm().equals("AES") &&
+                (getNSSVersion() >= 3.12 && getNSSVersion() <= 3.122)) {
+            System.out.println("NSS 3.12 bug returns incorrect AES key "+
+                    "length breaking key storage. Aborting...");
+            return true;
+        }
+
         if (saveBeforeCheck) {
             ks.setKeyEntry(alias, expected, null, null);
         }
@@ -127,7 +132,7 @@
         System.out.println("\tALGO=" + key.getAlgorithm());
         if (key.getFormat() != null) {
             System.out.println("\t[" + key.getFormat() + "] VALUE=" +
-                    new BigInteger(key.getEncoded()));
+                    DatatypeConverter.printHexBinary(key.getEncoded()));
         } else {
             System.out.println("\tVALUE=n/a");
         }
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,6 +54,16 @@
 
     static String NSPR_PREFIX = "";
 
+    // NSS version info
+    public static enum ECCState { None, Basic, Extended };
+    static double nss_version = -1;
+    static ECCState nss_ecc_status = ECCState.Extended;
+
+    // The NSS library we need to search for in getNSSLibDir()
+    // Default is "libsoftokn3.so", listed as "softokn3"
+    // The other is "libnss3.so", listed as "nss3".
+    static String nss_library = "softokn3";
+
     static Provider getSunPKCS11(String config) throws Exception {
         Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11");
         Constructor cons = clazz.getConstructor(new Class[] {String.class});
@@ -79,24 +89,28 @@
             testNSS(test);
             testDeimos(test);
         } finally {
+            // NOTE: Do not place a 'return' in any finally block
+            // as it will suppress exceptions and hide test failures.
             Provider[] newProviders = Security.getProviders();
+            boolean found = true;
             // Do not restore providers if nothing changed. This is especailly
             // useful for ./Provider/Login.sh, where a SecurityManager exists.
             if (oldProviders.length == newProviders.length) {
-                boolean found = false;
+                found = false;
                 for (int i = 0; i<oldProviders.length; i++) {
                     if (oldProviders[i] != newProviders[i]) {
                         found = true;
                         break;
                     }
                 }
-                if (!found) return;
             }
-            for (Provider p: newProviders) {
-                Security.removeProvider(p.getName());
-            }
-            for (Provider p: oldProviders) {
-                Security.addProvider(p);
+            if (found) {
+                for (Provider p: newProviders) {
+                    Security.removeProvider(p.getName());
+                }
+                for (Provider p: oldProviders) {
+                    Security.addProvider(p);
+                }
             }
         }
     }
@@ -178,7 +192,8 @@
         }
         String nssLibDir = null;
         for (String dir : nssLibDirs) {
-            if (new File(dir).exists()) {
+            if (new File(dir).exists() &&
+                new File(dir + System.mapLibraryName(nss_library)).exists()) {
                 nssLibDir = dir;
                 System.setProperty("pkcs11test.nss.libdir", nssLibDir);
                 break;
@@ -207,6 +222,109 @@
         return true;
     }
 
+    // Check the provider being used is NSS
+    public static boolean isNSS(Provider p) {
+        return p.getName().toUpperCase().equals("SUNPKCS11-NSS");
+    }
+
+    static double getNSSVersion() {
+        if (nss_version == -1)
+            getNSSInfo();
+        return nss_version;
+    }
+
+    static ECCState getNSSECC() {
+        if (nss_version == -1)
+            getNSSInfo();
+        return nss_ecc_status;
+    }
+
+    /* Read the library to find out the verison */
+    static void getNSSInfo() {
+        String nssHeader = "$Header: NSS";
+        boolean found = false;
+        String s = null;
+        int i = 0;
+        String libfile = "";
+
+        try {
+            libfile = getNSSLibDir() + System.mapLibraryName(nss_library);
+            FileInputStream is = new FileInputStream(libfile);
+            byte[] data = new byte[1000];
+            int read = 0;
+
+            while (is.available() > 0) {
+                if (read == 0) {
+                    read = is.read(data, 0, 1000);
+                } else {
+                    // Prepend last 100 bytes in case the header was split
+                    // between the reads.
+                    System.arraycopy(data, 900, data, 0, 100);
+                    read = 100 + is.read(data, 100, 900);
+                }
+
+                s = new String(data, 0, read);
+                if ((i = s.indexOf(nssHeader)) > 0) {
+                    found = true;
+                    // If the nssHeader is before 920 we can break, otherwise
+                    // we may not have the whole header so do another read.  If
+                    // no bytes are in the stream, that is ok, found is true.
+                    if (i < 920) {
+                        break;
+                    }
+                }
+            }
+
+            is.close();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        if (!found) {
+            System.out.println("NSS version not found, set to 0.0: "+libfile);
+            nss_version = 0.0;
+            return;
+        }
+
+        // the index after whitespace after nssHeader
+        int afterheader = s.indexOf("NSS", i) + 4;
+        String version = s.substring(afterheader, s.indexOf(' ', afterheader));
+
+        // If a "dot dot" release, strip the extra dots for double parsing
+        String[] dot = version.split("\\.");
+        if (dot.length > 2) {
+            version = dot[0]+"."+dot[1];
+            for (int j = 2; dot.length > j; j++) {
+                version += dot[j];
+            }
+        }
+
+        // Convert to double for easier version value checking
+        try {
+            nss_version = Double.parseDouble(version);
+        } catch (NumberFormatException e) {
+            System.out.println("Failed to parse NSS version. Set to 0.0");
+            e.printStackTrace();
+        }
+
+        System.out.print("NSS version = "+version+".  ");
+
+        // Check for ECC
+        if (s.indexOf("Basic") > 0) {
+            nss_ecc_status = ECCState.Basic;
+            System.out.println("ECC Basic.");
+        } else if (s.indexOf("Extended") > 0) {
+            nss_ecc_status = ECCState.Extended;
+            System.out.println("ECC Extended.");
+        }
+    }
+
+    // Used to set the nss_library file to search for libsoftokn3.so
+    public static void useNSS() {
+        nss_library = "nss3";
+    }
+
     public static void testNSS(PKCS11Test test) throws Exception {
         String libdir = getNSSLibDir();
         if (libdir == null) {
@@ -218,7 +336,7 @@
             return;
         }
 
-        String libfile = libdir + System.mapLibraryName("softokn3");
+        String libfile = libdir + System.mapLibraryName(nss_library);
 
         String customDBdir = System.getProperty("CUSTOM_DB_DIR");
         String dbdir = (customDBdir != null) ?
@@ -252,7 +370,8 @@
         osMap.put("Linux-i386-32", new String[]{
             "/usr/lib/i386-linux-gnu/", "/usr/lib/"});
         osMap.put("Linux-amd64-64", new String[]{
-            "/usr/lib/x86_64-linux-gnu/", "/usr/lib64/"});
+            "/usr/lib/x86_64-linux-gnu/", "/usr/lib/x86_64-linux-gnu/nss/",
+            "/usr/lib64/"});
         osMap.put("Windows-x86-32", new String[]{
             PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)});
         osMap.put("Windows-amd64-64", new String[]{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/README	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,22 @@
+This README is to keep a list facts and known workaround for the pkcs11 java tests
+perform as a result of bugs or features in NSS or other pkcs11 libraries.
+
+- NSS ECC None/Basic/Extended
+The tests detect the NSS library support for Elliptic Curves as to not
+report incorrect failures.  PKCS11 reports back CKR_DOMAIN_PARAMS_INVALID
+when the curve is not supported.
+
+- Default libsoftokn3.so
+By default PKCS11Test.java will look for libsoftokn3.so.  There are a number of
+tests, particularly in Secmod, that need libnss3.so.  The method useNSS() in
+PKCS11test.java is to change the search and version checking to libnss3.
+
+ECC Basic supports is secp256r1, secp384r1, and secp521r1.
+
+- A bug in NSS 3.12 (Mozilla bug 471665) causes AES key lengths to be
+read incorrectly. KeyStore/SecretKeysBasic.java tiggers this bug and
+knows to avoid it.
+
+- A number of EC tests fail because of a DER bug in NSS 3.11.  The best guess
+is Mozilla bug 480280.  Those tests that abort execution with a PASS result
+are:  TestECDH2, TestECDSA, TestECDSA2 and TestECGenSpec.
--- a/jdk/test/sun/security/pkcs11/SecmodTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/SecmodTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -36,6 +36,7 @@
     static String keyAlias = "mykey";
 
     static boolean initSecmod() throws Exception {
+        useNSS();
         LIBPATH = getNSSLibDir();
         if (LIBPATH == null) {
             return false;
--- a/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -113,6 +113,20 @@
                 System.out.println("Warning: " + e.getMessage() +
                 ". Trying another provider...");
                 cert.verify(key);
+            } catch (InvalidKeyException e) {
+                // The root cause of the exception might be NSS not having
+                // "ECC Extended" support curves.  If so, we can ignore it.
+                Throwable t = e;
+                while (t.getCause() != null) {
+                    t = t.getCause();
+                }
+                if (t instanceof sun.security.pkcs11.wrapper.PKCS11Exception &&
+                        t.getMessage().equals("CKR_DOMAIN_PARAMS_INVALID") &&
+                        isNSS(p) && getNSSECC() == ECCState.Basic) {
+                    System.out.println("Failed as expected. NSS Basic ECC.");
+                    continue;
+                }
+                throw e;
             }
         }
 
--- a/jdk/test/sun/security/pkcs11/ec/TestCurves.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestCurves.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,6 +50,12 @@
             return;
         }
 
+        if (isNSS(p) && getNSSVersion() >= 3.11 && getNSSVersion() < 3.12) {
+            System.out.println("NSS 3.11 has a DER issue that recent " +
+                    "version do not.");
+            return;
+        }
+
         Random random = new Random();
         byte[] data = new byte[2048];
         random.nextBytes(data);
@@ -61,8 +67,29 @@
             KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
             kpg.initialize(params);
             KeyPair kp1, kp2;
-            kp1 = kpg.generateKeyPair();
-            kp2 = kpg.generateKeyPair();
+
+            try {
+                kp1 = kpg.generateKeyPair();
+                kp2 = kpg.generateKeyPair();
+            } catch (Exception e) {
+                // The root cause of the exception might be NSS not having
+                // "ECC Extended" support curves.  If so, we can ignore it.
+                if (e instanceof java.security.ProviderException) {
+                    Throwable t = e.getCause();
+                    if (t instanceof
+                            sun.security.pkcs11.wrapper.PKCS11Exception &&
+                            t.getMessage().equals("CKR_DOMAIN_PARAMS_INVALID") &&
+                            isNSS(p) && (getNSSECC() == ECCState.Basic) &&
+                            (!params.toString().startsWith("secp256r1") &&
+                            !params.toString().startsWith("secp384r1") &&
+                            !params.toString().startsWith("secp521r1"))) {
+                        System.out.println("NSS Basic ECC.  Failure expected");
+                        continue;
+                    }
+                }
+
+                throw e;
+            }
 
             testSigning(p, "SHA1withECDSA", data, kp1, kp2);
             testSigning(p, "SHA224withECDSA", data, kp1, kp2);
@@ -97,8 +124,9 @@
         int end;
         String curve;
         Vector<ECParameterSpec> results = new Vector<ECParameterSpec>();
-        String kcProp =
-            p.getProperty("AlgorithmParameters.EC SupportedCurves");
+        // Get Curves to test from SunEC.
+        String kcProp = Security.getProvider("SunEC").
+                getProperty("AlgorithmParameters.EC SupportedCurves");
 
         if (kcProp == null) {
             throw new RuntimeException(
--- a/jdk/test/sun/security/pkcs11/ec/TestECDH.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDH.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,6 +61,11 @@
             return;
         }
 
+        if (isNSS(p) && getNSSECC() == ECCState.Basic) {
+            System.out.println("NSS only supports Basic ECC.  Skipping..");
+            return;
+        }
+
         /*
          * PKCS11Test.main will remove this provider if needed
          */
--- a/jdk/test/sun/security/pkcs11/ec/TestECDH2.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDH2.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,13 @@
             return;
         }
 
+        if (isNSS(provider) && getNSSVersion() >= 3.11 &&
+                getNSSVersion() < 3.12) {
+            System.out.println("NSS 3.11 has a DER issue that recent " +
+                    "version do not.");
+            return;
+        }
+
         kf = KeyFactory.getInstance("EC", provider);
         kpg = KeyPairGenerator.getInstance("EC", provider);
 
--- a/jdk/test/sun/security/pkcs11/ec/TestECDSA.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,9 +30,7 @@
  * @library ../../../../java/security/testlibrary
  */
 
-import java.io.*;
 import java.util.*;
-import java.math.BigInteger;
 
 import java.security.*;
 import java.security.spec.*;
@@ -117,6 +115,13 @@
             return;
         }
 
+        if (isNSS(provider) && getNSSVersion() >= 3.11 &&
+                getNSSVersion() < 3.12) {
+            System.out.println("NSS 3.11 has a DER issue that recent " +
+                    "version do not.");
+            return;
+        }
+
         /*
          * PKCS11Test.main will remove this provider if needed
          */
@@ -136,10 +141,14 @@
             return;
         }
 
-        test(provider, pub192, priv192, sig192);
-        test(provider, pub163, priv163, sig163);
+        if (getNSSECC() != ECCState.Basic) {
+            test(provider, pub192, priv192, sig192);
+            test(provider, pub163, priv163, sig163);
+            test(provider, pub571, priv571, sig571);
+        } else {
+            System.out.println("ECC Basic only, skipping 192, 163 and 571.");
+        }
         test(provider, pub521, priv521, sig521);
-        test(provider, pub571, priv571, sig571);
 
         long stop = System.currentTimeMillis();
         System.out.println("All tests passed (" + (stop - start) + " ms).");
--- a/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestECDSA2.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -104,6 +104,13 @@
             return;
         }
 
+        if (isNSS(provider) && getNSSVersion() >= 3.11 &&
+                getNSSVersion() < 3.12) {
+            System.out.println("NSS 3.11 has a DER issue that recent " +
+                    "version do not.");
+            return;
+        }
+
         kf = KeyFactory.getInstance("EC", provider);
 
         long start = System.currentTimeMillis();
--- a/jdk/test/sun/security/pkcs11/ec/TestECGenSpec.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestECGenSpec.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,9 +47,20 @@
             return;
         }
 
-        String[] names = { "NIST P-192", "sect163k1", "1.3.132.0.26", "X9.62 c2tnb239v1"};
-        int[] lengths = {192, 163, 233, 239};
-        for (int i = 0; i < names.length; i++) {
+        if (isNSS(p) && getNSSVersion() >= 3.11 && getNSSVersion() < 3.12) {
+            System.out.println("NSS 3.11 has a DER issue that recent " +
+                    "version do not.");
+            return;
+        }
+
+        String[] names = { "secp256r1", "NIST P-192", "sect163k1", "1.3.132.0.26",
+            "X9.62 c2tnb239v1"};
+        int curves = 1;
+        if (getNSSECC() == ECCState.Extended) {
+            curves = names.length;
+        }
+        int[] lengths = {256, 192, 163, 233, 239};
+        for (int i = 0; i < curves; i++) {
             String name = names[i];
             int len = lengths[i];
             System.out.println("Testing " + name + "...");
--- a/jdk/test/sun/security/pkcs11/ec/TestKeyFactory.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/pkcs11/ec/TestKeyFactory.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -119,11 +119,17 @@
             System.out.println("Provider does not support EC, skipping");
             return;
         }
-        int[] keyLengths = {192, 163, 521, 409};
+        int[] keyLengths = {192, 163, 409, 521};
+        int len = 0;
+        if (getNSSECC() == ECCState.Basic) {
+            System.out.println("NSS Basic ECC only. Skipping 192, 163, & 409");
+            len = 3;
+        }
         KeyFactory kf = KeyFactory.getInstance("EC", p);
-        for (int len : keyLengths) {
+        for (; keyLengths.length > len ; len++) {
+            System.out.println("Length "+keyLengths[len]);
             KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p);
-            kpg.initialize(len);
+            kpg.initialize(keyLengths[len]);
             KeyPair kp = kpg.generateKeyPair();
             test(kf, kp.getPrivate());
             test(kf, kp.getPublic());
--- a/jdk/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/jdk/test/sun/security/ssl/com/sun/net/ssl/SSLSecurity/ProviderTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
  * @compile JavaxSSLContextImpl.java ComSSLContextImpl.java
  *      JavaxTrustManagerFactoryImpl.java ComTrustManagerFactoryImpl.java
  *      JavaxKeyManagerFactoryImpl.java ComKeyManagerFactoryImpl.java
- * @run main ProviderTest
+ * @run main/othervm ProviderTest
  * @summary brokenness in the com.sun.net.ssl.SSLSecurity wrappers
  */
 
--- a/langtools/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -222,3 +222,4 @@
 ce5a90df517bdceb2739d7dd3e6764b070def802 jdk8-b98
 6d85acab769eb79bc058f5640fa86a6ef096a583 jdk8-b99
 82f68da70e471ee5640016e3f38c014347a5c785 jdk8-b100
+0324dbf07b0f1cc51ad9fa18976489d02d23b60d jdk8-b101
--- a/langtools/src/share/classes/com/sun/source/util/DocTrees.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/source/util/DocTrees.java	Tue Aug 06 16:54:56 2013 -0700
@@ -30,7 +30,6 @@
 import javax.tools.JavaCompiler.CompilationTask;
 
 import com.sun.source.doctree.DocCommentTree;
-import com.sun.source.doctree.ReferenceTree;
 import javax.tools.Diagnostic;
 
 /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1621,6 +1621,7 @@
                     text = removeNonInlineHtmlTags(text);
                 }
                 text = Util.replaceTabs(configuration, text);
+                text = Util.normalizeNewlines(text);
                 result.addContent(new RawHtml(text));
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -71,7 +71,7 @@
      * {@inheritDoc}
      */
     protected Content codeTagOutput(Tag tag) {
-        Content result = HtmlTree.CODE(new StringContent(tag.text()));
+        Content result = HtmlTree.CODE(new StringContent(Util.normalizeNewlines(tag.text())));
         return result;
     }
 
@@ -135,7 +135,7 @@
      * {@inheritDoc}
      */
     protected Content literalTagOutput(Tag tag) {
-        Content result = new StringContent(tag.text());
+        Content result = new StringContent(Util.normalizeNewlines(tag.text()));
         return result;
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Aug 06 16:54:56 2013 -0700
@@ -631,6 +631,32 @@
         return result.toString();
     }
 
+    public static String normalizeNewlines(String text) {
+        StringBuilder sb = new StringBuilder();
+        final int textLength = text.length();
+        final String NL = DocletConstants.NL;
+        int pos = 0;
+        for (int i = 0; i < textLength; i++) {
+            char ch = text.charAt(i);
+            switch (ch) {
+                case '\n':
+                    sb.append(text, pos, i);
+                    sb.append(NL);
+                    pos = i + 1;
+                    break;
+                case '\r':
+                    sb.append(text, pos, i);
+                    sb.append(NL);
+                    if (i + 1 < textLength && text.charAt(i + 1) == '\n')
+                        i++;
+                    pos = i + 1;
+                    break;
+            }
+        }
+        sb.append(text, pos, textLength);
+        return sb.toString();
+    }
+
     /**
      * The documentation for values() and valueOf() in Enums are set by the
      * doclet.
--- a/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/Checker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -31,9 +31,11 @@
 import java.net.URISyntaxException;
 import java.util.Deque;
 import java.util.EnumSet;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -45,6 +47,7 @@
 import javax.lang.model.type.TypeKind;
 import javax.lang.model.type.TypeMirror;
 import javax.tools.Diagnostic.Kind;
+import javax.tools.JavaFileObject;
 
 import com.sun.source.doctree.AttributeTree;
 import com.sun.source.doctree.AuthorTree;
@@ -88,9 +91,9 @@
 public class Checker extends DocTreePathScanner<Void, Void> {
     final Env env;
 
-    Set<Element> foundParams = new HashSet<Element>();
-    Set<TypeMirror> foundThrows = new HashSet<TypeMirror>();
-    Set<String> foundAnchors = new HashSet<String>();
+    Set<Element> foundParams = new HashSet<>();
+    Set<TypeMirror> foundThrows = new HashSet<>();
+    Map<JavaFileObject, Set<String>> foundAnchors = new HashMap<>();
     boolean foundInheritDoc = false;
     boolean foundReturn = false;
 
@@ -129,7 +132,7 @@
     Checker(Env env) {
         env.getClass();
         this.env = env;
-        tagStack = new LinkedList<TagStackItem>();
+        tagStack = new LinkedList<>();
         implicitHeaderLevel = env.implicitHeaderLevel;
     }
 
@@ -138,10 +141,27 @@
 
         boolean isOverridingMethod = !env.currOverriddenMethods.isEmpty();
 
-        if (tree == null) {
-            if (!isSynthetic() && !isOverridingMethod)
-                reportMissing("dc.missing.comment");
-            return null;
+        if (p.getLeaf() == p.getCompilationUnit()) {
+            // If p points to a compilation unit, the implied declaration is the
+            // package declaration (if any) for the compilation unit.
+            // Handle this case specially, because doc comments are only
+            // expected in package-info files.
+            JavaFileObject fo = p.getCompilationUnit().getSourceFile();
+            boolean isPkgInfo = fo.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE);
+            if (tree == null) {
+                if (isPkgInfo)
+                    reportMissing("dc.missing.comment");
+                return null;
+            } else {
+                if (!isPkgInfo)
+                    reportReference("dc.unexpected.comment");
+            }
+        } else {
+            if (tree == null) {
+                if (!isSynthetic() && !isOverridingMethod)
+                    reportMissing("dc.missing.comment");
+                return null;
+            }
         }
 
         tagStack.clear();
@@ -184,6 +204,10 @@
         env.messages.report(MISSING, Kind.WARNING, env.currPath.getLeaf(), code, args);
     }
 
+    private void reportReference(String code, Object... args) {
+        env.messages.report(REFERENCE, Kind.WARNING, env.currPath.getLeaf(), code, args);
+    }
+
     @Override
     public Void visitDocComment(DocCommentTree tree, Void ignore) {
         super.visitDocComment(tree, ignore);
@@ -508,7 +532,7 @@
                             if (!validName.matcher(value).matches()) {
                                 env.messages.error(HTML, tree, "dc.invalid.anchor", value);
                             }
-                            if (!foundAnchors.add(value)) {
+                            if (!checkAnchor(value)) {
                                 env.messages.error(HTML, tree, "dc.anchor.already.defined", value);
                             }
                         }
@@ -551,6 +575,14 @@
         return super.visitAttribute(tree, ignore);
     }
 
+    private boolean checkAnchor(String name) {
+        JavaFileObject fo = env.currPath.getCompilationUnit().getSourceFile();
+        Set<String> set = foundAnchors.get(fo);
+        if (set == null)
+            foundAnchors.put(fo, set = new HashSet<>());
+        return set.add(name);
+    }
+
     // http://www.w3.org/TR/html401/types.html#type-name
     private static final Pattern validName = Pattern.compile("[A-Za-z][A-Za-z0-9-_:.]*");
 
@@ -721,8 +753,7 @@
         Element ex = env.trees.getElement(new DocTreePath(getCurrentPath(), exName));
         if (ex == null) {
             env.messages.error(REFERENCE, tree, "dc.ref.not.found");
-        } else if (ex.asType().getKind() == TypeKind.DECLARED
-                && env.types.isAssignable(ex.asType(), env.java_lang_Throwable)) {
+        } else if (isThrowable(ex.asType())) {
             switch (env.currElement.getKind()) {
                 case CONSTRUCTOR:
                 case METHOD:
@@ -741,6 +772,15 @@
         return scan(tree.getDescription(), ignore);
     }
 
+    private boolean isThrowable(TypeMirror tm) {
+        switch (tm.getKind()) {
+            case DECLARED:
+            case TYPEVAR:
+                return env.types.isAssignable(tm, env.java_lang_Throwable);
+        }
+        return false;
+    }
+
     private void checkThrowsDeclared(ReferenceTree tree, TypeMirror t, List<? extends TypeMirror> list) {
         boolean found = false;
         for (TypeMirror tl : list) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Tue Aug 06 16:54:56 2013 -0700
@@ -30,7 +30,6 @@
 import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.regex.Pattern;
 
 import javax.lang.model.element.Name;
 import javax.tools.StandardLocation;
@@ -166,8 +165,8 @@
     }
 
     void processArgs(String... args) throws BadArgs {
-        javacOpts = new ArrayList<String>();
-        javacFiles = new ArrayList<File>();
+        javacOpts = new ArrayList<>();
+        javacFiles = new ArrayList<>();
 
         if (args.length == 0)
             needHelp = true;
@@ -214,7 +213,7 @@
     }
 
     List<File> splitPath(String path) {
-        List<File> files = new ArrayList<File>();
+        List<File> files = new ArrayList<>();
         for (String f: path.split(File.pathSeparator)) {
             if (f.length() > 0)
                 files.add(new File(f));
@@ -279,7 +278,6 @@
             TaskListener tl = new TaskListener() {
                 @Override
                 public void started(TaskEvent e) {
-                    return;
                 }
 
                 @Override
--- a/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/doclint/resources/doclint.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -67,6 +67,7 @@
 dc.tag.start.unmatched = end tag missing: </{0}>
 dc.tag.unknown = unknown tag: {0}
 dc.text.not.allowed = text not allowed in <{0}> element
+dc.unexpected.comment=documentation comment not expected here
 
 dc.main.ioerror=IO error: {0}
 dc.main.no.files.given=No files given
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTrees.java	Tue Aug 06 16:54:56 2013 -0700
@@ -69,7 +69,6 @@
 import com.sun.tools.javac.code.Type.ErrorType;
 import com.sun.tools.javac.code.Type.UnionClassType;
 import com.sun.tools.javac.code.Types;
-import com.sun.tools.javac.code.TypeTag;
 import com.sun.tools.javac.code.Types.TypeRelation;
 import com.sun.tools.javac.comp.Attr;
 import com.sun.tools.javac.comp.AttrContext;
@@ -358,7 +357,7 @@
         Log.DeferredDiagnosticHandler deferredDiagnosticHandler =
                 new Log.DeferredDiagnosticHandler(log);
         try {
-            final ClassSymbol tsym;
+            final TypeSymbol tsym;
             final Name memberName;
             if (ref.qualifierExpression == null) {
                 tsym = env.enclClass.sym;
@@ -387,7 +386,7 @@
                         return null;
                     }
                 } else {
-                    tsym = (ClassSymbol) t.tsym;
+                    tsym = t.tsym;
                     memberName = ref.memberName;
                 }
             }
@@ -408,15 +407,17 @@
                 paramTypes = lb.toList();
             }
 
-            Symbol msym = (memberName == tsym.name)
-                    ? findConstructor(tsym, paramTypes)
-                    : findMethod(tsym, memberName, paramTypes);
+            ClassSymbol sym = (ClassSymbol) types.upperBound(tsym.type).tsym;
+
+            Symbol msym = (memberName == sym.name)
+                    ? findConstructor(sym, paramTypes)
+                    : findMethod(sym, memberName, paramTypes);
             if (paramTypes != null) {
                 // explicit (possibly empty) arg list given, so cannot be a field
                 return msym;
             }
 
-            VarSymbol vsym = (ref.paramTypes != null) ? null : findField(tsym, memberName);
+            VarSymbol vsym = (ref.paramTypes != null) ? null : findField(sym, memberName);
             // prefer a field over a method with no parameters
             if (vsym != null &&
                     (msym == null ||
@@ -789,6 +790,7 @@
                 case METHOD:
 //                    System.err.println("METHOD: " + ((JCMethodDecl)tree).sym.getSimpleName());
                     method = (JCMethodDecl)tree;
+                    env = memberEnter.getMethodEnv(method, env);
                     break;
                 case VARIABLE:
 //                    System.err.println("FIELD: " + ((JCVariableDecl)tree).sym.getSimpleName());
@@ -800,7 +802,6 @@
                         try {
                             Assert.check(method.body == tree);
                             method.body = copier.copy((JCBlock)tree, (JCTree) path.getLeaf());
-                            env = memberEnter.getMethodEnv(method, env);
                             env = attribStatToTree(method.body, env, copier.leafCopy);
                         } finally {
                             method.body = (JCBlock) tree;
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Symbol.java	Tue Aug 06 16:54:56 2013 -0700
@@ -596,7 +596,7 @@
 
     // This method is part of the javax.lang.model API, do not use this in javac code.
     public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(Class<A> annoType) {
-        return JavacAnnoConstructs.getAnnotations(this, annoType);
+        return JavacAnnoConstructs.getAnnotationsByType(this, annoType);
     }
 
     // TODO: getEnclosedElements should return a javac List, fix in FilteredMemberList
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Aug 06 16:54:56 2013 -0700
@@ -134,7 +134,7 @@
      * @return the upper bound of the given type
      */
     public Type upperBound(Type t) {
-        return upperBound.visit(t);
+        return upperBound.visit(t).unannotatedType();
     }
     // where
         private final MapVisitor<Void> upperBound = new MapVisitor<Void>() {
@@ -620,7 +620,9 @@
      * (ii) perform functional interface bridge calculation.
      */
     public ClassSymbol makeFunctionalInterfaceClass(Env<AttrContext> env, Name name, List<Type> targets, long cflags) {
-        Assert.check(targets.nonEmpty() && isFunctionalInterface(targets.head));
+        if (targets.isEmpty() || !isFunctionalInterface(targets.head)) {
+            return null;
+        }
         Symbol descSym = findDescriptorSymbol(targets.head.tsym);
         Type descType = findDescriptorType(targets.head);
         ClassSymbol csym = new ClassSymbol(cflags, name, env.enclClass.sym.outermostClass());
@@ -1130,9 +1132,9 @@
 
                     HashSet<UniqueType> set = new HashSet<UniqueType>();
                     for (Type x : interfaces(t))
-                        set.add(new UniqueType(x, Types.this));
+                        set.add(new UniqueType(x.unannotatedType(), Types.this));
                     for (Type x : interfaces(s)) {
-                        if (!set.remove(new UniqueType(x, Types.this)))
+                        if (!set.remove(new UniqueType(x.unannotatedType(), Types.this)))
                             return false;
                     }
                     return (set.isEmpty());
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Annotate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -273,7 +273,7 @@
                 continue;
             }
             JCIdent left = (JCIdent)assign.lhs;
-            Symbol method = rs.resolveQualifiedMethod(left.pos(),
+            Symbol method = rs.resolveQualifiedMethod(assign.rhs.pos(),
                                                           env,
                                                           a.type,
                                                           left.name,
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1948,6 +1948,8 @@
             clazzid1 = make.at(clazz.pos).Select(make.Type(encltype),
                                                  ((JCIdent) clazzid).name);
 
+            EndPosTable endPosTable = this.env.toplevel.endPositions;
+            endPosTable.storeEnd(clazzid1, tree.getEndPosition(endPosTable));
             if (clazz.hasTag(ANNOTATED_TYPE)) {
                 JCAnnotatedType annoType = (JCAnnotatedType) clazz;
                 List<JCAnnotation> annos = annoType.annotations;
@@ -2193,7 +2195,9 @@
                         syms.objectType :
                         clazztype;
                 if (!inferred.isErroneous() &&
-                    types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings)) {
+                    (allowPoly && pt() == Infer.anyPoly ?
+                        types.isSameType(inferred, clazztype) :
+                        types.isAssignable(inferred, pt().hasTag(NONE) ? polyPt : pt(), types.noWarnings))) {
                     String key = types.isSameType(clazztype, inferred) ?
                         "diamond.redundant.args" :
                         "diamond.redundant.args.1";
@@ -2968,7 +2972,9 @@
                 //check that functional interface class is well-formed
                 ClassSymbol csym = types.makeFunctionalInterfaceClass(env,
                         names.empty, List.of(fExpr.targets.head), ABSTRACT);
-                chk.checkImplementations(env.tree, csym, csym);
+                if (csym != null) {
+                    chk.checkImplementations(env.tree, csym, csym);
+                }
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Aug 06 16:54:56 2013 -0700
@@ -2997,7 +2997,8 @@
         for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
                 e != null;
                 e = e.sibling)
-            if (e.sym.kind == MTH && e.sym.name != names.clinit)
+            if (e.sym.kind == MTH && e.sym.name != names.clinit &&
+                    (e.sym.flags() & SYNTHETIC) == 0)
                 members.add((MethodSymbol) e.sym);
 
         // remove the ones that are assigned values
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Env.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -124,7 +124,16 @@
 
     @Override
     public String toString() {
-        return "Env[" + info + (outer == null ? "" : ",outer=" + outer) + "]";
+        StringBuilder sb = new StringBuilder();
+        sb.append("Env[").append(info);
+//        if (enclMethod != null)
+//            sb.append(",enclMethod=").append(Pretty.toSimpleString(enclMethod));
+//        if (enclClass != null)
+//            sb.append(",enclClass=").append(Pretty.toSimpleString(enclClass));
+        if (outer != null)
+            sb.append(",outer=").append(outer);
+        sb.append("]");
+        return sb.toString();
     }
 
     public Iterator<Env<A>> iterator() {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Flow.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1339,7 +1339,7 @@
 
         /** A mapping from addresses to variable symbols.
          */
-        VarSymbol[] vars;
+        JCVariableDecl[] vardecls;
 
         /** The current class being defined.
          */
@@ -1417,13 +1417,14 @@
          *  to the next available sequence number and entering it under that
          *  index into the vars array.
          */
-        void newVar(VarSymbol sym) {
-            vars = ArrayUtils.ensureCapacity(vars, nextadr);
+        void newVar(JCVariableDecl varDecl) {
+            VarSymbol sym = varDecl.sym;
+            vardecls = ArrayUtils.ensureCapacity(vardecls, nextadr);
             if ((sym.flags() & FINAL) == 0) {
                 sym.flags_field |= EFFECTIVELY_FINAL;
             }
             sym.adr = nextadr;
-            vars[nextadr] = sym;
+            vardecls[nextadr] = varDecl;
             inits.excl(nextadr);
             uninits.incl(nextadr);
             nextadr++;
@@ -1493,11 +1494,13 @@
         /** Check that trackable variable is initialized.
          */
         void checkInit(DiagnosticPosition pos, VarSymbol sym) {
+            checkInit(pos, sym, "var.might.not.have.been.initialized");
+        }
+        void checkInit(DiagnosticPosition pos, VarSymbol sym, String errkey) {
             if ((sym.adr >= firstadr || sym.owner.kind != TYP) &&
                 trackable(sym) &&
                 !inits.isMember(sym.adr)) {
-                log.error(pos, "var.might.not.have.been.initialized",
-                          sym);
+                log.error(pos, errkey, sym);
                 inits.incl(sym.adr);
             }
         }
@@ -1599,7 +1602,7 @@
                         if ((def.mods.flags & STATIC) != 0) {
                             VarSymbol sym = def.sym;
                             if (trackable(sym))
-                                newVar(sym);
+                                newVar(def);
                         }
                     }
                 }
@@ -1619,7 +1622,7 @@
                         if ((def.mods.flags & STATIC) == 0) {
                             VarSymbol sym = def.sym;
                             if (trackable(sym))
-                                newVar(sym);
+                                newVar(def);
                         }
                     }
                 }
@@ -1678,9 +1681,22 @@
                 scan(tree.body);
 
                 if (isInitialConstructor) {
-                    for (int i = firstadr; i < nextadr; i++)
-                        if (vars[i].owner == classDef.sym)
-                            checkInit(TreeInfo.diagEndPos(tree.body), vars[i]);
+                    boolean isSynthesized = (tree.sym.flags() &
+                                             GENERATEDCONSTR) != 0;
+                    for (int i = firstadr; i < nextadr; i++) {
+                        JCVariableDecl vardecl = vardecls[i];
+                        VarSymbol var = vardecl.sym;
+                        if (var.owner == classDef.sym) {
+                            // choose the diagnostic position based on whether
+                            // the ctor is default(synthesized) or not
+                            if (isSynthesized) {
+                                checkInit(TreeInfo.diagnosticPositionFor(var, vardecl),
+                                    var, "var.not.initialized.in.default.constructor");
+                            } else {
+                                checkInit(TreeInfo.diagEndPos(tree.body), var);
+                            }
+                        }
+                    }
                 }
                 List<AssignPendingExit> exits = pendingExits.toList();
                 pendingExits = new ListBuffer<AssignPendingExit>();
@@ -1691,7 +1707,7 @@
                     if (isInitialConstructor) {
                         inits.assign(exit.exit_inits);
                         for (int i = firstadr; i < nextadr; i++)
-                            checkInit(exit.tree.pos(), vars[i]);
+                            checkInit(exit.tree.pos(), vardecls[i].sym);
                     }
                 }
             } finally {
@@ -1706,7 +1722,7 @@
 
         public void visitVarDef(JCVariableDecl tree) {
             boolean track = trackable(tree.sym);
-            if (track && tree.sym.owner.kind == MTH) newVar(tree.sym);
+            if (track && tree.sym.owner.kind == MTH) newVar(tree);
             if (tree.init != null) {
                 Lint lintPrev = lint;
                 lint = lint.augment(tree.sym);
@@ -2239,11 +2255,11 @@
                 Flow.this.make = make;
                 startPos = tree.pos().getStartPosition();
 
-                if (vars == null)
-                    vars = new VarSymbol[32];
+                if (vardecls == null)
+                    vardecls = new JCVariableDecl[32];
                 else
-                    for (int i=0; i<vars.length; i++)
-                        vars[i] = null;
+                    for (int i=0; i<vardecls.length; i++)
+                        vardecls[i] = null;
                 firstadr = 0;
                 nextadr = 0;
                 pendingExits = new ListBuffer<AssignPendingExit>();
@@ -2255,8 +2271,8 @@
                 startPos = -1;
                 resetBits(inits, uninits, uninitsTry, initsWhenTrue,
                         initsWhenFalse, uninitsWhenTrue, uninitsWhenFalse);
-                if (vars != null) for (int i=0; i<vars.length; i++)
-                    vars[i] = null;
+                if (vardecls != null) for (int i=0; i<vardecls.length; i++)
+                    vardecls[i] = null;
                 firstadr = 0;
                 nextadr = 0;
                 pendingExits = null;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1240,7 +1240,8 @@
         CAPTURED(InferenceBound.UPPER) {
             @Override
             public boolean accepts(UndetVar t, InferenceContext inferenceContext) {
-                return !inferenceContext.free(t.getBounds(InferenceBound.UPPER, InferenceBound.LOWER));
+                return t.isCaptured() &&
+                        !inferenceContext.free(t.getBounds(InferenceBound.UPPER, InferenceBound.LOWER));
             }
 
             @Override
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Aug 06 16:54:56 2013 -0700
@@ -2649,6 +2649,13 @@
                                   InferenceContext inferenceContext) {
         MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC;
 
+        if (site.hasTag(TYPEVAR)) {
+            return resolveMemberReference(pos, env, referenceTree, site.getUpperBound(),
+                    name, argtypes, typeargtypes, boxingAllowed, methodCheck, inferenceContext);
+        }
+
+        site = types.capture(site);
+
         ReferenceLookupHelper boundLookupHelper;
         if (!name.equals(names.init)) {
             //method reference
@@ -2675,24 +2682,52 @@
 
         //merge results
         Pair<Symbol, ReferenceLookupHelper> res;
-        if (!lookupSuccess(unboundSym)) {
-            res = new Pair<Symbol, ReferenceLookupHelper>(boundSym, boundLookupHelper);
-            env.info.pendingResolutionPhase = boundEnv.info.pendingResolutionPhase;
-        } else if (lookupSuccess(boundSym)) {
-            res = new Pair<Symbol, ReferenceLookupHelper>(ambiguityError(boundSym, unboundSym), boundLookupHelper);
-            env.info.pendingResolutionPhase = boundEnv.info.pendingResolutionPhase;
-        } else {
-            res = new Pair<Symbol, ReferenceLookupHelper>(unboundSym, unboundLookupHelper);
-            env.info.pendingResolutionPhase = unboundEnv.info.pendingResolutionPhase;
-        }
+        Symbol bestSym = choose(boundSym, unboundSym);
+        res = new Pair<Symbol, ReferenceLookupHelper>(bestSym,
+                bestSym == unboundSym ? unboundLookupHelper : boundLookupHelper);
+        env.info.pendingResolutionPhase = bestSym == unboundSym ?
+                unboundEnv.info.pendingResolutionPhase :
+                boundEnv.info.pendingResolutionPhase;
 
         return res;
     }
-    //private
-        boolean lookupSuccess(Symbol s) {
+    //where
+        private Symbol choose(Symbol s1, Symbol s2) {
+            if (lookupSuccess(s1) && lookupSuccess(s2)) {
+                return ambiguityError(s1, s2);
+            } else if (lookupSuccess(s1) ||
+                    (canIgnore(s2) && !canIgnore(s1))) {
+                return s1;
+            } else if (lookupSuccess(s2) ||
+                    (canIgnore(s1) && !canIgnore(s2))) {
+                return s2;
+            } else {
+                return s1;
+            }
+        }
+
+        private boolean lookupSuccess(Symbol s) {
             return s.kind == MTH || s.kind == AMBIGUOUS;
         }
 
+        private boolean canIgnore(Symbol s) {
+            switch (s.kind) {
+                case ABSENT_MTH:
+                    return true;
+                case WRONG_MTH:
+                    InapplicableSymbolError errSym =
+                            (InapplicableSymbolError)s;
+                    return new Template(MethodCheckDiag.ARITY_MISMATCH.regex())
+                            .matches(errSym.errCandidate().snd);
+                case WRONG_MTHS:
+                    InapplicableSymbolsError errSyms =
+                            (InapplicableSymbolsError)s;
+                    return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty();
+                default:
+                    return false;
+            }
+        }
+
     /**
      * Helper for defining custom method-like lookup logic; a lookup helper
      * provides hooks for (i) the actual lookup logic and (ii) accessing the
@@ -3504,7 +3539,9 @@
                 List<Type> argtypes,
                 List<Type> typeargtypes) {
             Map<Symbol, JCDiagnostic> candidatesMap = mapCandidates();
-            Map<Symbol, JCDiagnostic> filteredCandidates = filterCandidates(candidatesMap);
+            Map<Symbol, JCDiagnostic> filteredCandidates = compactMethodDiags ?
+                    filterCandidates(candidatesMap) :
+                    mapCandidates();
             if (filteredCandidates.isEmpty()) {
                 filteredCandidates = candidatesMap;
             }
@@ -3556,8 +3593,7 @@
                 Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>();
                 for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) {
                     JCDiagnostic d = _entry.getValue();
-                    if (!compactMethodDiags ||
-                            !new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) {
+                    if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) {
                         candidates.put(_entry.getKey(), d);
                     }
                 }
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue Aug 06 16:54:56 2013 -0700
@@ -674,7 +674,11 @@
         if (tree.varargsElement != null)
             tree.varargsElement = types.erasure(tree.varargsElement);
         else
-            Assert.check(tree.args.length() == argtypes.length());
+            if (tree.args.length() != argtypes.length()) {
+                log.error(tree.pos(),
+                              "method.invoked.with.incorrect.number.arguments",
+                              tree.args.length(), argtypes.length());
+            }
         tree.args = translateArgs(tree.args, argtypes, tree.varargsElement);
 
         tree.type = types.erasure(tree.type);
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1820,7 +1820,6 @@
                 msym.externalType(types).getParameterTypes());
         if (!msym.isDynamic()) {
             code.statBegin(tree.pos);
-            code.markStatBegin();
         }
         result = m.invoke();
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/model/JavacAnnoConstructs.java	Tue Aug 06 16:54:56 2013 -0700
@@ -108,20 +108,38 @@
     }
 
     // Helper to getAnnotation[s]
-    private static <A extends Annotation> Attribute.Compound getAttributeOnClass(ClassSymbol annotated,
-                                                                Class<A> annoType) {
+    private static <A extends Annotation> Attribute.Compound getAttributeOnClass(
+            ClassSymbol annotated,
+            final Class<A> annoType)
+    {
         boolean inherited = annoType.isAnnotationPresent(Inherited.class);
         Attribute.Compound result = null;
-        while (annotated.name != annotated.name.table.names.java_lang_Object) {
+
+        result = getAttribute(annotated, annoType);
+        if (result != null || !inherited)
+            return result;
+
+        while ((annotated = nextSupertypeToSearch(annotated)) != null) {
             result = getAttribute(annotated, annoType);
-            if (result != null || !inherited)
-                break;
-            Type sup = annotated.getSuperclass();
-            if (!sup.hasTag(CLASS) || sup.isErroneous())
-                break;
-            annotated = (ClassSymbol) sup.tsym;
+            if (result != null)
+                return result;
         }
-        return result;
+        return null; // no more supertypes to search
+    }
+
+    /**
+     * Returns the next type to search for inherited annotations or {@code null}
+     * if the next type can't be found.
+     */
+    private static ClassSymbol nextSupertypeToSearch(ClassSymbol annotated) {
+        if (annotated.name == annotated.name.table.names.java_lang_Object)
+            return null;
+
+        Type sup = annotated.getSuperclass();
+        if (!sup.hasTag(CLASS) || sup.isErroneous())
+            return null;
+
+        return (ClassSymbol) sup.tsym;
     }
 
     /**
@@ -129,8 +147,9 @@
      * annotations. This is the implementation of
      * Element.getAnnotations(Class).
      */
-    public static <A extends Annotation> A[] getAnnotations(Symbol annotated,
-                                                            Class<A> annoType) {
+    public static <A extends Annotation> A[] getAnnotationsByType(Symbol annotated,
+            Class<A> annoType)
+    {
         if (!annoType.isAnnotation())
             throw new IllegalArgumentException("Not an annotation type: "
                                                + annoType);
@@ -153,62 +172,48 @@
         }
 
         // So we have a containing type
-        String name = annoType.getName();
         String annoTypeName = annoType.getSimpleName();
         String containerTypeName = containerType.getSimpleName();
         int directIndex = -1, containerIndex = -1;
         Attribute.Compound direct = null, container = null;
-        Attribute.Compound[] rawAttributes = annotated.getRawAttributes().toArray(new Attribute.Compound[0]);
-
-        // Find directly present annotations
-        for (int i = 0; i < rawAttributes.length; i++) {
-            if (annoTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
-                directIndex = i;
-                direct = rawAttributes[i];
+        // Find directly (explicit or implicit) present annotations
+        int index = -1;
+        for (List<Attribute.Compound> list = annotated.getAnnotationMirrors();
+                !list.isEmpty();
+                list = list.tail) {
+            Attribute.Compound attribute = list.head;
+            index++;
+            if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
+                directIndex = index;
+                direct = attribute;
             } else if(containerTypeName != null &&
-                      containerTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
-                containerIndex = i;
-                container = rawAttributes[i];
+                      attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
+                containerIndex = index;
+                container = attribute;
             }
         }
 
         // Deal with inherited annotations
-        if (annotated.kind == Kinds.TYP &&
-                (annotated instanceof ClassSymbol)) {
-            ClassSymbol s = (ClassSymbol)annotated;
-            if (direct == null && container == null) {
-                direct = getAttributeOnClass(s, annoType);
-                container = getAttributeOnClass(s, containerType);
-
-                // both are inherited and found, put container last
-                if (direct != null && container != null) {
-                    directIndex = 0;
-                    containerIndex = 1;
-                } else if (direct != null) {
-                    directIndex = 0;
-                } else {
-                    containerIndex = 0;
-                }
-            } else if (direct == null) {
-                direct = getAttributeOnClass(s, annoType);
-                if (direct != null)
-                    directIndex = containerIndex + 1;
-            } else if (container == null) {
-                container = getAttributeOnClass(s, containerType);
-                if (container != null)
-                    containerIndex = directIndex + 1;
+        if (direct == null && container == null) {
+            if (annotated.kind == Kinds.TYP &&
+                    (annotated instanceof ClassSymbol)) {
+                ClassSymbol s = nextSupertypeToSearch((ClassSymbol)annotated);
+                if (s != null)
+                    return getAnnotationsByType(s, annoType);
             }
         }
 
         // Pack them in an array
-        Attribute[] contained0 = new Attribute[0];
+        Attribute[] contained0 = null;
         if (container != null)
             contained0 = unpackAttributes(container);
         ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
-        for (Attribute a : contained0)
-            if (a instanceof Attribute.Compound)
-                compounds = compounds.append((Attribute.Compound)a);
-        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[0]);
+        if (contained0 != null) {
+            for (Attribute a : contained0)
+                if (a instanceof Attribute.Compound)
+                    compounds = compounds.append((Attribute.Compound)a);
+        }
+        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
 
         int size = (direct == null ? 0 : 1) + contained.length;
         @SuppressWarnings("unchecked") // annoType is the Class for A
@@ -298,35 +303,38 @@
         }
 
         // So we have a containing type
-        String name = annoType.getName();
         String annoTypeName = annoType.getSimpleName();
         String containerTypeName = containerType.getSimpleName();
         int directIndex = -1, containerIndex = -1;
         Attribute.Compound direct = null, container = null;
-        Attribute.Compound[] rawAttributes = annotated.getAnnotationMirrors().toArray(new Attribute.Compound[0]);
-
-        // Find directly present annotations
-        for (int i = 0; i < rawAttributes.length; i++) {
-            if (annoTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
-                directIndex = i;
-                direct = rawAttributes[i];
+        // Find directly (explicit or implicit) present annotations
+        int index = -1;
+        for (List<? extends Attribute.Compound> list = annotated.getAnnotationMirrors();
+                !list.isEmpty();
+                list = list.tail) {
+            Attribute.Compound attribute = list.head;
+            index++;
+            if (attribute.type.tsym.flatName().contentEquals(annoTypeName)) {
+                directIndex = index;
+                direct = attribute;
             } else if(containerTypeName != null &&
-                      containerTypeName.equals(rawAttributes[i].type.tsym.flatName().toString())) {
-                containerIndex = i;
-                container = rawAttributes[i];
+                      attribute.type.tsym.flatName().contentEquals(containerTypeName)) {
+                containerIndex = index;
+                container = attribute;
             }
         }
 
         // Pack them in an array
-        Attribute[] contained0 = new Attribute[0];
+        Attribute[] contained0 = null;
         if (container != null)
             contained0 = unpackAttributes(container);
         ListBuffer<Attribute.Compound> compounds = ListBuffer.lb();
-        for (Attribute a : contained0) {
-            if (a instanceof Attribute.Compound)
-                compounds = compounds.append((Attribute.Compound)a);
+        if (contained0 != null) {
+            for (Attribute a : contained0)
+                if (a instanceof Attribute.Compound)
+                    compounds = compounds.append((Attribute.Compound)a);
         }
-        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[0]);
+        Attribute.Compound[] contained = compounds.toArray(new Attribute.Compound[compounds.size()]);
 
         int size = (direct == null ? 0 : 1) + contained.length;
         @SuppressWarnings("unchecked") // annoType is the Class for A
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Tue Aug 06 16:54:56 2013 -0700
@@ -4053,7 +4053,7 @@
             endPosMap = new HashMap<JCTree, Integer>();
         }
 
-        protected void storeEnd(JCTree tree, int endpos) {
+        public void storeEnd(JCTree tree, int endpos) {
             endPosMap.put(tree, errorEndPos > endpos ? errorEndPos : endpos);
         }
 
@@ -4091,7 +4091,7 @@
             super(parser);
         }
 
-        protected void storeEnd(JCTree tree, int endpos) { /* empty */ }
+        public void storeEnd(JCTree tree, int endpos) { /* empty */ }
 
         protected <T extends JCTree> T to(T t) {
             return t;
@@ -4127,14 +4127,6 @@
         }
 
         /**
-         * Store ending position for a tree, the value of which is the greater
-         * of last error position and the given ending position.
-         * @param tree   The tree.
-         * @param endpos The ending position to associate with the tree.
-         */
-        protected abstract void storeEnd(JCTree tree, int endpos);
-
-        /**
          * Store current token's ending position for a tree, the value of which
          * will be the greater of last error position and the ending position of
          * the current token.
--- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -905,6 +905,10 @@
 compiler.err.report.access=\
     {0} has {1} access in {2}
 
+# 0: symbol, 1: set of modifier, 2: symbol
+compiler.misc.report.access=\
+    {0} has {1} access in {2}
+
 compiler.err.ret.outside.meth=\
     return outside method
 
@@ -914,6 +918,10 @@
 compiler.err.signature.doesnt.match.intf=\
     signature does not match {0}; incompatible interfaces
 
+# 0: number, 1: number
+compiler.err.method.invoked.with.incorrect.number.arguments=\
+    method invoked with incorrect number of arguments; expected {0}, found {1}
+
 # 0: symbol, 1: symbol, 2: symbol
 compiler.err.does.not.override.abstract=\
     {0} is not abstract and does not override abstract method {1} in {2}
@@ -1069,6 +1077,10 @@
     variable {0} might not have been initialized
 
 # 0: symbol
+compiler.err.var.not.initialized.in.default.constructor=\
+    variable {0} not initialized in the default constructor
+
+# 0: symbol
 compiler.err.var.might.be.assigned.in.loop=\
     variable {0} might be assigned in loop
 
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/EndPosTable.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/EndPosTable.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,10 +43,17 @@
     public int getEndPos(JCTree tree);
 
     /**
+     * Store ending position for a tree, the value of which is the greater of
+     * last error position and the given ending position.
+     * @param tree The tree.
+     * @param endpos The ending position to associate with the tree.
+     */
+    public abstract void storeEnd(JCTree tree, int endpos);
+
+    /**
      * Give an old tree and a new tree, the old tree will be replaced with
      * the new tree, the position of the new tree will be that of the old
      * tree.
-     * not exist.
      * @param oldtree a JCTree to be replaced
      * @param newtree a JCTree to be replaced with
      * @return position of the old tree or Positions.NOPOS for non-existent mapping
--- a/langtools/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@
 public class TestCRLineSeparator extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4979486";
+    private static final String BUG_ID = "4979486-8014636";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
@@ -47,7 +47,7 @@
 
     //Input for string search tests.
     private static final String[][] TEST = {
-        {BUG_ID + FS + "pkg" + FS + "MyClass.html", "Line 1\n Line 2"}
+        {BUG_ID + FS + "pkg" + FS + "MyClass.html", "Line 1" + NL + " Line 2"}
     };
 
     private static final String[][] NEGATED_TEST = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,11 @@
 
 /*
  * @test
- * @bug 4232882
+ * @bug 4232882 8014636
  * @summary Javadoc strips all of the leading spaces when the comment
  *    does not begin with a star.  This RFE allows users to
  *    begin their comment without a leading star without leading
- *    spaces striped
+ *    spaces stripped
  * @author jamieh
  * @library ../lib/
  * @build JavadocTester
@@ -37,15 +37,15 @@
 
 public class LeadingSpaces extends JavadocTester {
 
-    private static final String BUG_ID = "4232882";
+    private static final String BUG_ID = "4232882-8014636";
     private static final String[][] TEST = {
         {BUG_ID + FS + "LeadingSpaces.html",
-"        1\n" +
-"          2\n" +
-"            3\n" +
-"              4\n" +
-"                5\n" +
-"                  6\n" +
+"        1" + NL +
+"          2" + NL +
+"            3" + NL +
+"              4" + NL +
+"                5" + NL +
+"                  6" + NL +
 "                    7"}
     };
     private static final String[][] NEGATED_TEST = NO_TEST;
--- a/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      4732864 6280605 7064544
+ * @bug      4732864 6280605 7064544 8014636
  * @summary  Make sure that you can link from one member to another using
  *           non-qualified name, furthermore, ensure the right one is linked.
  * @author   jamieh
@@ -36,7 +36,7 @@
 public class TestLinkTaglet extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4732864-6280605-7064544";
+    private static final String BUG_ID = "4732864-6280605-7064544-8014636";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
@@ -46,16 +46,16 @@
     //Input for string search tests.
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
-            " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
-            " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
-            " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n" +
-            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" +
+            "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
+            " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
+            " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
+            " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL +
+            " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
             " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
         },
         {BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
-            "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n" +
-            " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n" +
+            "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
+            " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>" + NL +
             " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>"
         },
         {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html",
--- a/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      8002387
+ * @bug      8002387 8014636
  * @summary  Improve rendered HTML formatting for {@code}
  * @library  ../lib/
  * @build    JavadocTester TestLiteralCodeInPre
@@ -33,7 +33,7 @@
 public class TestLiteralCodeInPre extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "8002387";
+    private static final String BUG_ID = "8002387-8014636";
     private static final String OUTPUT_DIR = BUG_ID;
 
     //Javadoc arguments.
--- a/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,9 @@
 
 /*
  * @test
- * @bug      4460354
+ * @bug      4460354 8014636
  * @summary  Test to make sure that relative paths are redirected in the
  *           output so that they are not broken.
- *           NOTE: these tests have \\n instead of NL because they are user
- *           generated new lines, not Java generated.
  * @author   jamieh
  * @library  ../lib/
  * @build    JavadocTester
@@ -38,7 +36,7 @@
 public class TestRelativeLinks extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4460354";
+    private static final String BUG_ID = "4460354-8014636";
 
     //Javadoc arguments.
     private static final String[] ARGS = new String[] {
@@ -58,7 +56,7 @@
         {BUG_ID + FS + "pkg" + FS + "package-summary.html",
             "<a href=\"relative-package-link.html\">relative package link</a>"},
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            " <a\n" +
+            " <a" + NL +
             " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."},
 
         //These relative paths should be redirected because they are in different
@@ -74,7 +72,7 @@
         {BUG_ID + FS + "index-all.html",
             "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
         {BUG_ID + FS + "index-all.html",
-            " <a\n" +
+            " <a" + NL +
             " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
 
 
@@ -92,7 +90,7 @@
         {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
             "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"},
         {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
-            " <a\n" +
+            " <a" + NL +
             " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
 
         //PACKAGE OVERVIEW
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/AnchorTest2.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,20 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020313
+ * @summary doclint doesn't reset HTML anchors correctly
+ * @build DocLintTester
+ * @run main DocLintTester -ref AnchorTest2.out AnchorTest2.java AnchorTest2a.java
+ * @run main DocLintTester -ref AnchorTest2.out AnchorTest2a.java AnchorTest2.java
+ */
+
+/** */
+public class AnchorTest2 {
+    /** <a name="AnchorTest2"> </a> */
+    public void a_name_AnchorTest2() { }
+
+    /** <a name="AnchorTest2"> </a> */
+    public void a_name_AnchorTest2_already_defined() { }
+
+    /** <a name="AnchorTest2a"> </a> */
+    public void a_name_AnchorTest2a_defined_in_other_file() { }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/AnchorTest2.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,4 @@
+AnchorTest2.java:15: error: anchor already defined: AnchorTest2
+    /** <a name="AnchorTest2"> </a> */
+           ^
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/AnchorTest2a.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,7 @@
+/* /nodynamiccopyright/ */
+
+/**
+ * <a name="AnchorTest2a"> </a>
+ */
+public class AnchorTest2a { }
+
--- a/langtools/test/tools/doclint/BadPackageCommentTest.out	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/doclint/BadPackageCommentTest.out	Tue Aug 06 16:54:56 2013 -0700
@@ -1,3 +1,6 @@
+BadPackageCommentTest.java:13: warning: documentation comment not expected here
+package p;
+^
 BadPackageCommentTest.java:11: error: no tag name after @
  * @@@
    ^
@@ -8,3 +11,4 @@
  * @@@
      ^
 3 errors
+1 warning
--- a/langtools/test/tools/doclint/DocLintTester.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/doclint/DocLintTester.java	Tue Aug 06 16:54:56 2013 -0700
@@ -123,7 +123,7 @@
     private static final Pattern dirFileLine = Pattern.compile(
             "(?m)"                          // multi-line mode
             + "^(.*?)"                      // directory part of file name
-            + "([A-Za-z0-9.]+:[0-9]+:)");   // file name and line number
+            + "([-A-Za-z0-9.]+:[0-9]+:)");  // file name and line number
 
     String removeFileNames(String s) {
         Matcher m = dirFileLine.matcher(s);
--- a/langtools/test/tools/doclint/ReferenceTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/doclint/ReferenceTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 8004832
+ * @bug 8004832 8020556
  * @summary Add new doclint package
  * @build DocLintTester
  * @run main DocLintTester -Xmsgs:-reference ReferenceTest.java
@@ -48,5 +48,11 @@
      * @throws Exception description
      */
     public void exception_not_thrown() { }
+
+    /**
+     * @param <T> throwable
+     * @throws T description
+     */
+    public <T extends Throwable> void valid_throws_generic() throws T { }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/bad/Test.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020664 8021215
+ * @summary doclint gives incorrect warnings on normal package statements
+ * @library ../..
+ * @build DocLintTester
+ * @run main DocLintTester -ref Test.out Test.java
+ * @compile/fail/ref=Test.javac.out -XDrawDiagnostics -Werror -Xdoclint:all Test.java
+ */
+
+/** Unexpected comment */
+package bad;
+
+/** */
+class Test { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/bad/Test.javac.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,4 @@
+Test.java:12:1: compiler.warn.proc.messager: documentation comment not expected here
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/bad/Test.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,4 @@
+Test.java:12: warning: documentation comment not expected here
+package bad;
+^
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/bad/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,12 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020664 8021215
+ * @summary doclint gives incorrect warnings on normal package statements
+ * @library ../..
+ * @build DocLintTester
+ * @run main DocLintTester -ref package-info.out package-info.java
+ * @compile/fail/ref=package-info.javac.out -XDrawDiagnostics -Werror -Xdoclint:all package-info.java
+ */
+
+// missing comment
+package bad;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/bad/package-info.javac.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,4 @@
+package-info.java:12:1: compiler.warn.proc.messager: no comment
+- compiler.err.warnings.and.werror
+1 error
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/bad/package-info.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,4 @@
+package-info.java:12: warning: no comment
+package bad;
+^
+1 warning
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/good/Test.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020664 8021215
+ * @summary doclint gives incorrect warnings on normal package statements
+ * @library ../..
+ * @build DocLintTester
+ * @run main DocLintTester Test.java
+ * @compile -Xdoclint:all Test.java
+ */
+
+// no doc comment
+package good;
+
+/** */
+class Test { }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/doclint/packageTests/good/package-info.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020664 8021215
+ * @summary doclint gives incorrect warnings on normal package statements
+ * @library ../..
+ * @build DocLintTester
+ * @run main DocLintTester package-info.java
+ * @compile -Xdoclint:all package-info.java
+ */
+
+/** Description. */
+package good;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/ErasureTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016013
+ * @summary Compiler incorrectly treats annotated and unannotated type variable bounds as different types
+ * @compile -doe ErasureTest.java
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
+@interface Advanced {}
+
+class U {}
+interface I {}
+
+class ErasureTest {
+     <T extends U & @Advanced I> void TestMethod(T arg1) { }
+    public static void main(String argv[]) {
+        ErasureTest t1 = new ErasureTest(){
+            public <T extends @Advanced U & I> void TestMethod(T arg1) { }
+        };
+
+        ErasureTest t2 = new ErasureTest(){
+            public <T extends U & @Advanced I> void TestMethod(T arg1) { }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/MethodInvokedWithWrongNumberOfArgs.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.method.invoked.with.incorrect.number.arguments
+// options: -Xlint:-options -source 6 -target 6
+
+class MethodInvokedWithWrongNumberOfArgs {
+    static java.lang.invoke.MethodHandle getNamedMember;
+    public static Object getMember(String name, Object rec) throws Throwable {
+        return getNamedMember.invoke(rec, name);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/ReportAccessFragment.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.prob.found.req
+// key: compiler.misc.invalid.mref
+// key: compiler.misc.report.access
+
+class ReportAccessFragment {
+    void test(Object o) {
+        Runnable r = o::clone;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/diags/examples/VarNotIntializedInDefaultConstructor.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.err.var.not.initialized.in.default.constructor
+
+class X {
+    final int j;
+}
--- a/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/generics/diamond/6939780/T6939780.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939780 7020044 8009459
+ * @bug 6939780 7020044 8009459 8021338
  *
  * @summary  add a warning to detect diamond sites
  * @author mcimadamore
@@ -36,4 +36,15 @@
 
     void gw(Foo<?> fw) { }
     void gn(Foo<Number> fn) { }
+
+    static class Foo2<X> {
+        X copy(X t) {
+            return t;
+        }
+    }
+
+    void testReciever() {
+        Number s = new Foo2<Number>().copy(0);
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/jvm/T8020689.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,36 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 8020689
+ * @summary Making sure the LineNumberTable entry is correctly generated for the leading method invocation in the else section
+ * @compile T8020689.java
+ * @run main T8020689
+ */
+
+public class T8020689 {
+
+    public static void main(String... args) {
+        if (args.length > 0) {
+            a();
+        } else {
+            b();
+        }
+    }
+
+    static void a() {
+    }
+
+    static void b() {
+        assertLine(15);
+    }
+
+    public static void assertLine(int expectedline) {
+        Exception e = new Exception("expected line#: " + expectedline);
+        int myline = e.getStackTrace()[2].getLineNumber();
+        if( myline != expectedline) {
+            throw new RuntimeException("Incorrect line number " +
+                    "expected: " + expectedline +
+                    ", got: " + myline, e);
+        }
+        System.out.format("Got expected line number %d correct %n", myline);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8016081/T8016081.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016081
+ * @summary field initialized with lambda in annotation types doesn't compile
+ * @compile T8016081.java
+ */
+
+class T8016081 {
+    interface fint { int get(); }
+
+    @interface atype {
+        fint fld = ()->( fld == null ?0 : 1);
+    }
+
+    @atype class T {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8020804/T8020804.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8020804
+ * @summary javac crashes when speculative attribution infers intersection type with array component
+ * @compile T8020804.java
+ */
+
+import java.util.*;
+
+class T8020804 {
+    interface Supplier<D> {
+        D make();
+    }
+
+    void m(Object o) { }
+    void m(char[] c) { }
+
+    <C extends Collection<?>> C g(Supplier<C> sc) { return null; }
+
+    void test() {
+        m(g(LinkedList<Double>::new));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8020843/T8020843a.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,16 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020843
+ * @summary javac crashes on accessibility check with method reference with typevar receiver
+ * @compile/fail/ref=T8020843a.out -XDrawDiagnostics T8020843a.java
+ */
+
+class T8020843a {
+    interface Function<X, Y> {
+        Y m(X x);
+    }
+
+    <T> void test(T t) {
+        Function<T, Object> ss = T::clone;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8020843/T8020843a.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,2 @@
+T8020843a.java:14:34: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.report.access: clone(), protected, java.lang.Object))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8020843/T8020843b.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,27 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8020843
+ * @summary javac crashes on accessibility check with method reference with typevar receiver
+ * @compile/fail/ref=T8020843b.out -XDrawDiagnostics T8020843b.java
+ */
+
+class T8020843b {
+    interface Function<X, Y> {
+        Y m(X x);
+    }
+
+    interface BiFunction<X, Y, Z> {
+        Z m(X x, Y y);
+    }
+
+    Object m(int i) { return null; }
+    static Object m(String t) { return null; }
+
+    Object m2(int i) { return null; }
+    static Object m2(long t) { return null; }
+
+    static void test() {
+        Function<T8020843b, Object> f1 = T8020843b::m; //show bound case diag
+        BiFunction<T8020843b, String, Object> f2 = T8020843b::m2; //show unbound case diag
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/lambda/8020843/T8020843b.out	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,3 @@
+T8020843b.java:24:42: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m, T8020843b,{(compiler.misc.inapplicable.method: kindname.method, T8020843b, m(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: T8020843b, int))),(compiler.misc.inapplicable.method: kindname.method, T8020843b, m(java.lang.String), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: T8020843b, java.lang.String)))}))
+T8020843b.java:25:52: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, m2, T8020843b,java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, T8020843b, m2(int), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, int))),(compiler.misc.inapplicable.method: kindname.method, T8020843b, m2(long), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, long)))}))
+2 errors
--- a/langtools/test/tools/javac/lambda/MethodReference28.out	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/lambda/MethodReference28.out	Tue Aug 06 16:54:56 2013 -0700
@@ -9,6 +9,6 @@
 MethodReference28.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:47:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:52:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer,java.lang.Integer, MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: MethodReference28, java.lang.Integer))))
-MethodReference28.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch)))
+MethodReference28.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String))))
 MethodReference28.java:54:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], MethodReference28,int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: MethodReference28, java.lang.String))))
 13 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/positions/TreeEndPosTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8017216 8019422 8019421
+ * @summary verify start and end positions
+ * @run main TreeEndPosTest
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class TreeEndPosTest {
+    private static JavaFileManager getJavaFileManager(JavaCompiler compiler,
+            DiagnosticCollector dc) {
+        return compiler.getStandardFileManager(dc, null, null);
+    }
+
+    static class JavaSource extends SimpleJavaFileObject {
+
+        final String source;
+        int startPos;
+        int endPos;
+
+        private JavaSource(String filename, String source) {
+            super(URI.create("myfo:/" + filename), JavaFileObject.Kind.SOURCE);
+            this.source = source;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+
+        static JavaSource createJavaSource(String preamble, String body,
+                String postamble, String expected) {
+            JavaSource js = createJavaSource(preamble, body, postamble, -1, -1);
+            js.startPos = js.source.indexOf(expected);
+            js.endPos   = js.startPos + expected.length();
+            return js;
+        }
+
+        static JavaSource createJavaSource(String body, String expected) {
+            return createJavaSource(null, body, null, expected);
+        }
+
+        private static JavaSource createJavaSource(String preamble, String body,
+                String postamble, int start, int end) {
+            final String name = "Bug";
+            StringBuilder code = new StringBuilder();
+            if (preamble != null) {
+                code.append(preamble);
+            }
+            code.append("public class " + name + "{");
+            if (body != null) {
+                code.append(body);
+            }
+            code.append("}");
+            if (postamble != null) {
+                code.append(postamble);
+            }
+            JavaSource js = new JavaSource(name + ".java", code.toString());
+            js.startPos = start;
+            js.endPos = end;
+            return js;
+        }
+    }
+
+    public static void main(String... args) throws IOException {
+        testUninitializedVariable();
+        testMissingAnnotationValue();
+        testFinalVariableWithDefaultConstructor();
+        testFinalVariableWithConstructor();
+    }
+
+    static void testUninitializedVariable() throws IOException {
+        compile(JavaSource.createJavaSource("Object o = new A().new B(); class A { }",
+                "B()"));
+    }
+    static void testMissingAnnotationValue() throws IOException {
+        compile(JavaSource.createJavaSource("@Foo(\"vvvv\")",
+                null, "@interface Foo { }", "\"vvvv\""));
+    }
+
+    static void testFinalVariableWithDefaultConstructor() throws IOException {
+        compile(JavaSource.createJavaSource("private static final String Foo; public void bar() { }",
+                "private static final String Foo;"));
+    }
+
+    static void testFinalVariableWithConstructor() throws IOException {
+        compile(JavaSource.createJavaSource("public Bug (){} private static final String Foo; public void bar() { }",
+                "{}"));
+    }
+
+    static void compile(JavaSource src) throws IOException {
+        ByteArrayOutputStream ba = new ByteArrayOutputStream();
+        PrintWriter writer = new PrintWriter(ba);
+        File tempDir = new File(".");
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        DiagnosticCollector dc = new DiagnosticCollector();
+        JavaFileManager javaFileManager = getJavaFileManager(compiler, dc);
+        List<String> options = new ArrayList<>();
+        options.add("-cp");
+        options.add(tempDir.getPath());
+        options.add("-d");
+        options.add(tempDir.getPath());
+        options.add("-XDshouldStopPolicy=GENERATE");
+
+        List<JavaFileObject> sources = new ArrayList<>();
+        sources.add(src);
+        JavaCompiler.CompilationTask task =
+                compiler.getTask(writer, javaFileManager,
+                dc, options, null,
+                sources);
+        task.call();
+        for (Diagnostic diagnostic : (List<Diagnostic>) dc.getDiagnostics()) {
+            long actualStart = diagnostic.getStartPosition();
+            long actualEnd = diagnostic.getEndPosition();
+            System.out.println("Source: " + src.source);
+            System.out.println("Diagnostic: " + diagnostic);
+            System.out.print("Start position: Expected: " + src.startPos);
+            System.out.println(", Actual: " + actualStart);
+            System.out.print("End position: Expected: " + src.endPos);
+            System.out.println(", Actual: " + actualEnd);
+            if (src.startPos != actualStart || src.endPos != actualEnd) {
+                throw new RuntimeException("error: trees don't match");
+            }
+        }
+    }
+}
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,12 +23,11 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8007961
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
  * @library supportingAnnotations
- * @ignore  8013407: test failures for repeating annotations
  * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  * @compile -processor ElementRepAnnoTester -proc:only
  * MixRepeatableAndOfficialContainerInheritedA1Test.java
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,12 +23,11 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8007961
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
  * @library supportingAnnotations
- * @ignore  8013407: test failures for repeating annotations
  * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  * @compile -processor ElementRepAnnoTester -proc:only
  * MixRepeatableAndOfficialContainerInheritedB1Test.java
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,12 +23,11 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8007961
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
  * @library supportingAnnotations
- * @ignore  8013407: test failures for repeating annotations
  * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  * @compile -processor ElementRepAnnoTester -proc:only
  * MixRepeatableAndOfficialContainerInheritedB2Test.java
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,12 +23,11 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8007961
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
  * @library supportingAnnotations
- * @ignore  8013407: test failures for repeating annotations
  * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java
  */
--- a/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/langtools/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -23,12 +23,11 @@
 
 /*
  * @test
- * @bug     8004822
+ * @bug     8004822 8007961
  * @author  mnunez
  * @summary Language model api test basics for repeating annotations
  * @library /tools/javac/lib
  * @library supportingAnnotations
- * @ignore  8013407: test failures for repeating annotations
  * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
  * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/model/inheritedByType/EnsureOrder.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary test that order is respected when inheriting both legacy container and single anno
+ * @bug 8007961
+ * @library /tools/javac/lib
+ * @build   JavacTestingAbstractProcessor EnsureOrder
+ * @compile -processor EnsureOrder -proc:only EnsureOrder.java
+ */
+
+import java.util.Set;
+import java.lang.annotation.*;
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import static javax.lang.model.SourceVersion.*;
+import javax.lang.model.element.*;
+import javax.lang.model.util.*;
+import static javax.lang.model.util.ElementFilter.*;
+import static javax.tools.Diagnostic.Kind.*;
+import static javax.tools.StandardLocation.*;
+import com.sun.tools.javac.util.Assert;
+
+@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE})
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(Foos.class)
+@interface Foo {
+    int value();
+}
+
+@Target({ElementType.TYPE_PARAMETER, ElementType.TYPE})
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+@interface Foos {
+    Foo[] value();
+}
+
+@Foos({@Foo(0), @Foo(1)}) @Foo(2)
+class Base {}
+
+class Sub extends Base {}
+
+public class EnsureOrder<@Foos({@Foo(0), @Foo(1)}) @Foo(2)T> extends JavacTestingAbstractProcessor {
+    public boolean process(Set<? extends TypeElement> annotations,
+                           RoundEnvironment roundEnv) {
+        if (!roundEnv.processingOver()) {
+            int hasRun = 0;
+            for (Element element : roundEnv.getRootElements()) {
+                Name elemName = element.getSimpleName();
+                if (elemName.contentEquals("Base")) {
+                    hasRun++;
+                    Foo[] foos = element.getAnnotationsByType(Foo.class);
+                    Assert.check(foos.length == 3);
+                    Assert.check(foos[0].value() == 0);
+                    Assert.check(foos[1].value() == 1);
+                    Assert.check(foos[2].value() == 2);
+                }
+                if (elemName.contentEquals("Sub")) {
+                    hasRun++;
+                    Foo[] foos = element.getAnnotationsByType(Foo.class);
+                    Assert.check(foos.length == 3);
+                    Assert.check(foos[0].value() == 0);
+                    Assert.check(foos[1].value() == 1);
+                    Assert.check(foos[2].value() == 2);
+                }
+                if (elemName.contentEquals("EnsureOrder")) {
+                    for (TypeParameterElement t : ((TypeElement)element).getTypeParameters()) {
+                        if (t.getSimpleName().contentEquals("T")) {
+                            hasRun++;
+                            Foo[] foos = t.getAnnotationsByType(Foo.class);
+                            Assert.check(foos.length == 3);
+                            Assert.check(foos[0].value() == 0);
+                            Assert.check(foos[1].value() == 1);
+                            Assert.check(foos[2].value() == 2);
+                        }
+                    }
+                }
+            }
+            if (hasRun != 3)
+                throw new RuntimeException("Couldn't find elements");
+        }
+        return true;
+    }
+}
--- a/nashorn/.hgtags	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/.hgtags	Tue Aug 06 16:54:56 2013 -0700
@@ -210,3 +210,4 @@
 542b7803f0389a91fab58608a0f46fac0e15d759 jdk8-b98
 10a1ab9e20a42d278aa1a89698f2a4cf5883d00d jdk8-b99
 598321c438b52d9408a2671fb3fc2b2947d0f654 jdk8-b100
+a302b05d0ee460679501dc01004f70eb395fadf5 jdk8-b101
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -152,14 +152,14 @@
     }
 
     static MethodGenerator makeStaticInitializer(final ClassVisitor cv, final String name) {
-        final int access = ACC_PUBLIC | ACC_STATIC;
+        final int access =  ACC_PUBLIC | ACC_STATIC;
         final String desc = DEFAULT_INIT_DESC;
         final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
         return new MethodGenerator(mv, access, name, desc);
     }
 
     static MethodGenerator makeConstructor(final ClassVisitor cv) {
-        final int access = ACC_PUBLIC;
+        final int access = 0;
         final String name = INIT;
         final String desc = DEFAULT_INIT_DESC;
         final MethodVisitor mv = cv.visitMethod(access, name, desc, null, null);
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.tools.nasgen;
 
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
 import static jdk.internal.org.objectweb.asm.Opcodes.H_INVOKESTATIC;
@@ -80,7 +81,7 @@
     byte[] getClassBytes() {
         // new class extensing from ScriptObject
         final String superClass = (constructor != null)? SCRIPTFUNCTIONIMPL_TYPE : SCRIPTOBJECT_TYPE;
-        cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, superClass, null);
+        cw.visit(V1_7, ACC_FINAL, className, null, superClass, null);
         if (memberCount > 0) {
             // add fields
             emitFields();
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/PrototypeGenerator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.tools.nasgen;
 
+import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
 import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
 import static jdk.internal.org.objectweb.asm.Opcodes.V1_7;
@@ -60,7 +61,7 @@
 
     byte[] getClassBytes() {
         // new class extensing from ScriptObject
-        cw.visit(V1_7, ACC_PUBLIC | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null);
+        cw.visit(V1_7, ACC_FINAL | ACC_SUPER, className, null, PROTOTYPEOBJECT_TYPE, null);
         if (memberCount > 0) {
             // add fields
             emitFields();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/exclude/exclude_list.txt	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<excludeList>
+</excludeList>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/exclude/exclude_list_cc.txt	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<excludeList>
+  <test id="JDK-8014647.js" />
+  <test id="javaclassoverrides.js" />
+</excludeList>
--- a/nashorn/make/build.xml	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/make/build.xml	Tue Aug 06 16:54:56 2013 -0700
@@ -47,17 +47,22 @@
     <!-- check if testng.jar is avaiable -->
     <available property="testng.available" file="${file.reference.testng.jar}"/>
 
-	<!-- enable/disable make code coverage -->
-	<condition property="cc.enabled">
-		<istrue value="${make.code.coverage}" />
-	</condition>
+    <!-- enable/disable make code coverage -->
+    <condition property="cc.enabled">
+        <istrue value="${make.code.coverage}" />
+    </condition>
+
+    <!-- exclude tests in exclude lists -->
+    <condition property="exclude.list" value="./exclude/exclude_list_cc.txt" else="./exclude/exclude_list.txt">
+      <istrue value="${make.code.coverage}" />
+    </condition>
   </target>
 
   <target name="init" depends="init-conditions, init-cc">
 
-	<!-- extends jvm args -->
-	<property name="run.test.jvmargs" value="${run.test.jvmargs.main}  ${run.test.cc.jvmargs}"/>
-	<property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main}  ${run.test.cc.jvmargs}" />
+    <!-- extends jvm args -->
+    <property name="run.test.jvmargs" value="${run.test.jvmargs.main}  ${run.test.cc.jvmargs}"/>
+    <property name="run.test.jvmargs.octane" value="${run.test.jvmargs.octane.main}  ${run.test.cc.jvmargs}" />
 
     <echo message="run.test.jvmargs=${run.test.jvmargs}"/>
     <echo message="run.test.jvmargs.octane=${run.test.jvmargs.octane}"/>
@@ -262,6 +267,11 @@
 grant codeBase "file:/${basedir}/test/script/basic/JDK-8010946-privileged.js" {
     permission java.util.PropertyPermission "java.security.policy", "read";
 };
+
+grant codeBase "file:/${basedir}/test/script/basic/classloader.js" {
+    permission java.lang.RuntimePermission "nashorn.JavaReflection";
+};
+
     </echo>
 
     <replace file="${build.dir}/nashorn.policy"><replacetoken>\</replacetoken><replacevalue>/</replacevalue></replace>    <!--hack for Windows - to make URLs with normal path separators -->
@@ -284,19 +294,6 @@
   </target>
 
   <target name="test" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
-    <java classname="${nashorn.shell.tool}" fork="true" dir="${test.script.dir}/representations" output="${build.dir}/output1.log" error="${build.dir}/err.log">
-      <jvmarg line="${ext.class.path}"/>
-      <jvmarg line="-Dnashorn.fields.dual=true"/>
-      <arg value="NASHORN-592a.js"/>
-    </java>
-    <java classname="${nashorn.shell.tool}" fork="true" dir="${test.script.dir}/representations" output="${build.dir}/output2.log" error="${build.dir}/err.log">
-      <jvmarg line="${ext.class.path}"/>
-      <arg value="NASHORN-592a.js"/>
-    </java>
-    <condition property="representation-ok">
-      <filesmatch file1="${build.dir}/output1.log" file2="${build.dir}/output2.log"/>
-    </condition>
-    <fail unless="representation-ok">Representation test failed - output differs!</fail>
     <fileset id="test.classes" dir="${build.test.classes.dir}">
       <include name="**/api/javaaccess/*Test.class"/>
       <include name="**/api/scripting/*Test.class"/>
@@ -316,6 +313,7 @@
         <propertyref prefix="test-sys-prop."/>
         <mapper from="test-sys-prop.*" to="*" type="glob"/>
       </propertyset>
+      <sysproperty key="test.js.excludes.file" value="${exclude.list}"/>
       <classpath>
           <pathelement path="${run.test.classpath}"/>
       </classpath>
--- a/nashorn/make/code_coverage.xml	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/make/code_coverage.xml	Tue Aug 06 16:54:56 2013 -0700
@@ -132,7 +132,7 @@
       <arg value="-exclude"/>
       <arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/>
       <arg value="-exclude"/>
-      <arg value="jdk\.nashorn\.internal\.javaadapters*"/>
+      <arg value="jdk\.nashorn\.javaadapters*"/>
       <arg value="-exclude"/>
       <arg value="jdk\.nashorn\.internal\.objects\.annotations*"/>
       <arg value="-exclude"/>
--- a/nashorn/make/project.properties	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/make/project.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -223,7 +223,6 @@
 run.test.user.country=TR
 
 #  -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMethods
-# add '-Dtest.js.outofprocess' to run each test in a new sub-process
 run.test.jvmargs.main=-server -Xmx${run.test.xmx} -XX:+TieredCompilation -ea -Dfile.encoding=UTF-8 -Duser.language=${run.test.user.language} -Duser.country=${run.test.user.country}
 
 #-XX:+HeapDumpOnOutOfMemoryError -XX:-UseCompressedKlassPointers -XX:+PrintHeapAtGC -XX:ClassMetaspaceSize=300M  
@@ -231,6 +230,9 @@
 
 run.test.jvmsecurityargs=-Xverify:all -Djava.security.properties=${basedir}/make/java.security.override -Djava.security.manager -Djava.security.policy=${basedir}/build/nashorn.policy
 
+# VM options for script tests with @fork option
+test-sys-prop.test.fork.jvm.options=${run.test.jvmargs.main} ${run.test.jvmsecurityargs}
+
 # path of rhino.jar for benchmarks
 rhino.jar=
 
--- a/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/internal/dynalink/beans/AbstractJavaLinker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -303,14 +303,13 @@
     private static MethodHandle unreflectSafely(AccessibleObject m) {
         if(m instanceof Method) {
             final Method reflMethod = (Method)m;
-            final MethodHandle handle = SafeUnreflector.unreflect(reflMethod);
+            final MethodHandle handle = Lookup.PUBLIC.unreflect(reflMethod);
             if(Modifier.isStatic(reflMethod.getModifiers())) {
                 return StaticClassIntrospector.editStaticMethodHandle(handle);
             }
             return handle;
         }
-        return StaticClassIntrospector.editConstructorMethodHandle(SafeUnreflector.unreflectConstructor(
-                (Constructor<?>)m));
+        return StaticClassIntrospector.editConstructorMethodHandle(Lookup.PUBLIC.unreflectConstructor((Constructor<?>)m));
     }
 
     private static DynamicMethod mergeMethods(SingleDynamicMethod method, DynamicMethod existing, Class<?> clazz, String name) {
--- a/nashorn/src/jdk/internal/dynalink/beans/FacetIntrospector.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/internal/dynalink/beans/FacetIntrospector.java	Tue Aug 06 16:54:56 2013 -0700
@@ -92,6 +92,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
+import jdk.internal.dynalink.support.Lookup;
 
 /**
  * Base for classes that expose class field and method information to an {@link AbstractJavaLinker}. There are
@@ -160,11 +161,11 @@
 
 
     MethodHandle unreflectGetter(Field field) {
-        return editMethodHandle(SafeUnreflector.unreflectGetter(field));
+        return editMethodHandle(Lookup.PUBLIC.unreflectGetter(field));
     }
 
     MethodHandle unreflectSetter(Field field) {
-        return editMethodHandle(SafeUnreflector.unreflectSetter(field));
+        return editMethodHandle(Lookup.PUBLIC.unreflectSetter(field));
     }
 
     /**
--- a/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflector.java	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are
-       met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the copyright holder nor the names of
-         contributors may be used to endorse or promote products derived from
-         this software without specific prior written permission.
-
-       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
-       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package jdk.internal.dynalink.beans;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import jdk.internal.dynalink.beans.sandbox.Unreflector;
-
-/**
- * Provides lookup of unreflected method handles through delegation to an instance of {@link SafeUnreflectorImpl}. If
- * Dynalink is run as trusted code, the delegate class is loaded into an isolated zero-permissions protection domain,
- * serving as a firebreak against an accidental privilege escalation downstream.
- */
-final class SafeUnreflector {
-    private static final String UNREFLECTOR_IMPL_CLASS_NAME = "jdk.internal.dynalink.beans.SafeUnreflectorImpl";
-    private static final Unreflector impl = createImpl();
-
-    private SafeUnreflector() {
-    }
-
-    /**
-     * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflect(Method)}, converting any encountered
-     * {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param m the method to unreflect
-     * @return the unreflected method handle.
-     */
-    static MethodHandle unreflect(Method m) {
-        return impl.unreflect(m);
-    }
-
-    /**
-     * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter(Field)}, converting any encountered
-     * {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param f the field for which a getter is unreflected
-     * @return the unreflected field getter handle.
-     */
-    static MethodHandle unreflectGetter(Field f) {
-        return impl.unreflectGetter(f);
-    }
-
-    /**
-     * Performs a {@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter(Field)}, converting any encountered
-     * {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param f the field for which a setter is unreflected
-     * @return the unreflected field setter handle.
-     */
-    static MethodHandle unreflectSetter(Field f) {
-        return impl.unreflectSetter(f);
-    }
-
-    static MethodHandle unreflectConstructor(Constructor<?> c) {
-        return impl.unreflectConstructor(c);
-    }
-
-    private static Unreflector createImpl() {
-        final Class<?> unreflectorImplClass = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
-            @Override
-            public Class<?> run() {
-                return SandboxClassLoader.loadClass(UNREFLECTOR_IMPL_CLASS_NAME);
-            }
-        });
-        try {
-            return (Unreflector)unreflectorImplClass.newInstance();
-        } catch(InstantiationException | IllegalAccessException e) {
-            throw new RuntimeException(e.getMessage(), e);
-        }
-    }
-}
--- a/nashorn/src/jdk/internal/dynalink/beans/SafeUnreflectorImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are
-       met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the copyright holder nor the names of
-         contributors may be used to endorse or promote products derived from
-         this software without specific prior written permission.
-
-       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
-       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package jdk.internal.dynalink.beans;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import jdk.internal.dynalink.beans.sandbox.Unreflector;
-
-/**
- * Performs lookup of unreflected method handles by delegating to {@link MethodHandles#lookup()} using itself as the
- * lookup class. When Dynalink runs as trusted code, this class is loaded into an isolated zero-permissions protection
- * domain to stop any accidental privilege escalation.
- */
-final class SafeUnreflectorImpl implements Unreflector {
-
-    SafeUnreflectorImpl() {
-    }
-
-    @Override
-    public MethodHandle unreflect(Method m) {
-        try {
-            return MethodHandles.lookup().unreflect(m);
-        } catch(IllegalAccessException e) {
-            final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect method " + m);
-            ee.initCause(e);
-            throw ee;
-        }
-    }
-
-    @Override
-    public MethodHandle unreflectGetter(Field f) {
-        try {
-            return MethodHandles.lookup().unreflectGetter(f);
-        } catch(IllegalAccessException e) {
-            final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect getter for field " + f);
-            ee.initCause(e);
-            throw ee;
-        }
-    }
-
-    @Override
-    public MethodHandle unreflectSetter(Field f) {
-        try {
-            return MethodHandles.lookup().unreflectSetter(f);
-        } catch(IllegalAccessException e) {
-            final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect setter for field " + f);
-            ee.initCause(e);
-            throw ee;
-        }
-    }
-
-    @Override
-    public MethodHandle unreflectConstructor(Constructor<?> c) {
-        try {
-            return MethodHandles.lookup().unreflectConstructor(c);
-        } catch(IllegalAccessException e) {
-            final IllegalAccessError ee = new IllegalAccessError("Failed to unreflect constructor " + c);
-            ee.initCause(e);
-            throw ee;
-        }
-    }
-}
--- a/nashorn/src/jdk/internal/dynalink/beans/SandboxClassLoader.java	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,228 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are
-       met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the copyright holder nor the names of
-         contributors may be used to endorse or promote products derived from
-         this software without specific prior written permission.
-
-       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
-       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package jdk.internal.dynalink.beans;
-
-import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
-import static jdk.internal.org.objectweb.asm.Opcodes.ASM4;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.Permissions;
-import java.security.ProtectionDomain;
-import java.security.SecureClassLoader;
-import java.security.SecureRandom;
-import jdk.internal.org.objectweb.asm.ClassReader;
-import jdk.internal.org.objectweb.asm.ClassVisitor;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.MethodVisitor;
-
-/**
- * A utility class that can load a class with specified name into an isolated zero-permissions protection domain. It can
- * be used to load classes that perform security-sensitive operations with no privileges at all, therefore ensuring such
- * operations will only succeed if they would require no permissions, as well as to make sure that if these operations
- * bind some part of the security execution context to their results, the bound security context is completely
- * unprivileged. Such measures serve as firebreaks against accidental privilege escalation.
- */
-final class SandboxClassLoader {
-    private final String className;
-    private final String randomizedClassName;
-
-    private SandboxClassLoader(String className) {
-        this.className = className;
-        final String simpleClassName = className.substring(className.lastIndexOf('.') + 1);
-        this.randomizedClassName = "randomPackage" + Long.toHexString(new SecureRandom().nextLong()) + "." + simpleClassName;
-    }
-
-    /**
-     * Load the named class into a zero-permissions protection domain. Even if the class is already loaded into the
-     * Dynalink's class loader, an independent class is created from the same bytecode, thus the returned class will
-     * never be identical with the one that might already be loaded. The class to be loaded is supposed to be package
-     * private and have no public constructors. This is not a functional requirement, but it is enforced to ensure that
-     * the original class was made adequately inaccessible. The returned class will be public and its constructors will
-     * be changed to public. The only permission given to the returned class will be
-     * {@code accessClassInPackage.jdk.internal.dynalink.beans.sandbox}. That package should be used solely to define
-     * SPI interfaces implemented by the loaded class.
-     * @param className the fully qualified name of the class to load
-     * @return the loaded class, renamed to a random package, made public, its constructors made public, and lacking any
-     * permissions except access to the sandbox package.
-     * @throws SecurityException if the calling code lacks the {@code createClassLoader} runtime permission. This
-     * normally means that Dynalink itself is running as untrusted code, and whatever functionality was meant to be
-     * isolated into an unprivileged class is likely okay to be used directly too.
-     */
-    static Class<?> loadClass(String className) throws SecurityException {
-        return new SandboxClassLoader(className).loadClass();
-    }
-
-    private Class<?> loadClass() throws SecurityException {
-        final ClassLoader loader = createClassLoader();
-        try {
-            final Class<?> clazz = Class.forName(randomizedClassName, true, loader);
-            // Sanity check to ensure we didn't accidentally pick up the class from elsewhere
-            if(clazz.getClassLoader() != loader) {
-                throw new AssertionError(randomizedClassName + " was loaded from a different class loader");
-            }
-            return clazz;
-        } catch(ClassNotFoundException e) {
-            throw new AssertionError(e);
-        }
-    }
-
-    private ClassLoader createClassLoader() throws SecurityException {
-        final String lclassName = this.randomizedClassName;
-        // We deliberately override loadClass instead of findClass so that we don't give a chance to finding this
-        // class already loaded anywhere else. We use this class' loader as the parent class loader as the loaded class
-        // needs to be able to access implemented interfaces from the sandbox package.
-        return new SecureClassLoader(getClass().getClassLoader()) {
-            @Override
-            protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
-                if(name.equals(lclassName)) {
-                    final byte[] bytes = getClassBytes();
-                    // Define the class with a protection domain that grants (almost) no permissions.
-                    Class<?> clazz = defineClass(name, bytes, 0, bytes.length, createMinimalPermissionsDomain());
-                    if(resolve) {
-                        resolveClass(clazz);
-                    }
-                    return clazz;
-                }
-
-                final int i = name.lastIndexOf('.');
-                if (i != -1) {
-                    final SecurityManager sm = System.getSecurityManager();
-                    if (sm != null) {
-                        sm.checkPackageAccess(name.substring(0, i));
-                    }
-                }
-                return super.loadClass(name, resolve);
-            }
-        };
-    }
-
-    /**
-     * Create a no-permissions protection domain. Except, it's not really a no-permissions protection domain, since we
-     * need to give the protection domain the permission to access the sandbox package where the interop interfaces are
-     * defined.
-     * @return a new (almost) no-permission protection domain.
-     */
-    private static ProtectionDomain createMinimalPermissionsDomain() {
-        final Permissions p = new Permissions();
-        p.add(new RuntimePermission("accessClassInPackage.jdk.internal.dynalink.beans.sandbox"));
-        return new ProtectionDomain(null, p);
-    }
-
-    private byte[] getClassBytes() {
-        try(final InputStream in = getClass().getResourceAsStream("/" + className.replace('.', '/') + ".class")) {
-            final ClassReader cr = new ClassReader(in);
-            final ClassWriter cw = new ClassWriter(cr, 0);
-            cr.accept(new ClassVisitor(ASM4, cw) {
-                @Override
-                public void visit(int version, int access, String name, String signature, String superName,
-                        String[] interfaces) {
-                    // Rename the class to its random name, and make it public (otherwise we won't be able to
-                    // instantiate it). The privileged template class is package-private.
-                    if((access & ACC_PUBLIC) != 0) {
-                        throw new IllegalArgumentException("Class " + className + " must be package-private");
-                    }
-                    super.visit(version, access | ACC_PUBLIC, randomizedClassName.replace('.', '/'),
-                            signature, superName, interfaces);
-                }
-
-                @Override
-                public MethodVisitor visitMethod(int access, String name, String desc, String signature,
-                        String[] exceptions) {
-                    // Make the constructor(s) public (otherwise we won't be able to instantiate the class). The
-                    // privileged template's constructor(s) should not be public.
-                    final boolean isCtor = "<init>".equals(name);
-                    if(isCtor && ((access & ACC_PUBLIC) != 0)) {
-                        throw new IllegalArgumentException("Class " + className + " must have no public constructors");
-                    }
-                    return super.visitMethod(isCtor ? (access | ACC_PUBLIC) : access, name, desc, signature,
-                            exceptions);
-                }
-            }, 0);
-            return cw.toByteArray();
-        } catch(IOException e) {
-            throw new RuntimeException(e);
-        }
-    }
-}
--- a/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/internal/dynalink/beans/StaticClassLinker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -132,7 +132,9 @@
                 return new SimpleDynamicMethod(StaticClassIntrospector.editConstructorMethodHandle(
                         boundArrayCtor.asType(boundArrayCtor.type().changeReturnType(clazz))), clazz, "<init>");
             }
-
+            if(CheckRestrictedPackage.isRestrictedClass(clazz)) {
+                return null;
+            }
             return createDynamicMethod(Arrays.asList(clazz.getConstructors()), clazz, "<init>");
         }
 
--- a/nashorn/src/jdk/internal/dynalink/beans/sandbox/Unreflector.java	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file, and Oracle licenses the original version of this file under the BSD
- * license:
- */
-/*
-   Copyright 2009-2013 Attila Szegedi
-
-   Licensed under both the Apache License, Version 2.0 (the "Apache License")
-   and the BSD License (the "BSD License"), with licensee being free to
-   choose either of the two at their discretion.
-
-   You may not use this file except in compliance with either the Apache
-   License or the BSD License.
-
-   If you choose to use this file in compliance with the Apache License, the
-   following notice applies to you:
-
-       You may obtain a copy of the Apache License at
-
-           http://www.apache.org/licenses/LICENSE-2.0
-
-       Unless required by applicable law or agreed to in writing, software
-       distributed under the License is distributed on an "AS IS" BASIS,
-       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-       implied. See the License for the specific language governing
-       permissions and limitations under the License.
-
-   If you choose to use this file in compliance with the BSD License, the
-   following notice applies to you:
-
-       Redistribution and use in source and binary forms, with or without
-       modification, are permitted provided that the following conditions are
-       met:
-       * Redistributions of source code must retain the above copyright
-         notice, this list of conditions and the following disclaimer.
-       * Redistributions in binary form must reproduce the above copyright
-         notice, this list of conditions and the following disclaimer in the
-         documentation and/or other materials provided with the distribution.
-       * Neither the name of the copyright holder nor the names of
-         contributors may be used to endorse or promote products derived from
-         this software without specific prior written permission.
-
-       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
-       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER
-       BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-       CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-       SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-       BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-       WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-       OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-       ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-package jdk.internal.dynalink.beans.sandbox;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-/**
- * Interface for creating unreflected method handles. This class is public for implementation purposes and is not part
- * of any supported API.
- */
-public interface Unreflector {
-    /**
-     * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflect(Method)} for some lookup object,
-     * also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param m the method to unreflect
-     * @return the unreflected method handle.
-     */
-    public MethodHandle unreflect(Method m);
-
-    /**
-     * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectGetter(Field)} for some lookup
-     * object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param f the field for which a getter is unreflected
-     * @return the unreflected field getter handle.
-     */
-    public MethodHandle unreflectGetter(Field f);
-
-    /**
-     * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectSetter(Field)} for some lookup
-     * object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param f the field for which a setter is unreflected
-     * @return the unreflected field setter handle.
-     */
-    public MethodHandle unreflectSetter(Field f);
-
-    /**
-     * Performs similarly to {@link java.lang.invoke.MethodHandles.Lookup#unreflectConstructor(Constructor)} for some
-     * lookup object, also converting any encountered {@link IllegalAccessException} into an {@link IllegalAccessError}.
-     *
-     * @param c the constructor to unreflect
-     * @return the unreflected constructor handle.
-     */
-    public MethodHandle unreflectConstructor(Constructor<?> c);
-
-}
--- a/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/api/scripting/NashornScriptEngine.java	Tue Aug 06 16:54:56 2013 -0700
@@ -40,6 +40,9 @@
 import java.security.PrivilegedAction;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
 import javax.script.AbstractScriptEngine;
 import javax.script.Bindings;
 import javax.script.Compilable;
@@ -79,6 +82,28 @@
     // default options passed to Nashorn Options object
     private static final String[] DEFAULT_OPTIONS = new String[] { "-scripting", "-doe" };
 
+    private static final String MESSAGES_RESOURCE = "jdk.nashorn.api.scripting.resources.Messages";
+
+    // Without do privileged, under security manager messages can not be loaded.
+    private static final ResourceBundle MESSAGES_BUNDLE;
+    static {
+        MESSAGES_BUNDLE = AccessController.doPrivileged(
+        new PrivilegedAction<ResourceBundle>() {
+            @Override
+            public ResourceBundle run() {
+                return ResourceBundle.getBundle(MESSAGES_RESOURCE, Locale.getDefault());
+            }
+        });
+    }
+
+    private static String getMessage(final String msgId, final String... args) {
+        try {
+            return new MessageFormat(MESSAGES_BUNDLE.getString(msgId)).format(args);
+        } catch (final java.util.MissingResourceException e) {
+            throw new RuntimeException("no message resource found for message id: "+ msgId);
+        }
+    }
+
     NashornScriptEngine(final NashornScriptEngineFactory factory, final ClassLoader appLoader) {
         this(factory, DEFAULT_OPTIONS, appLoader);
     }
@@ -176,43 +201,63 @@
     }
 
     @Override
-    public Object invokeMethod(final Object self, final String name, final Object... args)
+    public Object invokeMethod(final Object thiz, final String name, final Object... args)
             throws ScriptException, NoSuchMethodException {
-        if (self == null) {
-            throw new IllegalArgumentException("script object can not be null");
+        if (thiz == null) {
+            throw new IllegalArgumentException(getMessage("thiz.cannot.be.null"));
         }
-        return invokeImpl(self, name, args);
+        return invokeImpl(thiz, name, args);
     }
 
-    private <T> T getInterfaceInner(final Object self, final Class<T> clazz) {
+    private <T> T getInterfaceInner(final Object thiz, final Class<T> clazz) {
         if (clazz == null || !clazz.isInterface()) {
-            throw new IllegalArgumentException("interface Class expected");
+            throw new IllegalArgumentException(getMessage("interface.class.expected"));
         }
 
         // perform security access check as early as possible
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             if (! Modifier.isPublic(clazz.getModifiers())) {
-                throw new SecurityException("attempt to implement non-public interfce: " + clazz);
+                throw new SecurityException(getMessage("implementing.non.public.interface", clazz.getName()));
             }
             Context.checkPackageAccess(clazz.getName());
         }
 
-        final ScriptObject realSelf;
-        final ScriptObject ctxtGlobal = getNashornGlobalFrom(context);
-        if(self == null) {
-            realSelf = ctxtGlobal;
-        } else if (!(self instanceof ScriptObject)) {
-            realSelf = (ScriptObject)ScriptObjectMirror.unwrap(self, ctxtGlobal);
-        } else {
-            realSelf = (ScriptObject)self;
+        ScriptObject realSelf = null;
+        ScriptObject realGlobal = null;
+        if(thiz == null) {
+            // making interface out of global functions
+            realSelf = realGlobal = getNashornGlobalFrom(context);
+        } else if (thiz instanceof ScriptObjectMirror) {
+            final ScriptObjectMirror mirror = (ScriptObjectMirror)thiz;
+            realSelf = mirror.getScriptObject();
+            realGlobal = mirror.getHomeGlobal();
+            if (! realGlobal.isOfContext(nashornContext)) {
+                throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
+            }
+        } else if (thiz instanceof ScriptObject) {
+            // called from script code.
+            realSelf = (ScriptObject)thiz;
+            realGlobal = Context.getGlobal();
+            if (realGlobal == null) {
+                throw new IllegalArgumentException(getMessage("no.current.nashorn.global"));
+            }
+
+            if (! realGlobal.isOfContext(nashornContext)) {
+                throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
+            }
+        }
+
+        if (realSelf == null) {
+            throw new IllegalArgumentException(getMessage("interface.on.non.script.object"));
         }
 
         try {
-            final ScriptObject oldGlobal = getNashornGlobal();
+            final ScriptObject oldGlobal = Context.getGlobal();
+            final boolean globalChanged = (oldGlobal != realGlobal);
             try {
-                if(oldGlobal != ctxtGlobal) {
-                    setNashornGlobal(ctxtGlobal);
+                if (globalChanged) {
+                    Context.setGlobal(realGlobal);
                 }
 
                 if (! isInterfaceImplemented(clazz, realSelf)) {
@@ -220,8 +265,8 @@
                 }
                 return clazz.cast(JavaAdapterFactory.getConstructor(realSelf.getClass(), clazz).invoke(realSelf));
             } finally {
-                if(oldGlobal != ctxtGlobal) {
-                    setNashornGlobal(oldGlobal);
+                if (globalChanged) {
+                    Context.setGlobal(oldGlobal);
                 }
             }
         } catch(final RuntimeException|Error e) {
@@ -237,11 +282,11 @@
     }
 
     @Override
-    public <T> T getInterface(final Object self, final Class<T> clazz) {
-        if (self == null) {
-            throw new IllegalArgumentException("script object can not be null");
+    public <T> T getInterface(final Object thiz, final Class<T> clazz) {
+        if (thiz == null) {
+            throw new IllegalArgumentException(getMessage("thiz.cannot.be.null"));
         }
-        return getInterfaceInner(self, clazz);
+        return getInterfaceInner(thiz, clazz);
     }
 
     // These are called from the "engine.js" script
@@ -357,50 +402,48 @@
     }
 
     private Object invokeImpl(final Object selfObject, final String name, final Object... args) throws ScriptException, NoSuchMethodException {
-        final ScriptObject oldGlobal     = getNashornGlobal();
-        final ScriptObject ctxtGlobal    = getNashornGlobalFrom(context);
-        final boolean globalChanged = (oldGlobal != ctxtGlobal);
+        name.getClass(); // null check
 
-        Object self = globalChanged? ScriptObjectMirror.wrap(selfObject, oldGlobal) : selfObject;
+        ScriptObjectMirror selfMirror = null;
+        if (selfObject instanceof ScriptObjectMirror) {
+            selfMirror = (ScriptObjectMirror)selfObject;
+            if (! selfMirror.getHomeGlobal().isOfContext(nashornContext)) {
+                throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
+            }
+        } else if (selfObject instanceof ScriptObject) {
+            // invokeMethod called from script code - in which case we may get 'naked' ScriptObject
+            // Wrap it with oldGlobal to make a ScriptObjectMirror for the same.
+            final ScriptObject oldGlobal = Context.getGlobal();
+            if (oldGlobal == null) {
+                throw new IllegalArgumentException(getMessage("no.current.nashorn.global"));
+            }
 
-        try {
-            if (globalChanged) {
-                setNashornGlobal(ctxtGlobal);
+            if (! oldGlobal.isOfContext(nashornContext)) {
+                throw new IllegalArgumentException(getMessage("script.object.from.another.engine"));
             }
 
-            ScriptObject sobj;
-            Object       value = null;
-
-            self = ScriptObjectMirror.unwrap(self, ctxtGlobal);
-
-            // FIXME: should convert when self is not ScriptObject
-            if (self instanceof ScriptObject) {
-                sobj = (ScriptObject)self;
-                value = sobj.get(name);
-            } else if (self == null) {
-                self  = ctxtGlobal;
-                sobj  = ctxtGlobal;
-                value = sobj.get(name);
-            }
+            selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(selfObject, oldGlobal);
+        } else if (selfObject == null) {
+            // selfObject is null => global function call
+            final ScriptObject ctxtGlobal = getNashornGlobalFrom(context);
+            selfMirror = (ScriptObjectMirror)ScriptObjectMirror.wrap(ctxtGlobal, ctxtGlobal);
+        }
 
-            if (value instanceof ScriptFunction) {
-                final Object res;
-                try {
-                    final Object[] modArgs = globalChanged? ScriptObjectMirror.wrapArray(args, oldGlobal) : args;
-                    res = ScriptRuntime.checkAndApply((ScriptFunction)value, self, ScriptObjectMirror.unwrapArray(modArgs, ctxtGlobal));
-                } catch (final Exception e) {
-                    throwAsScriptException(e);
-                    throw new AssertionError("should not reach here");
+        if (selfMirror != null) {
+            try {
+                return ScriptObjectMirror.translateUndefined(selfMirror.call(name, args));
+            } catch (final Exception e) {
+                final Throwable cause = e.getCause();
+                if (cause instanceof NoSuchMethodException) {
+                    throw (NoSuchMethodException)cause;
                 }
-                return ScriptObjectMirror.translateUndefined(ScriptObjectMirror.wrap(res, ctxtGlobal));
-            }
-
-            throw new NoSuchMethodException(name);
-        } finally {
-            if (globalChanged) {
-                setNashornGlobal(oldGlobal);
+                throwAsScriptException(e);
+                throw new AssertionError("should not reach here");
             }
         }
+
+        // Non-script object passed as selfObject
+        throw new IllegalArgumentException(getMessage("interface.on.non.script.object"));
     }
 
     private Object evalImpl(final char[] buf, final ScriptContext ctxt) throws ScriptException {
@@ -411,12 +454,12 @@
         if (script == null) {
             return null;
         }
-        final ScriptObject oldGlobal = getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt);
         final boolean globalChanged = (oldGlobal != ctxtGlobal);
         try {
             if (globalChanged) {
-                setNashornGlobal(ctxtGlobal);
+                Context.setGlobal(ctxtGlobal);
             }
 
             setContextVariables(ctxt);
@@ -426,7 +469,7 @@
             throw new AssertionError("should not reach here");
         } finally {
             if (globalChanged) {
-                setNashornGlobal(oldGlobal);
+                Context.setGlobal(oldGlobal);
             }
         }
     }
@@ -469,12 +512,12 @@
     }
 
     private ScriptFunction compileImpl(final Source source, final ScriptContext ctxt) throws ScriptException {
-        final ScriptObject oldGlobal = getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final ScriptObject ctxtGlobal = getNashornGlobalFrom(ctxt);
         final boolean globalChanged = (oldGlobal != ctxtGlobal);
         try {
             if (globalChanged) {
-                setNashornGlobal(ctxtGlobal);
+                Context.setGlobal(ctxtGlobal);
             }
 
             return nashornContext.compileScript(source, ctxtGlobal);
@@ -483,7 +526,7 @@
             throw new AssertionError("should not reach here");
         } finally {
             if (globalChanged) {
-                setNashornGlobal(oldGlobal);
+                Context.setGlobal(oldGlobal);
             }
         }
     }
@@ -502,19 +545,4 @@
         }
         return true;
     }
-
-    // don't make this public!!
-    static ScriptObject getNashornGlobal() {
-        return Context.getGlobal();
-    }
-
-    static void setNashornGlobal(final ScriptObject newGlobal) {
-        AccessController.doPrivileged(new PrivilegedAction<Void>() {
-            @Override
-            public Void run() {
-               Context.setGlobal(newGlobal);
-               return null;
-            }
-        });
-    }
 }
--- a/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/api/scripting/ScriptObjectMirror.java	Tue Aug 06 16:54:56 2013 -0700
@@ -79,17 +79,17 @@
     // JSObject methods
     @Override
     public Object call(final String functionName, final Object... args) {
-        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
         try {
             if (globalChanged) {
-                NashornScriptEngine.setNashornGlobal(global);
+                Context.setGlobal(global);
             }
 
             final Object val = functionName == null? sobj : sobj.get(functionName);
             if (! (val instanceof ScriptFunction)) {
-                throw new RuntimeException("No such function " + ((functionName != null)? functionName : ""));
+                throw new NoSuchMethodException("No such function " + ((functionName != null)? functionName : ""));
             }
 
             final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
@@ -100,19 +100,19 @@
             throw new RuntimeException(t);
         } finally {
             if (globalChanged) {
-                NashornScriptEngine.setNashornGlobal(oldGlobal);
+                Context.setGlobal(oldGlobal);
             }
         }
     }
 
     @Override
     public Object newObject(final String functionName, final Object... args) {
-        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
 
         try {
             if (globalChanged) {
-                NashornScriptEngine.setNashornGlobal(global);
+                Context.setGlobal(global);
             }
 
             final Object val = functionName == null? sobj : sobj.get(functionName);
@@ -128,7 +128,7 @@
             throw new RuntimeException(t);
         } finally {
             if (globalChanged) {
-                NashornScriptEngine.setNashornGlobal(oldGlobal);
+                Context.setGlobal(oldGlobal);
             }
         }
     }
@@ -272,7 +272,7 @@
 
     @Override
     public Object put(final String key, final Object value) {
-        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         return inGlobal(new Callable<Object>() {
             @Override public Object call() {
@@ -284,7 +284,7 @@
 
     @Override
     public void putAll(final Map<? extends String, ? extends Object> map) {
-        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         inGlobal(new Callable<Object>() {
             @Override public Object call() {
@@ -535,7 +535,7 @@
      * @return wrapped object
      */
     public static Object wrap(final Object obj, final ScriptObject homeGlobal) {
-        return (obj instanceof ScriptObject) ? new ScriptObjectMirror((ScriptObject)obj, homeGlobal) : obj;
+        return (obj instanceof ScriptObject && homeGlobal != null) ? new ScriptObjectMirror((ScriptObject)obj, homeGlobal) : obj;
     }
 
     /**
@@ -599,24 +599,32 @@
     // package-privates below this.
 
     ScriptObjectMirror(final ScriptObject sobj, final ScriptObject global) {
+        assert sobj != null : "ScriptObjectMirror on null!";
+        assert global != null : "null global for ScriptObjectMirror!";
+
         this.sobj = sobj;
         this.global = global;
     }
 
+    // accessors for script engine
     ScriptObject getScriptObject() {
         return sobj;
     }
 
+    ScriptObject getHomeGlobal() {
+        return global;
+    }
+
     static Object translateUndefined(Object obj) {
         return (obj == ScriptRuntime.UNDEFINED)? null : obj;
     }
 
     // internals only below this.
     private <V> V inGlobal(final Callable<V> callable) {
-        final ScriptObject oldGlobal = NashornScriptEngine.getNashornGlobal();
+        final ScriptObject oldGlobal = Context.getGlobal();
         final boolean globalChanged = (oldGlobal != global);
         if (globalChanged) {
-            NashornScriptEngine.setNashornGlobal(global);
+            Context.setGlobal(global);
         }
         try {
             return callable.call();
@@ -626,9 +634,8 @@
             throw new AssertionError("Cannot happen", e);
         } finally {
             if (globalChanged) {
-                NashornScriptEngine.setNashornGlobal(oldGlobal);
+                Context.setGlobal(oldGlobal);
             }
         }
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk/nashorn/api/scripting/resources/Messages.properties	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,32 @@
+#
+# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+thiz.cannot.be.null=script object 'this' for getMethod, getInterface calls can not be null
+interface.class.expected=interface Class expected in getInterface
+interface.on.non.script.object=getInterface cannot be called on non-script object
+no.current.nashorn.global=no current Global instance for nashorn
+implementing.non.public.interface=Cannot implement non-public interface: {0}
+script.object.from.another.engine=Script object belongs to another script engine
+
--- a/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/api/scripting/resources/engine.js	Tue Aug 06 16:54:56 2013 -0700
@@ -39,12 +39,20 @@
     }
 });
 
-function print(str) {
+function print() {
     var writer = context.getWriter();
     if (! (writer instanceof java.io.PrintWriter)) {
         writer = new java.io.PrintWriter(writer);
     }
-    writer.println(String(str));
+    
+    var buf = new java.lang.StringBuilder();
+    for (var i = 0; i < arguments.length; i++) {
+        if (i != 0) {
+            buf.append(' ');
+        }
+        buf.append(String(arguments[i]));
+    }
+    writer.println(buf.toString());
 }
 
 /**
--- a/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/CodeGenerator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1143,22 +1143,23 @@
         final Type elementType = arrayType.getElementType();
 
         if (units != null) {
-            final MethodEmitter savedMethod = method;
+            final MethodEmitter savedMethod     = method;
+            final FunctionNode  currentFunction = lc.getCurrentFunction();
 
             for (final ArrayUnit arrayUnit : units) {
                 unit = lc.pushCompileUnit(arrayUnit.getCompileUnit());
 
                 final String className = unit.getUnitClassName();
-                final String name      = lc.getCurrentFunction().uniqueName(SPLIT_PREFIX.symbolName());
-                final String signature = methodDescriptor(type, Object.class, ScriptFunction.class, ScriptObject.class, type);
+                final String name      = currentFunction.uniqueName(SPLIT_PREFIX.symbolName());
+                final String signature = methodDescriptor(type, ScriptFunction.class, Object.class, ScriptObject.class, type);
 
                 final MethodEmitter me = unit.getClassEmitter().method(EnumSet.of(Flag.PUBLIC, Flag.STATIC), name, signature);
                 method = lc.pushMethodEmitter(me);
 
-                method.setFunctionNode(lc.getCurrentFunction());
+                method.setFunctionNode(currentFunction);
                 method.begin();
 
-                fixScopeSlot();
+                fixScopeSlot(currentFunction);
 
                 method.load(arrayType, SPLIT_ARRAY_ARG.slot());
 
@@ -1171,9 +1172,9 @@
                 method = lc.popMethodEmitter(me);
 
                 assert method == savedMethod;
-                method.loadCompilerConstant(THIS);
+                method.loadCompilerConstant(CALLEE);
                 method.swap();
-                method.loadCompilerConstant(CALLEE);
+                method.loadCompilerConstant(THIS);
                 method.swap();
                 method.loadCompilerConstant(SCOPE);
                 method.swap();
@@ -1680,11 +1681,8 @@
         method = lc.pushMethodEmitter(splitEmitter);
         method.setFunctionNode(fn);
 
-        if (fn.needsCallee()) {
-            caller.loadCompilerConstant(CALLEE);
-        } else {
-            caller.loadNull();
-        }
+        assert fn.needsCallee() : "split function should require callee";
+        caller.loadCompilerConstant(CALLEE);
         caller.loadCompilerConstant(THIS);
         caller.loadCompilerConstant(SCOPE);
         if (needsArguments) {
@@ -1694,18 +1692,18 @@
         caller.storeCompilerConstant(RETURN);
 
         method.begin();
+        // Copy scope to its target slot as first thing because the original slot could be used by return symbol.
+        fixScopeSlot(fn);
 
         method.loadUndefined(fn.getReturnType());
         method.storeCompilerConstant(RETURN);
 
-        fixScopeSlot();
-
         return true;
     }
 
-    private void fixScopeSlot() {
-        if (lc.getCurrentFunction().compilerConstant(SCOPE).getSlot() != SCOPE.slot()) {
-            // TODO hack to move the scope to the expected slot (that's needed because split methods reuse the same slots as the root method)
+    private void fixScopeSlot(final FunctionNode functionNode) {
+        // TODO hack to move the scope to the expected slot (needed because split methods reuse the same slots as the root method)
+        if (functionNode.compilerConstant(SCOPE).getSlot() != SCOPE.slot()) {
             method.load(Type.typeFor(ScriptObject.class), SCOPE.slot());
             method.storeCompilerConstant(SCOPE);
         }
@@ -1756,7 +1754,7 @@
             caller.ifne(breakLabel);
             //has to be zero
             caller.label(new Label("split_return"));
-            method.loadCompilerConstant(RETURN);
+            caller.loadCompilerConstant(RETURN);
             caller._return(lc.getCurrentFunction().getReturnType());
             caller.label(breakLabel);
         } else {
@@ -1787,6 +1785,11 @@
             caller.label(breakLabel);
         }
 
+        // If split has a return and caller is itself a split method it needs to propagate the return.
+        if (hasReturn) {
+            caller.setHasReturn();
+        }
+
         return splitNode;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/FinalizeTypes.java	Tue Aug 06 16:54:56 2013 -0700
@@ -649,8 +649,8 @@
     }
 
     /**
-     * A symbol (and {@link Property}) can be tagged as "may be primitive". This is
-     * used a hint for dual fields that it is even worth it to try representing this
+     * A symbol (and {@link jdk.nashorn.internal.runtime.Property}) can be tagged as "may be primitive".
+     * This is used a hint for dual fields that it is even worth it to try representing this
      * field as something other than java.lang.Object.
      *
      * @param node node in which to tag symbols as primitive
@@ -856,7 +856,7 @@
      * if the expression type changes.
      *
      * Assignments use their lhs as node symbol, and in this case we can't modify
-     * it. Then {@link CodeGenerator#Store} needs to do an explicit conversion.
+     * it. Then {@link CodeGenerator.Store} needs to do an explicit conversion.
      * This is happens very rarely.
      *
      * @param node
--- a/nashorn/src/jdk/nashorn/internal/codegen/Label.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Label.java	Tue Aug 06 16:54:56 2013 -0700
@@ -105,6 +105,18 @@
         Stack copy() {
             return new Stack(data, sp);
         }
+
+        @Override
+        public String toString() {
+            final StringBuilder builder = new StringBuilder("[");
+            for (int i = 0; i < sp; i++) {
+                builder.append(data[i]);
+                if (i < sp - 1) {
+                    builder.append(", ");
+                }
+            }
+            return builder.append("]").toString();
+        }
     }
 
     /** Name of this label */
--- a/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Lower.java	Tue Aug 06 16:54:56 2013 -0700
@@ -88,8 +88,6 @@
 
     /**
      * Constructor.
-     *
-     * @param compiler the compiler
      */
     Lower() {
         super(new BlockLexicalContext() {
@@ -307,8 +305,8 @@
 
         final IdentNode exception = new IdentNode(token, finish, lc.getCurrentFunction().uniqueName("catch_all"));
 
-        final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW)).
-                setIsTerminal(lc, true); //ends with throw, so terminal
+        final Block catchBody = new Block(token, finish, new ThrowNode(lineNumber, token, finish, new IdentNode(exception), ThrowNode.IS_SYNTHETIC_RETHROW));
+        assert catchBody.isTerminal(); //ends with throw, so terminal
 
         final CatchNode catchAllNode  = new CatchNode(lineNumber, token, finish, new IdentNode(exception), null, catchBody, CatchNode.IS_SYNTHETIC_RETHROW);
         final Block     catchAllBlock = new Block(token, finish, catchAllNode);
@@ -330,13 +328,12 @@
     /**
      * Splice finally code into all endpoints of a trynode
      * @param tryNode the try node
-     * @param list of rethrowing throw nodes from synthetic catch blocks
+     * @param rethrows list of rethrowing throw nodes from synthetic catch blocks
      * @param finallyBody the code in the original finally block
      * @return new try node after splicing finally code (same if nop)
      */
     private Node spliceFinally(final TryNode tryNode, final List<ThrowNode> rethrows, final Block finallyBody) {
         assert tryNode.getFinallyBody() == null;
-        final int            finish = tryNode.getFinish();
 
         final TryNode newTryNode = (TryNode)tryNode.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
             final List<Node> insideTry = new ArrayList<>();
@@ -404,7 +401,7 @@
                     if (!isTerminal(newStatements)) {
                         newStatements.add(endpoint);
                     }
-                    return BlockStatement.createReplacement(endpoint, finish, newStatements);
+                    return BlockStatement.createReplacement(endpoint, tryNode.getFinish(), newStatements);
                 }
                 return endpoint;
             }
@@ -466,7 +463,7 @@
         if (tryNode.getCatchBlocks().isEmpty()) {
             newTryNode = tryNode.setFinallyBody(null);
         } else {
-            Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), new ArrayList<Statement>(Arrays.asList(tryNode.setFinallyBody(null))));
+            Block outerBody = new Block(tryNode.getToken(), tryNode.getFinish(), tryNode.setFinallyBody(null));
             newTryNode = tryNode.setBody(outerBody).setCatchBlocks(null);
         }
 
--- a/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/MethodEmitter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1281,8 +1281,12 @@
     }
 
     MethodEmitter registerReturn() {
+        setHasReturn();
+        return this;
+    }
+
+    void setHasReturn() {
         this.hasReturn = true;
-        return this;
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/SpillObjectCreator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -65,7 +65,7 @@
 
         final int      length       = keys.size();
         final Object[] presetValues = new Object[propertyMap.size()];
-        final Class    clazz        = JO.class;
+        final Class<?> clazz        = JO.class;
 
         // Compute constant values
         for (int i = 0; i < length; i++) {
--- a/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/SplitMethodEmitter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -77,15 +77,15 @@
         }
 
         if (lc.isExternalTarget(splitNode, label)) {
-             externalTargets.add(label);
-             return externalTargets.size() - 1;
-         }
-         return -1;
+            externalTargets.add(label);
+            return externalTargets.size() - 1;
+        }
+        return -1;
     }
 
     @Override
     MethodEmitter registerReturn() {
-        super.registerReturn();
+        setHasReturn();
         loadCompilerConstant(SCOPE);
         checkcast(Scope.class);
         load(0);
--- a/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Splitter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -96,6 +96,10 @@
         long weight = WeighNodes.weigh(functionNode);
         final boolean top = fn.isProgram(); //compiler.getFunctionNode() == outermost;
 
+        // We know that our LexicalContext is empty outside the call to functionNode.accept(this) below,
+        // so we can pass null to all methods expecting a LexicalContext parameter.
+        assert lc.isEmpty() : "LexicalContext not empty";
+
         if (weight >= SPLIT_THRESHOLD) {
             LOG.finest("Splitting '", functionNode.getName(), "' as its weight ", weight, " exceeds split threshold ", SPLIT_THRESHOLD);
             functionNode = (FunctionNode)functionNode.accept(this);
@@ -103,11 +107,12 @@
             if (functionNode.isSplit()) {
                 // Weight has changed so weigh again, this time using block weight cache
                 weight = WeighNodes.weigh(functionNode, weightCache);
-                functionNode = functionNode.setBody(lc, functionNode.getBody().setNeedsScope(lc));
+                functionNode = functionNode.setBody(null, functionNode.getBody().setNeedsScope(null));
             }
 
             if (weight >= SPLIT_THRESHOLD) {
-                functionNode = functionNode.setBody(lc, splitBlock(functionNode.getBody(), functionNode));
+                functionNode = functionNode.setBody(null, splitBlock(functionNode.getBody(), functionNode));
+                functionNode = functionNode.setFlag(null, FunctionNode.IS_SPLIT);
                 weight = WeighNodes.weigh(functionNode.getBody(), weightCache);
             }
         }
@@ -116,10 +121,10 @@
 
         if (top) {
             assert outermostCompileUnit != null : "outermost compile unit is null";
-            functionNode = functionNode.setCompileUnit(lc, outermostCompileUnit);
+            functionNode = functionNode.setCompileUnit(null, outermostCompileUnit);
             outermostCompileUnit.addWeight(weight + WeighNodes.FUNCTION_WEIGHT);
         } else {
-            functionNode = functionNode.setCompileUnit(lc, findUnit(weight));
+            functionNode = functionNode.setCompileUnit(null, findUnit(weight));
         }
 
         final Block body = functionNode.getBody();
@@ -138,11 +143,11 @@
                 return split;
             }
         });
-        functionNode = functionNode.setBody(lc, newBody);
+        functionNode = functionNode.setBody(null, newBody);
 
         assert functionNode.getCompileUnit() != null;
 
-        return functionNode.setState(lc, CompilationState.SPLIT);
+        return functionNode.setState(null, CompilationState.SPLIT);
     }
 
     private static List<FunctionNode> directChildren(final FunctionNode functionNode) {
@@ -179,7 +184,6 @@
      * @return new weight for the resulting block.
      */
     private Block splitBlock(final Block block, final FunctionNode function) {
-        lc.setFlag(lc.getCurrentFunction(), FunctionNode.IS_SPLIT);
 
         final List<Statement> splits = new ArrayList<>();
         List<Statement> statements = new ArrayList<>();
@@ -255,8 +259,10 @@
         // been split already, so weigh again before splitting.
         long weight = WeighNodes.weigh(block, weightCache);
         if (weight >= SPLIT_THRESHOLD) {
-            newBlock = splitBlock(block, lc.getFunction(block));
+            final FunctionNode currentFunction = lc.getCurrentFunction();
+            newBlock = splitBlock(block, currentFunction);
             weight   = WeighNodes.weigh(newBlock, weightCache);
+            lc.setFlag(currentFunction, FunctionNode.IS_SPLIT);
         }
         weightCache.put(newBlock, weight);
         return newBlock;
@@ -289,7 +295,7 @@
                 final Node element = value[postset];
 
                 weight = WeighNodes.weigh(element);
-                totalWeight += weight;
+                totalWeight += WeighNodes.AASTORE_WEIGHT + weight;
 
                 if (totalWeight >= SPLIT_THRESHOLD) {
                     final CompileUnit unit = compiler.findUnit(totalWeight - weight);
--- a/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/codegen/WeighNodes.java	Tue Aug 06 16:54:56 2013 -0700
@@ -68,24 +68,25 @@
     /*
      * Weight constants.
      */
-            static final long FUNCTION_WEIGHT  = 40;
-    private static final long ACCESS_WEIGHT    = 4;
-    private static final long ADD_WEIGHT       = 10;
-    private static final long BREAK_WEIGHT     = 1;
-    private static final long CALL_WEIGHT      = 10;
-    private static final long CATCH_WEIGHT     = 10;
-    private static final long CONTINUE_WEIGHT  = 1;
-    private static final long IF_WEIGHT        = 2;
-    private static final long LITERAL_WEIGHT   = 10;
-    private static final long LOOP_WEIGHT      = 4;
-    private static final long NEW_WEIGHT       = 6;
-    private static final long FUNC_EXPR_WEIGHT = 20;
-    private static final long RETURN_WEIGHT    = 2;
-    private static final long SPLIT_WEIGHT     = 40;
-    private static final long SWITCH_WEIGHT    = 8;
-    private static final long THROW_WEIGHT     = 2;
-    private static final long VAR_WEIGHT       = 40;
-    private static final long WITH_WEIGHT      = 8;
+    static final long FUNCTION_WEIGHT  = 40;
+    static final long AASTORE_WEIGHT   = 2;
+    static final long ACCESS_WEIGHT    = 4;
+    static final long ADD_WEIGHT       = 10;
+    static final long BREAK_WEIGHT     = 1;
+    static final long CALL_WEIGHT      = 10;
+    static final long CATCH_WEIGHT     = 10;
+    static final long CONTINUE_WEIGHT  = 1;
+    static final long IF_WEIGHT        = 2;
+    static final long LITERAL_WEIGHT   = 10;
+    static final long LOOP_WEIGHT      = 4;
+    static final long NEW_WEIGHT       = 6;
+    static final long FUNC_EXPR_WEIGHT = 20;
+    static final long RETURN_WEIGHT    = 2;
+    static final long SPLIT_WEIGHT     = 40;
+    static final long SWITCH_WEIGHT    = 8;
+    static final long THROW_WEIGHT     = 2;
+    static final long VAR_WEIGHT       = 40;
+    static final long WITH_WEIGHT      = 8;
 
     /** Accumulated weight. */
     private long weight;
@@ -210,6 +211,7 @@
 
             if (units == null) {
                 for (final int postset : postsets) {
+                    weight += AASTORE_WEIGHT;
                     final Node element = value[postset];
 
                     if (element != null) {
--- a/nashorn/src/jdk/nashorn/internal/ir/Block.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/Block.java	Tue Aug 06 16:54:56 2013 -0700
@@ -33,10 +33,14 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+
 import jdk.nashorn.internal.codegen.Label;
+import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
+
 /**
  * IR representation for a list of statements.
  */
@@ -89,13 +93,13 @@
         this.symbols    = new LinkedHashMap<>();
         this.entryLabel = new Label("block_entry");
         this.breakLabel = new Label("block_break");
-        this.flags     =  0;
+        final int len = statements.length;
+        this.flags = (len > 0 && statements[len - 1].hasTerminalFlags()) ? IS_TERMINAL : 0;
     }
 
     /**
      * Constructor
      *
-     * @param lineNumber line number
      * @param token      token
      * @param finish     finish
      * @param statements statements
@@ -213,6 +217,19 @@
         return isTerminal ? setFlag(lc, IS_TERMINAL) : clearFlag(lc, IS_TERMINAL);
     }
 
+    /**
+     * Set the type of the return symbol in this block if present.
+     * @param returnType the new type
+     * @return this block
+     */
+    public Block setReturnType(final Type returnType) {
+        final Symbol symbol = getExistingSymbol(RETURN.symbolName());
+        if (symbol != null) {
+            symbol.setTypeOverride(returnType);
+        }
+        return this;
+    }
+
     @Override
     public boolean isTerminal() {
         return getFlag(IS_TERMINAL);
--- a/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/FunctionNode.java	Tue Aug 06 16:54:56 2013 -0700
@@ -540,12 +540,13 @@
     /**
      * Check if this function's generated Java method needs a {@code callee} parameter. Functions that need access to
      * their parent scope, functions that reference themselves, and non-strict functions that need an Arguments object
-     * (since it exposes {@code arguments.callee} property) will need to have a callee parameter.
+     * (since it exposes {@code arguments.callee} property) will need to have a callee parameter. We also return true
+     * for split functions to make sure symbols slots are the same in the main and split methods.
      *
      * @return true if the function's generated Java method needs a {@code callee} parameter.
      */
     public boolean needsCallee() {
-        return needsParentScope() || needsSelfSymbol() || (needsArguments() && !isStrict());
+        return needsParentScope() || needsSelfSymbol() || isSplit() || (needsArguments() && !isStrict());
     }
 
     /**
@@ -816,6 +817,7 @@
         if (this.returnType == returnType) {
             return this;
         }
+        final Type type = Type.widest(this.returnType, returnType.isObject() ? Type.OBJECT : returnType);
         return Node.replaceInLexicalContext(
             lc,
             this,
@@ -824,12 +826,10 @@
                 lastToken,
                 flags,
                 name,
-                Type.widest(this.returnType, returnType.isObject() ?
-                    Type.OBJECT :
-                    returnType),
+                type,
                 compileUnit,
                 compilationState,
-                body,
+                body.setReturnType(type),
                 parameters,
                 snapshot,
                 hints));
--- a/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/IdentNode.java	Tue Aug 06 16:54:56 2013 -0700
@@ -153,14 +153,27 @@
     }
 
     /**
-     * We can only override type if the symbol lives in the scope, otherwise
-     * it is strongly determined by the local variable already allocated
+     * We can only override type if the symbol lives in the scope, as otherwise
+     * it is strongly determined by the local variable already allocated.
+     *
+     * <p>We also return true if the symbol represents the return value of a function with a
+     * non-generic return type as in this case we need to propagate the type instead of
+     * converting to object, for example if the symbol is used as the left hand side of an
+     * assignment such as in the code below.</p>
+     *
+     * <pre>{@code
+     *   try {
+     *     return 2;
+     *   } finally {
+     *     return 3;
+     *   }
+     * }</pre>
      *
      * @return true if can have callsite type
      */
     @Override
     public boolean canHaveCallSiteType() {
-        return getSymbol() != null && getSymbol().isScope();
+        return getSymbol() != null && (getSymbol().isScope() || getSymbol().isNonGenericReturn());
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/LexicalContext.java	Tue Aug 06 16:54:56 2013 -0700
@@ -350,10 +350,12 @@
      * @return the innermost function in the context.
      */
     public FunctionNode getCurrentFunction() {
-        if (isEmpty()) {
-            return null;
+        for (int i = sp - 1; i >= 0; i--) {
+            if (stack[i] instanceof FunctionNode) {
+                return (FunctionNode) stack[i];
+            }
         }
-        return new NodeIterator<>(FunctionNode.class).next();
+        return null;
     }
 
     /**
--- a/nashorn/src/jdk/nashorn/internal/ir/Symbol.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/Symbol.java	Tue Aug 06 16:54:56 2013 -0700
@@ -35,6 +35,8 @@
 import jdk.nashorn.internal.runtime.Debug;
 import jdk.nashorn.internal.runtime.options.Options;
 
+import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
+
 /**
  * Maps a name to specific data.
  */
@@ -442,6 +444,14 @@
     }
 
     /**
+     * Check if this symbol represents a return value with a known non-generic type.
+     * @return true if specialized return value
+     */
+    public boolean isNonGenericReturn() {
+        return getName().equals(RETURN.symbolName()) && type != Type.OBJECT;
+    }
+
+    /**
      * Check if this symbol is a function parameter of known
      * narrowest type
      * @return true if parameter
--- a/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -102,7 +102,7 @@
             preorder.add(node);
         }
 
-        final boolean isReference = field != null && field.getAnnotation(Reference.class) != null;
+        final boolean isReference = field != null && field.isAnnotationPresent(Reference.class);
 
         Class<?> clazz = node.getClass();
         String   type  = clazz.getName();
@@ -183,7 +183,7 @@
                 append('\n');
 
             for (final Field child : children) {
-                if (child.getAnnotation(Ignore.class) != null) {
+                if (child.isAnnotationPresent(Ignore.class)) {
                     continue;
                 }
 
--- a/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java	Tue Aug 06 16:54:56 2013 -0700
@@ -35,7 +35,7 @@
  * must track their {@code [[TargetFunction]]} property for purposes of correctly implementing {@code [[HasInstance]]};
  * see {@link ScriptFunction#isInstance(ScriptObject)}.
  */
-class BoundScriptFunctionImpl extends ScriptFunctionImpl {
+final class BoundScriptFunctionImpl extends ScriptFunctionImpl {
     private final ScriptFunction targetFunction;
 
     BoundScriptFunctionImpl(ScriptFunctionData data, ScriptFunction targetFunction) {
--- a/nashorn/src/jdk/nashorn/internal/objects/Global.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/Global.java	Tue Aug 06 16:54:56 2013 -0700
@@ -63,6 +63,7 @@
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.ScriptingFunctions;
 import jdk.nashorn.internal.runtime.Source;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 import jdk.nashorn.internal.scripts.JO;
 
@@ -411,18 +412,33 @@
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
 
+    // performs initialization checks for Global constructor and returns the
+    // PropertyMap, if everything is fine.
+    private static PropertyMap checkAndGetMap(final Context context) {
+        // security check first
+        final SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new RuntimePermission("nashorn.newGlobal"));
+        }
+
+        // null check on context
+        context.getClass();
+
+        /*
+         * Duplicate global's map and use it. This way the initial Map filled
+         * by nasgen (referenced from static field in this class) is retained
+         * 'as is' (as that one is process wide singleton.
+         */
+        return $nasgenmap$.duplicate();
+    }
+
     /**
      * Constructor
      *
      * @param context the context
      */
     public Global(final Context context) {
-        /*
-         * Duplicate global's map and use it. This way the initial Map filled
-         * by nasgen (referenced from static field in this class) is retained
-         * 'as is' (as that one is process wide singleton.
-         */
-        super($nasgenmap$.duplicate());
+        super(checkAndGetMap(context));
         this.setContext(context);
         this.setIsScope();
 
@@ -533,7 +549,8 @@
             if (hint == String.class) {
 
                 final Object toString = TO_STRING.getGetter().invokeExact(sobj);
-                if (toString instanceof ScriptFunction) {
+
+                if (Bootstrap.isCallable(toString)) {
                     final Object value = TO_STRING.getInvoker().invokeExact(toString, sobj);
                     if (JSType.isPrimitive(value)) {
                         return value;
@@ -541,7 +558,7 @@
                 }
 
                 final Object valueOf = VALUE_OF.getGetter().invokeExact(sobj);
-                if (valueOf instanceof ScriptFunction) {
+                if (Bootstrap.isCallable(valueOf)) {
                     final Object value = VALUE_OF.getInvoker().invokeExact(valueOf, sobj);
                     if (JSType.isPrimitive(value)) {
                         return value;
@@ -552,7 +569,7 @@
 
             if (hint == Number.class) {
                 final Object valueOf = VALUE_OF.getGetter().invokeExact(sobj);
-                if (valueOf instanceof ScriptFunction) {
+                if (Bootstrap.isCallable(valueOf)) {
                     final Object value = VALUE_OF.getInvoker().invokeExact(valueOf, sobj);
                     if (JSType.isPrimitive(value)) {
                         return value;
@@ -560,7 +577,7 @@
                 }
 
                 final Object toString = TO_STRING.getGetter().invokeExact(sobj);
-                if (toString instanceof ScriptFunction) {
+                if (Bootstrap.isCallable(toString)) {
                     final Object value = TO_STRING.getInvoker().invokeExact(toString, sobj);
                     if (JSType.isPrimitive(value)) {
                         return value;
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeArray.java	Tue Aug 06 16:54:56 2013 -0700
@@ -360,7 +360,7 @@
             final ScriptObject sobj = (ScriptObject)obj;
             try {
                 final Object join = JOIN.getGetter().invokeExact(sobj);
-                if (join instanceof ScriptFunction) {
+                if (Bootstrap.isCallable(join)) {
                     return JOIN.getInvoker().invokeExact(join, sobj);
                 }
             } catch (final RuntimeException | Error e) {
@@ -396,7 +396,7 @@
                         final ScriptObject sobj           = (ScriptObject)val;
                         final Object       toLocaleString = TO_LOCALE_STRING.getGetter().invokeExact(sobj);
 
-                        if (toLocaleString instanceof ScriptFunction) {
+                        if (Bootstrap.isCallable(toLocaleString)) {
                             sb.append((String)TO_LOCALE_STRING.getInvoker().invokeExact(toLocaleString, sobj));
                         } else {
                             throw typeError("not.a.function", "toLocaleString");
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeDate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -44,9 +44,9 @@
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.PropertyMap;
 import jdk.nashorn.internal.runtime.ScriptEnvironment;
-import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 
 /**
@@ -862,7 +862,7 @@
 
         try {
             final Object func = TO_ISO_STRING.getGetter().invokeExact(sobj);
-            if (func instanceof ScriptFunction) {
+            if (Bootstrap.isCallable(func)) {
                 return TO_ISO_STRING.getInvoker().invokeExact(func, sobj, key);
             }
             throw typeError("not.a.function", ScriptRuntime.safeToString(func));
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeJSON.java	Tue Aug 06 16:54:56 2013 -0700
@@ -189,7 +189,7 @@
             if (value instanceof ScriptObject) {
                 final ScriptObject svalue = (ScriptObject)value;
                 final Object toJSON = TO_JSON.getGetter().invokeExact(svalue);
-                if (toJSON instanceof ScriptFunction) {
+                if (Bootstrap.isCallable(toJSON)) {
                     value = TO_JSON.getInvoker().invokeExact(toJSON, svalue, key);
                 }
             }
--- a/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/NativeObject.java	Tue Aug 06 16:54:56 2013 -0700
@@ -55,7 +55,6 @@
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.Property;
 import jdk.nashorn.internal.runtime.PropertyMap;
-import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
@@ -407,7 +406,7 @@
             try {
                 final Object toString = TO_STRING.getGetter().invokeExact(sobj);
 
-                if (toString instanceof ScriptFunction) {
+                if (Bootstrap.isCallable(toString)) {
                     return TO_STRING.getInvoker().invokeExact(toString, sobj);
                 }
             } catch (final RuntimeException | Error e) {
--- a/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/objects/PrototypeObject.java	Tue Aug 06 16:54:56 2013 -0700
@@ -75,7 +75,7 @@
      *
      * @param map property map
      */
-    public PrototypeObject(final PropertyMap map) {
+    PrototypeObject(final PropertyMap map) {
         this(Global.instance(), map);
     }
 
@@ -89,7 +89,7 @@
      * @param self self reference
      * @return constructor, probably, but not necessarily, a {@link ScriptFunction}
      */
-    public static Object getConstructor(final Object self) {
+    static Object getConstructor(final Object self) {
         return (self instanceof PrototypeObject) ?
             ((PrototypeObject)self).getConstructor() :
             UNDEFINED;
@@ -100,7 +100,7 @@
      * @param self self reference
      * @param constructor constructor, probably, but not necessarily, a {@link ScriptFunction}
      */
-    public static void setConstructor(final Object self, final Object constructor) {
+    static void setConstructor(final Object self, final Object constructor) {
         if (self instanceof PrototypeObject) {
             ((PrototypeObject)self).setConstructor(constructor);
         }
--- a/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/parser/AbstractParser.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.parser;
 
+import static jdk.nashorn.internal.parser.TokenType.COMMENT;
 import static jdk.nashorn.internal.parser.TokenType.EOF;
 import static jdk.nashorn.internal.parser.TokenType.EOL;
 import static jdk.nashorn.internal.parser.TokenType.IDENT;
@@ -135,14 +136,27 @@
     }
 
     /**
-     * Seek next token that is not an EOL.
+     * Seek next token that is not an EOL or comment.
      *
      * @return tokenType of next token.
      */
     protected final TokenType next() {
         do {
             nextOrEOL();
-        } while (type == EOL);
+        } while (type == EOL || type == COMMENT);
+
+        return type;
+    }
+
+    /**
+     * Seek next token or EOL (skipping comments.)
+     *
+     * @return tokenType of next token.
+     */
+    protected final TokenType nextOrEOL() {
+        do {
+            nextToken();
+        } while (type == COMMENT);
 
         return type;
     }
@@ -152,7 +166,7 @@
      *
      * @return tokenType of next token.
      */
-    protected final TokenType nextOrEOL() {
+    private final TokenType nextToken() {
         // Capture last token tokenType.
         last = type;
         if (type != EOF) {
--- a/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/parser/Lexer.java	Tue Aug 06 16:54:56 2013 -0700
@@ -26,6 +26,7 @@
 package jdk.nashorn.internal.parser;
 
 import static jdk.nashorn.internal.parser.TokenType.ADD;
+import static jdk.nashorn.internal.parser.TokenType.COMMENT;
 import static jdk.nashorn.internal.parser.TokenType.DECIMAL;
 import static jdk.nashorn.internal.parser.TokenType.EOF;
 import static jdk.nashorn.internal.parser.TokenType.EOL;
@@ -83,12 +84,70 @@
     /** Type of last token added. */
     private TokenType last;
 
-    private static final String JAVASCRIPT_WHITESPACE;
-    private static final String JAVASCRIPT_WHITESPACE_EOL;
-    private static final String JAVASCRIPT_WHITESPACE_IN_REGEXP;
+    private static final String SPACETAB = " \t";  // ASCII space and tab
+    private static final String LFCR     = "\n\r"; // line feed and carriage return (ctrl-m)
+
+    private static final String JSON_WHITESPACE_EOL = LFCR;
+    private static final String JSON_WHITESPACE     = SPACETAB + LFCR;
 
-    private static final String JSON_WHITESPACE;
-    private static final String JSON_WHITESPACE_EOL;
+    private static final String JAVASCRIPT_WHITESPACE_EOL =
+        LFCR +
+        "\u2028" + // line separator
+        "\u2029"   // paragraph separator
+        ;
+    private static final String JAVASCRIPT_WHITESPACE =
+        SPACETAB +
+        JAVASCRIPT_WHITESPACE_EOL +
+        "\u000b" + // tabulation line
+        "\u000c" + // ff (ctrl-l)
+        "\u00a0" + // Latin-1 space
+        "\u1680" + // Ogham space mark
+        "\u180e" + // separator, Mongolian vowel
+        "\u2000" + // en quad
+        "\u2001" + // em quad
+        "\u2002" + // en space
+        "\u2003" + // em space
+        "\u2004" + // three-per-em space
+        "\u2005" + // four-per-em space
+        "\u2006" + // six-per-em space
+        "\u2007" + // figure space
+        "\u2008" + // punctuation space
+        "\u2009" + // thin space
+        "\u200a" + // hair space
+        "\u202f" + // narrow no-break space
+        "\u205f" + // medium mathematical space
+        "\u3000" + // ideographic space
+        "\ufeff"   // byte order mark
+        ;
+
+    private static final String JAVASCRIPT_WHITESPACE_IN_REGEXP =
+        "\\u000a" + // line feed
+        "\\u000d" + // carriage return (ctrl-m)
+        "\\u2028" + // line separator
+        "\\u2029" + // paragraph separator
+        "\\u0009" + // tab
+        "\\u0020" + // ASCII space
+        "\\u000b" + // tabulation line
+        "\\u000c" + // ff (ctrl-l)
+        "\\u00a0" + // Latin-1 space
+        "\\u1680" + // Ogham space mark
+        "\\u180e" + // separator, Mongolian vowel
+        "\\u2000" + // en quad
+        "\\u2001" + // em quad
+        "\\u2002" + // en space
+        "\\u2003" + // em space
+        "\\u2004" + // three-per-em space
+        "\\u2005" + // four-per-em space
+        "\\u2006" + // six-per-em space
+        "\\u2007" + // figure space
+        "\\u2008" + // punctuation space
+        "\\u2009" + // thin space
+        "\\u200a" + // hair space
+        "\\u202f" + // narrow no-break space
+        "\\u205f" + // medium mathematical space
+        "\\u3000" + // ideographic space
+        "\\ufeff"   // byte order mark
+        ;
 
     static String unicodeEscape(final char ch) {
         final StringBuilder sb = new StringBuilder();
@@ -104,65 +163,6 @@
         return sb.toString();
     }
 
-    static {
-        final StringBuilder ws       = new StringBuilder();
-        final StringBuilder wsEOL    = new StringBuilder();
-        final StringBuilder wsRegExp = new StringBuilder();
-        final StringBuilder jsonWs   = new StringBuilder();
-
-        jsonWs.append((char)0x000a);
-        jsonWs.append((char)0x000d);
-        JSON_WHITESPACE_EOL = jsonWs.toString();
-
-        jsonWs.append((char)0x0009);
-        jsonWs.append((char)0x0020);
-        JSON_WHITESPACE = jsonWs.toString();
-
-        for (int i = 0; i <= 0xffff; i++) {
-           switch (i) {
-            case 0x000a: // line feed
-            case 0x000d: // carriage return (ctrl-m)
-            case 0x2028: // line separator
-            case 0x2029: // paragraph separator
-                wsEOL.append((char)i);
-            case 0x0009: // tab
-            case 0x0020: // ASCII space
-            case 0x000b: // tabulation line
-            case 0x000c: // ff (ctrl-l)
-            case 0x00a0: // Latin-1 space
-            case 0x1680: // Ogham space mark
-            case 0x180e: // separator, Mongolian vowel
-            case 0x2000: // en quad
-            case 0x2001: // em quad
-            case 0x2002: // en space
-            case 0x2003: // em space
-            case 0x2004: // three-per-em space
-            case 0x2005: // four-per-em space
-            case 0x2006: // six-per-em space
-            case 0x2007: // figure space
-            case 0x2008: // punctuation space
-            case 0x2009: // thin space
-            case 0x200a: // hair space
-            case 0x202f: // narrow no-break space
-            case 0x205f: // medium mathematical space
-            case 0x3000: // ideographic space
-            case 0xfeff: // byte order mark
-                ws.append((char)i);
-
-                wsRegExp.append(Lexer.unicodeEscape((char)i));
-                break;
-
-            default:
-                break;
-            }
-        }
-
-        JAVASCRIPT_WHITESPACE = ws.toString();
-        JAVASCRIPT_WHITESPACE_EOL = wsEOL.toString();
-        JAVASCRIPT_WHITESPACE_IN_REGEXP = wsRegExp.toString();
-
-    }
-
     /**
      * Constructor
      *
@@ -427,6 +427,9 @@
      * @return True if a comment.
      */
     protected boolean skipComments() {
+        // Save the current position.
+        final int start = position;
+
         if (ch0 == '/') {
             // Is it a // comment.
             if (ch1 == '/') {
@@ -437,10 +440,9 @@
                     skip(1);
                 }
                 // Did detect a comment.
+                add(COMMENT, start);
                 return true;
             } else if (ch1 == '*') {
-                // Record beginning of comment.
-                final int start = position;
                 // Skip over /*.
                 skip(2);
                 // Scan for */.
@@ -462,11 +464,11 @@
                 }
 
                 // Did detect a comment.
+                add(COMMENT, start);
                 return true;
             }
-        }
-
-        if (scripting && ch0 == '#') {
+        } else if (ch0 == '#') {
+            assert scripting;
             // shell style comment
             // Skip over #.
             skip(1);
@@ -475,6 +477,7 @@
                 skip(1);
             }
             // Did detect a comment.
+            add(COMMENT, start);
             return true;
         }
 
@@ -563,7 +566,7 @@
      *
      * @param token the token.
      * @param startTokenType the token type.
-     * @parasm lir LineInfoReceiver that receives line info for multi-line string literals.
+     * @param lir LineInfoReceiver that receives line info for multi-line string literals.
      * @return True if a literal beginning with startToken was found and scanned.
      */
     protected boolean scanLiteral(final long token, final TokenType startTokenType, final LineInfoReceiver lir) {
@@ -1461,11 +1464,10 @@
             final State restState = saveState();
             // keep line number updated
             int lastLine = line;
-            int lastLinePosition = linePosition;
 
             skipLine(false);
             lastLine++;
-            lastLinePosition = position;
+            int lastLinePosition = position;
             restState.setLimit(position);
 
             // Record beginning of string.
--- a/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/parser/TokenType.java	Tue Aug 06 16:54:56 2013 -0700
@@ -44,6 +44,7 @@
     ERROR          (SPECIAL,  null),
     EOF            (SPECIAL,  null),
     EOL            (SPECIAL,  null),
+    COMMENT        (SPECIAL,  null),
 
     NOT            (UNARY,   "!",    14, false),
     NE             (BINARY,  "!=",    9, true),
--- a/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/AccessorProperty.java	Tue Aug 06 16:54:56 2013 -0700
@@ -51,7 +51,7 @@
  * An AccessorProperty is the most generic property type. An AccessorProperty is
  * represented as fields in a ScriptObject class.
  */
-public class AccessorProperty extends Property {
+public final class AccessorProperty extends Property {
     private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
     private static final MethodHandle REPLACE_MAP = findOwnMH("replaceMap", Object.class, Object.class, PropertyMap.class, String.class, Class.class, Class.class);
 
@@ -149,7 +149,7 @@
      * @param property  accessor property to rebind
      * @param delegate  delegate object to rebind receiver to
      */
-    public AccessorProperty(final AccessorProperty property, final Object delegate) {
+    AccessorProperty(final AccessorProperty property, final Object delegate) {
         super(property);
 
         this.primitiveGetter = bindTo(property.primitiveGetter, delegate);
@@ -185,7 +185,7 @@
      * @param getter the property getter
      * @param setter the property setter or null if non writable, non configurable
      */
-    public AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) {
+    AccessorProperty(final String key, final int flags, final int slot, final MethodHandle getter, final MethodHandle setter) {
         super(key, flags, slot);
 
         // we don't need to prep the setters these will never be invalidated as this is a nasgen
--- a/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Context.java	Tue Aug 06 16:54:56 2013 -0700
@@ -36,13 +36,17 @@
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.reflect.Modifier;
 import java.util.concurrent.atomic.AtomicLong;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.security.AccessControlContext;
 import java.security.AccessController;
 import java.security.CodeSigner;
 import java.security.CodeSource;
+import java.security.Permissions;
 import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
 import java.util.Map;
 import jdk.internal.org.objectweb.asm.ClassReader;
 import jdk.internal.org.objectweb.asm.util.CheckClassAdapter;
@@ -121,11 +125,6 @@
      * @param global the global scope
      */
     public static void setGlobal(final ScriptObject global) {
-        final SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(new RuntimePermission("nashorn.setGlobal"));
-        }
-
         if (global != null && !(global instanceof Global)) {
             throw new IllegalArgumentException("global is not an instance of Global!");
         }
@@ -205,6 +204,7 @@
 
     private static final ClassLoader myLoader = Context.class.getClassLoader();
     private static final StructureLoader sharedLoader;
+    private static final AccessControlContext NO_PERMISSIONS_CONTEXT;
 
     static {
         sharedLoader = AccessController.doPrivileged(new PrivilegedAction<StructureLoader>() {
@@ -213,6 +213,7 @@
                 return new StructureLoader(myLoader, null);
             }
         });
+        NO_PERMISSIONS_CONTEXT = new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(null, new Permissions()) });
     }
 
     /**
@@ -483,7 +484,7 @@
                 source = new Source(name, script);
             }
         } else if (src instanceof Map) {
-            final Map map = (Map)src;
+            final Map<?,?> map = (Map<?,?>)src;
             if (map.containsKey("script") && map.containsKey("name")) {
                 final String script = JSType.toString(map.get("script"));
                 final String name   = JSType.toString(map.get("name"));
@@ -553,25 +554,60 @@
      * @throws ClassNotFoundException if structure class cannot be resolved
      */
     public static Class<?> forStructureClass(final String fullName) throws ClassNotFoundException {
+        if (System.getSecurityManager() != null && !NashornLoader.isStructureClass(fullName)) {
+            throw new ClassNotFoundException(fullName);
+        }
         return Class.forName(fullName, true, sharedLoader);
     }
 
     /**
-     * Checks that the given package can be accessed from current call stack.
+     * Checks that the given package can be accessed from no permissions context.
      *
      * @param fullName fully qualified package name
+     * @throw SecurityException if not accessible
      */
     public static void checkPackageAccess(final String fullName) {
         final int index = fullName.lastIndexOf('.');
         if (index != -1) {
             final SecurityManager sm = System.getSecurityManager();
             if (sm != null) {
-                sm.checkPackageAccess(fullName.substring(0, index));
+                AccessController.doPrivileged(new PrivilegedAction<Void>() {
+                    @Override
+                    public Void run() {
+                        sm.checkPackageAccess(fullName.substring(0, index));
+                        return null;
+                    }
+                }, NO_PERMISSIONS_CONTEXT);
             }
         }
     }
 
     /**
+     * Checks that the given package can be accessed from no permissions context.
+     *
+     * @param fullName fully qualified package name
+     * @return true if package is accessible, false otherwise
+     */
+    public static boolean isAccessiblePackage(final String fullName) {
+        try {
+            checkPackageAccess(fullName);
+            return true;
+        } catch (final SecurityException se) {
+            return false;
+        }
+    }
+
+    /**
+     * Checks that the given Class is public and it can be accessed from no permissions context.
+     *
+     * @param clazz Class object to check
+     * @return true if Class is accessible, false otherwise
+     */
+    public static boolean isAccessibleClass(final Class<?> clazz) {
+        return Modifier.isPublic(clazz.getModifiers()) && Context.isAccessiblePackage(clazz.getName());
+    }
+
+    /**
      * Lookup a Java class. This is used for JSR-223 stuff linking in from
      * {@code jdk.nashorn.internal.objects.NativeJava} and {@code jdk.nashorn.internal.runtime.NativeJavaPackage}
      *
@@ -626,7 +662,7 @@
             // No verification when security manager is around as verifier
             // may load further classes - which should be avoided.
             if (System.getSecurityManager() == null) {
-                CheckClassAdapter.verify(new ClassReader(bytecode), scriptLoader, false, new PrintWriter(System.err, true));
+                CheckClassAdapter.verify(new ClassReader(bytecode), sharedLoader, false, new PrintWriter(System.err, true));
             }
         }
     }
@@ -645,12 +681,7 @@
      * @return the global script object
      */
     public ScriptObject newGlobal() {
-        final SecurityManager sm = System.getSecurityManager();
-        if (sm != null) {
-            sm.checkPermission(new RuntimePermission("nashorn.newGlobal"));
-        }
-
-        return newGlobalTrusted();
+        return new Global(this);
     }
 
     /**
@@ -828,10 +859,6 @@
              });
     }
 
-    private ScriptObject newGlobalTrusted() {
-        return new Global(this);
-    }
-
     private long getUniqueScriptId() {
         return uniqueScriptId.getAndIncrement();
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/FinalScriptFunctionData.java	Tue Aug 06 16:54:56 2013 -0700
@@ -33,7 +33,7 @@
  * This is a subclass that represents a script function that may not be regenerated.
  * This is used for example for bound functions and builtins.
  */
-public final class FinalScriptFunctionData extends ScriptFunctionData {
+final class FinalScriptFunctionData extends ScriptFunctionData {
 
     /**
      * Constructor - used for bind
--- a/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ListAdapter.java	Tue Aug 06 16:54:56 2013 -0700
@@ -31,6 +31,7 @@
 import java.util.ListIterator;
 import java.util.NoSuchElementException;
 import java.util.RandomAccess;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
 
 /**
@@ -46,7 +47,7 @@
  * operations respectively, while {@link #addLast(Object)} and {@link #removeLast()} will translate to {@code push} and
  * {@code pop}.
  */
-public class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
+public final class ListAdapter extends AbstractList<Object> implements RandomAccess, Deque<Object> {
     // These add to the back and front of the list
     private static final InvokeByName PUSH    = new InvokeByName("push",    ScriptObject.class, void.class, Object.class);
     private static final InvokeByName UNSHIFT = new InvokeByName("unshift", ScriptObject.class, void.class, Object.class);
@@ -157,7 +158,7 @@
         }
     }
     private static void checkFunction(Object fn, InvokeByName invoke) {
-        if(!(fn instanceof ScriptFunction)) {
+        if(!(Bootstrap.isCallable(fn))) {
             throw new UnsupportedOperationException("The script object doesn't have a function named " + invoke.getName());
         }
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NashornLoader.java	Tue Aug 06 16:54:56 2013 -0700
@@ -118,6 +118,10 @@
         return permCollection;
     }
 
+    static boolean isStructureClass(final String fullName) {
+        return fullName.startsWith(SCRIPTS_PKG);
+    }
+
     /**
      * Create a secure URL class loader for the given classpath
      * @param classPath classpath for the loader to search from
--- a/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/NativeJavaPackage.java	Tue Aug 06 16:54:56 2013 -0700
@@ -84,8 +84,8 @@
      * @param proto proto
      */
     public NativeJavaPackage(final String name, final ScriptObject proto) {
+        super(proto, null);
         this.name = name;
-        this.setProto(proto);
     }
 
     @Override
--- a/nashorn/src/jdk/nashorn/internal/runtime/Property.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Property.java	Tue Aug 06 16:54:56 2013 -0700
@@ -100,7 +100,7 @@
      * @param flags property flags
      * @param slot  property field number or spill slot
      */
-    public Property(final String key, final int flags, final int slot) {
+    Property(final String key, final int flags, final int slot) {
         assert key != null;
         this.key   = key;
         this.flags = flags;
@@ -112,7 +112,7 @@
      *
      * @param property source property
      */
-    protected Property(final Property property) {
+    Property(final Property property) {
         this.key   = property.key;
         this.flags = property.flags;
         this.slot  = property.slot;
@@ -123,7 +123,7 @@
      *
      * @return cloned property
      */
-    protected abstract Property copy();
+    abstract Property copy();
 
     /**
      * Property flag utility method for {@link PropertyDescriptor}s. Given two property descriptors,
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyListenerManager.java	Tue Aug 06 16:54:56 2013 -0700
@@ -32,6 +32,7 @@
  * Helper class to manage property listeners and notification.
  */
 public class PropertyListenerManager implements PropertyListener {
+    PropertyListenerManager() {}
 
     /** property listeners for this object. */
     private Map<PropertyListener,Boolean> listeners;
--- a/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/PropertyMap.java	Tue Aug 06 16:54:56 2013 -0700
@@ -352,11 +352,15 @@
         return newMap;
     }
 
-    /*
+    /**
      * Make a new UserAccessorProperty property. getter and setter functions are stored in
      * this ScriptObject and slot values are used in property object. Note that slots
      * are assigned speculatively and should be added to map before adding other
      * properties.
+     *
+     * @param key the property name
+     * @param propertyFlags attribute flags of the property
+     * @return the newly created UserAccessorProperty
      */
     public UserAccessorProperty newUserAccessors(final String key, final int propertyFlags) {
         int oldSpillLength = spillLength;
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptFunctionData.java	Tue Aug 06 16:54:56 2013 -0700
@@ -67,7 +67,7 @@
      * @param isBuiltin     is the function built in
      * @param isConstructor is the function a constructor
      */
-    protected ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
+    ScriptFunctionData(final String name, final int arity, final boolean isStrict, final boolean isBuiltin, final boolean isConstructor) {
         this.name          = name;
         this.arity         = arity;
         this.code          = new CompiledFunctions();
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptObject.java	Tue Aug 06 16:54:56 2013 -0700
@@ -1046,6 +1046,15 @@
     }
 
     /**
+     * Checks if this object belongs to the given context
+     * @param ctx context to check against
+     * @return true if this object belongs to the given context
+     */
+    public final boolean isOfContext(final Context ctx) {
+        return context == ctx;
+    }
+
+    /**
      * Return the current context from the object's map.
      * @return Current context.
      */
@@ -3192,9 +3201,15 @@
         return true;
     }
 
-    /*
+    /**
      * Make a new UserAccessorProperty property. getter and setter functions are stored in
      * this ScriptObject and slot values are used in property object.
+     *
+     * @param key the property name
+     * @param propertyFlags attribute flags of the property
+     * @param getter getter function for the property
+     * @param setter setter function for the property
+     * @return the newly created UserAccessorProperty
      */
     protected final UserAccessorProperty newUserAccessors(final String key, final int propertyFlags, final ScriptFunction getter, final ScriptFunction setter) {
         final UserAccessorProperty property = getMap().newUserAccessors(key, propertyFlags);
--- a/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/ScriptRuntime.java	Tue Aug 06 16:54:56 2013 -0700
@@ -335,9 +335,7 @@
      */
     public static Object checkAndApply(final ScriptFunction target, final Object self, final Object... args) {
         final ScriptObject global = Context.getGlobalTrusted();
-        if (! (global instanceof GlobalObject)) {
-            throw new IllegalStateException("No current global set");
-        }
+        assert (global instanceof GlobalObject): "No current global set";
 
         if (target.getContext() != global.getContext()) {
             throw new IllegalArgumentException("'target' function is not from current Context");
@@ -383,9 +381,7 @@
      */
     public static Object checkAndConstruct(final ScriptFunction target, final Object... args) {
         final ScriptObject global = Context.getGlobalTrusted();
-        if (! (global instanceof GlobalObject)) {
-            throw new IllegalStateException("No current global set");
-        }
+        assert (global instanceof GlobalObject): "No current global set";
 
         if (target.getContext() != global.getContext()) {
             throw new IllegalArgumentException("'target' function is not from current Context");
@@ -395,7 +391,7 @@
         return construct(target, args);
     }
 
-    /*
+    /**
      * Call a script function as a constructor with given args.
      *
      * @param target ScriptFunction object.
--- a/nashorn/src/jdk/nashorn/internal/runtime/Source.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/Source.java	Tue Aug 06 16:54:56 2013 -0700
@@ -384,11 +384,7 @@
         }
 
         final byte[] buf = Files.readAllBytes(file.toPath());
-        if (cs != null) {
-            return new String(buf, cs).toCharArray();
-        } else {
-            return byteToCharArray(buf);
-        }
+        return (cs != null)? new String(buf, cs).toCharArray() : byteToCharArray(buf);
     }
 
     /**
@@ -465,11 +461,7 @@
     }
 
     private static char[] readFully(final InputStream is, final Charset cs) throws IOException {
-        if (cs != null) {
-            return new String(readBytes(is), cs).toCharArray();
-        } else {
-            return readFully(is);
-        }
+        return (cs != null)? new String(readBytes(is), cs).toCharArray() : readFully(is);
     }
 
     private static char[] readFully(final InputStream is) throws IOException {
--- a/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/UserAccessorProperty.java	Tue Aug 06 16:54:56 2013 -0700
@@ -83,7 +83,7 @@
      * @param getterSlot getter slot, starting at first embed
      * @param setterSlot setter slot, starting at first embed
      */
-    public UserAccessorProperty(final String key, final int flags, final int getterSlot, final int setterSlot) {
+    UserAccessorProperty(final String key, final int flags, final int getterSlot, final int setterSlot) {
         super(key, flags, -1);
         this.getterSlot = getterSlot;
         this.setterSlot = setterSlot;
--- a/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/WithObject.java	Tue Aug 06 16:54:56 2013 -0700
@@ -57,11 +57,9 @@
      * @param scope scope object
      * @param expression with expression
      */
-    public WithObject(final ScriptObject scope, final Object expression) {
-        super();
-
+    WithObject(final ScriptObject scope, final Object expression) {
+        super(scope, null);
         setIsScope();
-        setProto(scope);
         this.expression = expression;
     }
 
--- a/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/arrays/IteratorAction.java	Tue Aug 06 16:54:56 2013 -0700
@@ -31,6 +31,7 @@
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
 /**
  * Helper class for the various map/apply functions in {@link jdk.nashorn.internal.objects.NativeArray}.
@@ -103,6 +104,8 @@
         } else if (callbackfn instanceof ScriptObjectMirror &&
             ((ScriptObjectMirror)callbackfn).isFunction()) {
             strict = ((ScriptObjectMirror)callbackfn).isStrictFunction();
+        } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) {
+            strict = false;
         } else {
             throw typeError("not.a.function", ScriptRuntime.safeToString(callbackfn));
         }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationException.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationException.java	Tue Aug 06 16:54:56 2013 -0700
@@ -26,7 +26,7 @@
 package jdk.nashorn.internal.runtime.linker;
 
 @SuppressWarnings("serial")
-class AdaptationException extends Exception {
+final class AdaptationException extends Exception {
     private final AdaptationResult adaptationResult;
 
     AdaptationException(final AdaptationResult.Outcome outcome, final String classList) {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/AdaptationResult.java	Tue Aug 06 16:54:56 2013 -0700
@@ -32,7 +32,7 @@
  * A result of generating an adapter for a class. A tuple of an outcome and - in case of an error outcome - a list of
  * classes that caused the error.
  */
-class AdaptationResult {
+final class AdaptationResult {
     /**
      * Contains various outcomes for attempting to generate an adapter class. These are stored in AdapterInfo instances.
      * We have a successful outcome (adapter class was generated) and four possible error outcomes: superclass is final,
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/Bootstrap.java	Tue Aug 06 16:54:56 2013 -0700
@@ -38,8 +38,12 @@
 import jdk.internal.dynalink.beans.BeansLinker;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
 import jdk.nashorn.internal.codegen.CompilerConstants.Call;
 import jdk.nashorn.internal.codegen.RuntimeCallSite;
+import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.ScriptFunction;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.options.Options;
 
 /**
@@ -68,6 +72,41 @@
     }
 
     /**
+     * Returns if the given object is a "callable"
+     * @param obj object to be checked for callability
+     * @return true if the obj is callable
+     */
+    public static boolean isCallable(final Object obj) {
+        if (obj == ScriptRuntime.UNDEFINED || obj == null) {
+            return false;
+        }
+
+        return obj instanceof ScriptFunction ||
+            ((obj instanceof ScriptObjectMirror) && ((ScriptObjectMirror)obj).isFunction()) ||
+            isDynamicMethod(obj) ||
+            isFunctionalInterfaceObject(obj);
+    }
+
+    /**
+     * Returns if the given object is a dynalink Dynamic method
+     * @param obj object to be checked
+     * @return true if the obj is a dynamic method
+     */
+    public static boolean isDynamicMethod(final Object obj) {
+        return obj instanceof BoundDynamicMethod || BeansLinker.isDynamicMethod(obj);
+    }
+
+    /**
+     * Returns if the given object is an instance of an interface annotated with
+     * java.lang.FunctionalInterface
+     * @param obj object to be checked
+     * @return true if the obj is an instance of @FunctionalInterface interface
+     */
+    public static boolean isFunctionalInterfaceObject(final Object obj) {
+        return !JSType.isPrimitive(obj) && (NashornBottomLinker.getFunctionalInterfaceMethod(obj.getClass()) != null);
+    }
+
+    /**
      * Create a call site and link it for Nashorn. This version of the method conforms to the invokedynamic bootstrap
      * method expected signature and is referenced from Nashorn generated bytecode as the bootstrap method for all
      * invokedynamic instructions.
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/InvokeByName.java	Tue Aug 06 16:54:56 2013 -0700
@@ -58,7 +58,7 @@
  * you dynamically invoke a function with the same name from multiple places in your code, it is advisable to create a
  * separate instance of this class for every place.
  */
-public class InvokeByName {
+public final class InvokeByName {
     private final String name;
     private final MethodHandle getter;
     private final MethodHandle invoker;
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterBytecodeGenerator.java	Tue Aug 06 16:54:56 2013 -0700
@@ -45,18 +45,17 @@
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodType;
+import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.SecureRandom;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Random;
 import java.util.Set;
 import jdk.internal.org.objectweb.asm.ClassWriter;
 import jdk.internal.org.objectweb.asm.Label;
@@ -66,6 +65,7 @@
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
+import sun.reflect.CallerSensitive;
 
 /**
  * Generates bytecode for a Java adapter class. Used by the {@link JavaAdapterFactory}.
@@ -121,7 +121,23 @@
  * constructor's trailing position and thus provide further instance-specific overrides. The order of invocation is
  * always instance-specified method, then a class-specified method, and finally the superclass method.
  */
-final class JavaAdapterBytecodeGenerator extends JavaAdapterGeneratorBase {
+final class JavaAdapterBytecodeGenerator {
+    static final Type CONTEXT_TYPE       = Type.getType(Context.class);
+    static final Type OBJECT_TYPE        = Type.getType(Object.class);
+    static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class);
+
+    static final String CONTEXT_TYPE_NAME = CONTEXT_TYPE.getInternalName();
+    static final String OBJECT_TYPE_NAME  = OBJECT_TYPE.getInternalName();
+
+    static final String INIT = "<init>";
+
+    static final String GLOBAL_FIELD_NAME = "global";
+
+    static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor();
+
+    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, SCRIPT_OBJECT_TYPE);
+    static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE);
+
     private static final Type SCRIPT_FUNCTION_TYPE = Type.getType(ScriptFunction.class);
     private static final Type STRING_TYPE = Type.getType(String.class);
     private static final Type METHOD_TYPE_TYPE = Type.getType(MethodType.class);
@@ -147,11 +163,11 @@
 
     // Package used when the adapter can't be defined in the adaptee's package (either because it's sealed, or because
     // it's a java.* package.
-    private static final String ADAPTER_PACKAGE_PREFIX = "jdk/nashorn/internal/javaadapters/";
+    private static final String ADAPTER_PACKAGE_PREFIX = "jdk/nashorn/javaadapters/";
     // Class name suffix used to append to the adaptee class name, when it can be defined in the adaptee's package.
     private static final String ADAPTER_CLASS_NAME_SUFFIX = "$$NashornJavaAdapter";
     private static final String JAVA_PACKAGE_PREFIX = "java/";
-    private static final int MAX_GENERATED_TYPE_NAME_LENGTH = 238; //255 - 17; 17 is the maximum possible length for the global setter inner class suffix
+    private static final int MAX_GENERATED_TYPE_NAME_LENGTH = 255;
 
     private static final String CLASS_INIT = "<clinit>";
     private static final String STATIC_GLOBAL_FIELD_NAME = "staticGlobal";
@@ -161,8 +177,6 @@
      */
     private static final Collection<MethodInfo> EXCLUDED = getExcludedMethods();
 
-    private static final Random random = new SecureRandom();
-
     // This is the superclass for our generated adapter.
     private final Class<?> superClass;
     // Class loader used as the parent for the class loader we'll create to load the generated class. It will be a class
@@ -175,8 +189,6 @@
     private final String superClassName;
     // Binary name of the generated class.
     private final String generatedClassName;
-    // Binary name of the PrivilegedAction inner class that is used to
-    private final String globalSetterClassName;
     private final Set<String> usedFieldNames = new HashSet<>();
     private final Set<String> abstractMethodNames = new HashSet<>();
     private final String samName;
@@ -214,15 +226,6 @@
         superClassName = Type.getInternalName(superClass);
         generatedClassName = getGeneratedClassName(superClass, interfaces);
 
-        // Randomize the name of the privileged global setter, to make it non-feasible to find.
-        final long l;
-        synchronized(random) {
-            l = random.nextLong();
-        }
-
-        // NOTE: they way this class name is calculated affects the value of MAX_GENERATED_TYPE_NAME_LENGTH constant. If
-        // you change the calculation of globalSetterClassName, adjust the constant too.
-        globalSetterClassName = generatedClassName.concat("$" + Long.toHexString(l & Long.MAX_VALUE));
         cw.visit(Opcodes.V1_7, ACC_PUBLIC | ACC_SUPER | ACC_FINAL, generatedClassName, null, superClassName, getInternalTypeNames(interfaces));
 
         generateGlobalFields();
@@ -250,7 +253,7 @@
     }
 
     JavaAdapterClassLoader createAdapterClassLoader() {
-        return new JavaAdapterClassLoader(generatedClassName, cw.toByteArray(), globalSetterClassName);
+        return new JavaAdapterClassLoader(generatedClassName, cw.toByteArray());
     }
 
     boolean isAutoConvertibleFromFunction() {
@@ -367,7 +370,7 @@
         boolean gotCtor = false;
         for (final Constructor<?> ctor: superClass.getDeclaredConstructors()) {
             final int modifier = ctor.getModifiers();
-            if((modifier & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) {
+            if((modifier & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0 && !isCallerSensitive(ctor)) {
                 generateConstructors(ctor);
                 gotCtor = true;
             }
@@ -511,8 +514,8 @@
         mv.invokestatic(CONTEXT_TYPE_NAME, "getGlobal", GET_GLOBAL_METHOD_DESCRIPTOR);
     }
 
-    private void invokeSetGlobal(final InstructionAdapter mv) {
-        mv.invokestatic(globalSetterClassName, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR);
+    private static void invokeSetGlobal(final InstructionAdapter mv) {
+        mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR);
     }
 
     /**
@@ -794,7 +797,7 @@
      * entry.
      * @param globalsDifferVar index of the boolean local variable that is true if the global needs to be restored.
      */
-    private void emitFinally(final InstructionAdapter mv, final int currentGlobalVar, final int globalsDifferVar) {
+    private static void emitFinally(final InstructionAdapter mv, final int currentGlobalVar, final int globalsDifferVar) {
         // Emit code to restore the previous Nashorn global if needed
         mv.visitVarInsn(ILOAD, globalsDifferVar);
         final Label skip = new Label();
@@ -832,7 +835,7 @@
                 }
                 if (Modifier.isPublic(m) || Modifier.isProtected(m)) {
                     final MethodInfo mi = new MethodInfo(typeMethod);
-                    if (Modifier.isFinal(m)) {
+                    if (Modifier.isFinal(m) || isCallerSensitive(typeMethod)) {
                         finalMethods.add(mi);
                     } else if (!finalMethods.contains(mi) && methodInfos.add(mi)) {
                         if (Modifier.isAbstract(m)) {
@@ -909,4 +912,8 @@
         final Class<?> superClass = c1.getSuperclass();
         return superClass.isAssignableFrom(c2) ? superClass : assignableSuperClass(superClass, c2);
     }
+
+    private static boolean isCallerSensitive(final AccessibleObject e) {
+        return e.isAnnotationPresent(CallerSensitive.class);
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,16 +25,6 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
-import static jdk.internal.org.objectweb.asm.Opcodes.ACC_FINAL;
-import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PRIVATE;
-import static jdk.internal.org.objectweb.asm.Opcodes.ACC_PUBLIC;
-import static jdk.internal.org.objectweb.asm.Opcodes.ACC_STATIC;
-import static jdk.internal.org.objectweb.asm.Opcodes.ACC_SUPER;
-import static jdk.internal.org.objectweb.asm.Opcodes.ACONST_NULL;
-import static jdk.internal.org.objectweb.asm.Opcodes.ALOAD;
-import static jdk.internal.org.objectweb.asm.Opcodes.ARETURN;
-import static jdk.internal.org.objectweb.asm.Opcodes.RETURN;
-
 import java.security.AccessController;
 import java.security.AllPermission;
 import java.security.CodeSigner;
@@ -45,12 +35,6 @@
 import java.security.SecureClassLoader;
 
 import jdk.internal.dynalink.beans.StaticClass;
-import jdk.internal.org.objectweb.asm.ClassWriter;
-import jdk.internal.org.objectweb.asm.Opcodes;
-import jdk.internal.org.objectweb.asm.Type;
-import jdk.internal.org.objectweb.asm.commons.InstructionAdapter;
-import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
  * This class encapsulates the bytecode of the adapter class and can be used to load it into the JVM as an actual Class.
@@ -60,22 +44,15 @@
  * class are normally created by {@link JavaAdapterBytecodeGenerator}.
  */
 @SuppressWarnings("javadoc")
-class JavaAdapterClassLoader extends JavaAdapterGeneratorBase {
-    private static final Type PRIVILEGED_ACTION_TYPE = Type.getType(PrivilegedAction.class);
-
-    private static final String PRIVILEGED_ACTION_TYPE_NAME = PRIVILEGED_ACTION_TYPE.getInternalName();
-    private static final String PRIVILEGED_RUN_METHOD_DESCRIPTOR = Type.getMethodDescriptor(OBJECT_TYPE);
-
+final class JavaAdapterClassLoader {
     private static final ProtectionDomain GENERATED_PROTECTION_DOMAIN = createGeneratedProtectionDomain();
 
     private final String className;
     private final byte[] classBytes;
-    private final String globalSetterClassName;
 
-    JavaAdapterClassLoader(String className, byte[] classBytes, String globalSetterClassName) {
+    JavaAdapterClassLoader(String className, byte[] classBytes) {
         this.className = className.replace('/', '.');
         this.classBytes = classBytes;
-        this.globalSetterClassName = globalSetterClassName.replace('/', '.');
     }
 
     /**
@@ -96,16 +73,6 @@
         });
     }
 
-    private static class AdapterLoader extends SecureClassLoader {
-        AdapterLoader(ClassLoader parent) {
-            super(parent);
-        }
-    }
-
-    static boolean isAdapterClass(Class<?> clazz) {
-        return clazz.getClassLoader() instanceof AdapterLoader;
-    }
-
     // Note that the adapter class is created in the protection domain of the class/interface being
     // extended/implemented, and only the privileged global setter action class is generated in the protection domain
     // of Nashorn itself. Also note that the creation and loading of the global setter is deferred until it is
@@ -114,9 +81,8 @@
     // with ability to introspect on the class and use setAccessible(true) on it could invoke the method. It's a
     // security tradeoff...
     private ClassLoader createClassLoader(final ClassLoader parentLoader) {
-        return new AdapterLoader(parentLoader) {
+        return new SecureClassLoader(parentLoader) {
             private final ClassLoader myLoader = getClass().getClassLoader();
-            private final ProtectionDomain myProtectionDomain = getClass().getProtectionDomain();
 
             @Override
             public Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
@@ -138,9 +104,6 @@
             protected Class<?> findClass(final String name) throws ClassNotFoundException {
                 if(name.equals(className)) {
                     return defineClass(name, classBytes, 0, classBytes.length, GENERATED_PROTECTION_DOMAIN);
-                } else if(name.equals(globalSetterClassName)) {
-                    final byte[] bytes = generatePrivilegedActionClassBytes(globalSetterClassName.replace('.', '/'));
-                    return defineClass(name, bytes, 0, bytes.length, myProtectionDomain);
                 } else {
                     throw new ClassNotFoundException(name);
                 }
@@ -158,70 +121,4 @@
         permissions.add(new AllPermission());
         return new ProtectionDomain(new CodeSource(null, (CodeSigner[])null), permissions);
     }
-
-    /**
-     * Generates a PrivilegedAction implementation class for invoking {@link Context#setGlobal(ScriptObject)} from the
-     * adapter class.
-     */
-    private static byte[] generatePrivilegedActionClassBytes(final String className) {
-        final ClassWriter w = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
-        // class GlobalSetter implements PrivilegedAction {
-        w.visit(Opcodes.V1_7, ACC_SUPER | ACC_FINAL, className, null, OBJECT_TYPE_NAME, new String[] {
-                PRIVILEGED_ACTION_TYPE_NAME
-        });
-
-        // private final ScriptObject global;
-        w.visitField(ACC_PRIVATE | ACC_FINAL, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR, null, null).visitEnd();
-
-        // private GlobalSetter(ScriptObject global) {
-        InstructionAdapter mv = new InstructionAdapter(w.visitMethod(ACC_PRIVATE, INIT,
-                SET_GLOBAL_METHOD_DESCRIPTOR, null, new String[0]));
-        mv.visitCode();
-        // super();
-        mv.visitVarInsn(ALOAD, 0);
-        mv.invokespecial(OBJECT_TYPE_NAME, INIT, VOID_NOARG_METHOD_DESCRIPTOR);
-        // this.global = global;
-        mv.visitVarInsn(ALOAD, 0);
-        mv.visitVarInsn(ALOAD, 1);
-        mv.putfield(className, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
-
-        mv.visitInsn(RETURN);
-        mv.visitEnd();
-        mv.visitMaxs(0, 0);
-
-        // public Object run() {
-        mv = new InstructionAdapter(w.visitMethod(ACC_PUBLIC, "run", PRIVILEGED_RUN_METHOD_DESCRIPTOR, null,
-                new String[0]));
-        mv.visitCode();
-        // Context.setGlobal(this.global);
-        mv.visitVarInsn(ALOAD, 0);
-        mv.getfield(className, GLOBAL_FIELD_NAME, SCRIPT_OBJECT_TYPE_DESCRIPTOR);
-        mv.invokestatic(CONTEXT_TYPE_NAME, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR);
-        // return null;
-        mv.visitInsn(ACONST_NULL);
-        mv.visitInsn(ARETURN);
-
-        mv.visitEnd();
-        mv.visitMaxs(0, 0);
-
-        // static void setGlobal(ScriptObject global) {
-        mv = new InstructionAdapter(w.visitMethod(ACC_STATIC, "setGlobal", SET_GLOBAL_METHOD_DESCRIPTOR, null,
-                new String[0]));
-        mv.visitCode();
-        // new GlobalSetter(ScriptObject global)
-        mv.anew(Type.getType("L" + className + ";"));
-        mv.dup();
-        mv.visitVarInsn(ALOAD, 0);
-        mv.invokespecial(className, INIT, SET_GLOBAL_METHOD_DESCRIPTOR);
-        // AccessController.doPrivileged(...)
-        mv.invokestatic(Type.getInternalName(AccessController.class), "doPrivileged", Type.getMethodDescriptor(
-                OBJECT_TYPE, PRIVILEGED_ACTION_TYPE));
-        mv.pop();
-        mv.visitInsn(RETURN);
-
-        mv.visitEnd();
-        mv.visitMaxs(0, 0);
-
-        return w.toByteArray();
-    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterFactory.java	Tue Aug 06 16:54:56 2013 -0700
@@ -138,15 +138,6 @@
     }
 
     /**
-     * Tells if the given Class is an adapter or support class
-     * @param clazz Class object
-     * @return true if the Class given is adapter or support class
-     */
-    public static boolean isAdapterClass(Class<?> clazz) {
-        return JavaAdapterClassLoader.isAdapterClass(clazz);
-    }
-
-    /**
      * Returns whether an instance of the specified class/interface can be generated from a ScriptFunction. Returns true
      * iff: the adapter for the class/interface can be created, it is abstract (this includes interfaces), it has at
      * least one abstract method, all the abstract methods share the same name, and it has a public or protected default
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterGeneratorBase.java	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.linker;
-
-import jdk.internal.org.objectweb.asm.Type;
-import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.ScriptObject;
-
-/**
- * Base class for both {@link JavaAdapterBytecodeGenerator} and {@link JavaAdapterClassLoader}, containing those
- * bytecode types, type names and method descriptor that are used by both.
- */
-@SuppressWarnings("javadoc")
-abstract class JavaAdapterGeneratorBase {
-    static final Type CONTEXT_TYPE       = Type.getType(Context.class);
-    static final Type OBJECT_TYPE        = Type.getType(Object.class);
-    static final Type SCRIPT_OBJECT_TYPE = Type.getType(ScriptObject.class);
-
-    static final String CONTEXT_TYPE_NAME = CONTEXT_TYPE.getInternalName();
-    static final String OBJECT_TYPE_NAME  = OBJECT_TYPE.getInternalName();
-
-    static final String INIT = "<init>";
-
-    static final String GLOBAL_FIELD_NAME = "global";
-
-    static final String SCRIPT_OBJECT_TYPE_DESCRIPTOR = SCRIPT_OBJECT_TYPE.getDescriptor();
-
-    static final String SET_GLOBAL_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE, SCRIPT_OBJECT_TYPE);
-    static final String VOID_NOARG_METHOD_DESCRIPTOR = Type.getMethodDescriptor(Type.VOID_TYPE);
-
-    protected JavaAdapterGeneratorBase() {
-    }
-}
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaAdapterServices.java	Tue Aug 06 16:54:56 2013 -0700
@@ -37,7 +37,7 @@
 /**
  * Provides static utility services to generated Java adapter classes.
  */
-public class JavaAdapterServices {
+public final class JavaAdapterServices {
     private static final ThreadLocal<ScriptObject> classOverrides = new ThreadLocal<>();
 
     private JavaAdapterServices() {
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/JavaArgumentConverters.java	Tue Aug 06 16:54:56 2013 -0700
@@ -42,7 +42,7 @@
  * Utility class shared by {@code NashornLinker} and {@code NashornPrimitiveLinker} for converting JS values to Java
  * types.
  */
-public class JavaArgumentConverters {
+final class JavaArgumentConverters {
 
     private static final MethodHandle TO_BOOLEAN        = findOwnMH("toBoolean", Boolean.class, Object.class);
     private static final MethodHandle TO_STRING         = findOwnMH("toString", String.class, Object.class);
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java	Tue Aug 06 16:54:56 2013 -0700
@@ -477,6 +477,7 @@
         /**
          * Tracer function that logs a callsite miss
          *
+         * @param desc callsite descriptor string
          * @param args arguments to function
          *
          * @throws Throwable if invocation failes or throws exception/error
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornBottomLinker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -30,6 +30,9 @@
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodType;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.beans.BeansLinker;
 import jdk.internal.dynalink.linker.GuardedInvocation;
@@ -37,6 +40,7 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.support.Guards;
+import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 
 /**
@@ -73,7 +77,7 @@
     private static final MethodHandle EMPTY_ELEM_SETTER =
             MH.dropArguments(EMPTY_PROP_SETTER, 0, Object.class);
 
-    private static GuardedInvocation linkBean(final LinkRequest linkRequest, final LinkerServices linkerServices) {
+    private static GuardedInvocation linkBean(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
         final NashornCallSiteDescriptor desc = (NashornCallSiteDescriptor)linkRequest.getCallSiteDescriptor();
         final Object self = linkRequest.getReceiver();
         final String operator = desc.getFirstOperator();
@@ -84,6 +88,22 @@
             }
             throw typeError("not.a.function", ScriptRuntime.safeToString(self));
         case "call":
+            // Support dyn:call on any object that supports some @FunctionalInterface
+            // annotated interface. This way Java method, constructor references or
+            // implementations of java.util.function.* interfaces can be called as though
+            // those are script functions.
+            final Method m = getFunctionalInterfaceMethod(self.getClass());
+            if (m != null) {
+                final MethodType callType = desc.getMethodType();
+                // 'callee' and 'thiz' passed from script + actual arguments
+                if (callType.parameterCount() != m.getParameterCount() + 2) {
+                    throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
+                }
+                return new GuardedInvocation(
+                        // drop 'thiz' passed from the script.
+                        MH.dropArguments(desc.getLookup().unreflect(m), 1, callType.parameterType(1)),
+                        Guards.getInstanceOfGuard(m.getDeclaringClass())).asType(callType);
+            }
             if(BeansLinker.isDynamicMethod(self)) {
                 throw typeError("no.method.matches.args", ScriptRuntime.safeToString(self));
             }
@@ -148,4 +168,44 @@
         }
         return ScriptRuntime.safeToString(linkRequest.getArguments()[1]);
     }
+
+    // cache of @FunctionalInterface method of implementor classes
+    private static final ClassValue<Method> FUNCTIONAL_IFACE_METHOD = new ClassValue<Method>() {
+        @Override
+        protected Method computeValue(final Class<?> type) {
+            return findFunctionalInterfaceMethod(type);
+        }
+
+        private Method findFunctionalInterfaceMethod(final Class<?> clazz) {
+            if (clazz == null) {
+                return null;
+            }
+
+            for (Class<?> iface : clazz.getInterfaces()) {
+                // check accessiblity up-front
+                if (! Context.isAccessibleClass(iface)) {
+                    continue;
+                }
+
+                // check for @FunctionalInterface
+                if (iface.isAnnotationPresent(FunctionalInterface.class)) {
+                    // return the first abstract method
+                    for (final Method m : iface.getMethods()) {
+                        if (Modifier.isAbstract(m.getModifiers())) {
+                            return m;
+                        }
+                    }
+                }
+            }
+
+            // did not find here, try super class
+            return findFunctionalInterfaceMethod(clazz.getSuperclass());
+        }
+    };
+
+    // Returns @FunctionalInterface annotated interface's single abstract
+    // method. If not found, returns null.
+    static Method getFunctionalInterfaceMethod(final Class<?> clazz) {
+        return FUNCTIONAL_IFACE_METHOD.get(clazz);
+    }
 }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornCallSiteDescriptor.java	Tue Aug 06 16:54:56 2013 -0700
@@ -39,7 +39,7 @@
  * we can have a more compact representation, as we know that we're always only using {@code "dyn:*"} operations; also
  * we're storing flags in an additional primitive field.
  */
-public class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor {
+public final class NashornCallSiteDescriptor extends AbstractCallSiteDescriptor {
     /** Flags that the call site references a scope variable (it's an identifier reference or a var declaration, not a
      * property access expression. */
     public static final int CALLSITE_SCOPE                = 0x01;
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornLinker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -46,7 +46,7 @@
  * This is the main dynamic linker for Nashorn. It is used for linking all {@link ScriptObject} and its subclasses (this
  * includes {@link ScriptFunction} and its subclasses) as well as {@link Undefined}.
  */
-public final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator {
+final class NashornLinker implements TypeBasedGuardingDynamicLinker, GuardingTypeConverterFactory, ConversionComparator {
     /**
      * Returns true if {@code ScriptObject} is assignable from {@code type}, or it is {@code Undefined}.
      */
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/NashornStaticClassLinker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -34,6 +34,7 @@
 import jdk.internal.dynalink.linker.LinkerServices;
 import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
 import jdk.internal.dynalink.support.Guards;
+import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ECMAErrors;
 
 /**
@@ -63,10 +64,14 @@
         if (self.getClass() != StaticClass.class) {
             return null;
         }
+        final Class<?> receiverClass = ((StaticClass) self).getRepresentedClass();
+        Bootstrap.checkReflectionAccess(receiverClass);
         final CallSiteDescriptor desc = request.getCallSiteDescriptor();
         // We intercept "new" on StaticClass instances to provide additional capabilities
         if ("new".equals(desc.getNameToken(CallSiteDescriptor.OPERATOR))) {
-            final Class<?> receiverClass = ((StaticClass) self).getRepresentedClass();
+            // make sure new is on accessible Class
+            Context.checkPackageAccess(receiverClass.getName());
+
             // Is the class abstract? (This includes interfaces.)
             if (NashornLinker.isAbstractClass(receiverClass)) {
                 // Change this link request into a link request on the adapter class.
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/PrimitiveLookup.java	Tue Aug 06 16:54:56 2013 -0700
@@ -25,7 +25,6 @@
 
 package jdk.nashorn.internal.runtime.linker;
 
-import jdk.nashorn.internal.lookup.Lookup;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 
 import java.lang.invoke.MethodHandle;
@@ -35,6 +34,7 @@
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.internal.dynalink.support.CallSiteDescriptorFactory;
 import jdk.internal.dynalink.support.Guards;
+import jdk.nashorn.internal.lookup.Lookup;
 import jdk.nashorn.internal.runtime.ScriptObject;
 
 /**
@@ -42,7 +42,7 @@
  * numbers). This class is only public so it can be accessed by classes in the {@code jdk.nashorn.internal.objects}
  * package.
  */
-public class PrimitiveLookup {
+public final class PrimitiveLookup {
 
     private PrimitiveLookup() {
     }
--- a/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/linker/ReflectionCheckLinker.java	Tue Aug 06 16:54:56 2013 -0700
@@ -76,9 +76,10 @@
                 final CallSiteDescriptor desc = requestWithoutContext.getCallSiteDescriptor();
                 if(CallSiteDescriptorFactory.tokenizeOperators(desc).contains("getProp")) {
                     if ("static".equals(desc.getNameToken(CallSiteDescriptor.NAME_OPERAND))) {
-                        Context.checkPackageAccess(((Class)self).getName());
-                        // If "getProp:static" passes package access, allow access.
-                        return;
+                        if (Context.isAccessibleClass((Class<?>)self) && !isReflectionClass((Class<?>)self)) {
+                            // If "getProp:static" passes access checks, allow access.
+                            return;
+                        }
                     }
                 }
             }
--- a/nashorn/src/jdk/nashorn/internal/runtime/options/KeyValueOption.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/options/KeyValueOption.java	Tue Aug 06 16:54:56 2013 -0700
@@ -36,7 +36,7 @@
  *
  * {@code --log=module1:level1,module2:level2... }
  */
-public class KeyValueOption extends Option<String> {
+public final class KeyValueOption extends Option<String> {
     /**
      * Map of keys given
      */
--- a/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/src/jdk/nashorn/internal/runtime/options/OptionTemplate.java	Tue Aug 06 16:54:56 2013 -0700
@@ -34,7 +34,7 @@
  * bundle file. Metainfo such as parameters and description is here as well
  * for context sensitive help generation.
  */
-public class OptionTemplate implements Comparable<OptionTemplate> {
+public final class OptionTemplate implements Comparable<OptionTemplate> {
     /** Resource, e.g. "nashorn" for this option */
     private final String resource;
 
--- a/nashorn/test/script/basic/JDK-8010946-2.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/basic/JDK-8010946-2.js	Tue Aug 06 16:54:56 2013 -0700
@@ -30,9 +30,8 @@
  * @run
  */
 
-// Ensure these are CallerSensitiveDynamicMethods
+// Ensure this is CallerSensitiveDynamicMethod
 print(java.security.AccessController["doPrivileged(PrivilegedAction)"])
-print(java.lang.Class["forName(String)"])
 
 // Ensure this is not
 print(java.lang.String["valueOf(char)"])
--- a/nashorn/test/script/basic/JDK-8010946-2.js.EXPECTED	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/basic/JDK-8010946-2.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -1,3 +1,2 @@
 [jdk.internal.dynalink.beans.CallerSensitiveDynamicMethod Object java.security.AccessController.doPrivileged(PrivilegedAction)]
-[jdk.internal.dynalink.beans.CallerSensitiveDynamicMethod Class java.lang.Class.forName(String)]
 [jdk.internal.dynalink.beans.SimpleDynamicMethod String java.lang.String.valueOf(char)]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8020356.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,10435 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8020356: ClassCastException Undefined->Scope on spiltter class generated for a large switch statement
+ *
+ * @test
+ * @run
+ */
+
+print(hugeSwitch.apply({i: 20}));
+print(hugeArrayLiteral.apply({i: 10}));
+
+function hugeSwitch() {
+    switch (1) {
+        case 1:
+            return this.i;
+        case 2:
+            return this.i;
+        case 3:
+            return this.i;
+        case 4:
+            return this.i;
+        case 5:
+            return this.i;
+        case 6:
+            return this.i;
+        case 7:
+            return this.i;
+        case 8:
+            return this.i;
+        case 9:
+            return this.i;
+        case 10:
+            return this.i;
+        case 11:
+            return this.i;
+        case 12:
+            return this.i;
+        case 13:
+            return this.i;
+        case 14:
+            return this.i;
+        case 15:
+            return this.i;
+        case 16:
+            return this.i;
+        case 17:
+            return this.i;
+        case 18:
+            return this.i;
+        case 19:
+            return this.i;
+        case 20:
+            return this.i;
+        case 21:
+            return this.i;
+        case 22:
+            return this.i;
+        case 23:
+            return this.i;
+        case 24:
+            return this.i;
+        case 25:
+            return this.i;
+        case 26:
+            return this.i;
+        case 27:
+            return this.i;
+        case 28:
+            return this.i;
+        case 29:
+            return this.i;
+        case 30:
+            return this.i;
+        case 31:
+            return this.i;
+        case 32:
+            return this.i;
+        case 33:
+            return this.i;
+        case 34:
+            return this.i;
+        case 35:
+            return this.i;
+        case 36:
+            return this.i;
+        case 37:
+            return this.i;
+        case 38:
+            return this.i;
+        case 39:
+            return this.i;
+        case 40:
+            return this.i;
+        case 41:
+            return this.i;
+        case 42:
+            return this.i;
+        case 43:
+            return this.i;
+        case 44:
+            return this.i;
+        case 45:
+            return this.i;
+        case 46:
+            return this.i;
+        case 47:
+            return this.i;
+        case 48:
+            return this.i;
+        case 49:
+            return this.i;
+        case 50:
+            return this.i;
+        case 51:
+            return this.i;
+        case 52:
+            return this.i;
+        case 53:
+            return this.i;
+        case 54:
+            return this.i;
+        case 55:
+            return this.i;
+        case 56:
+            return this.i;
+        case 57:
+            return this.i;
+        case 58:
+            return this.i;
+        case 59:
+            return this.i;
+        case 60:
+            return this.i;
+        case 61:
+            return this.i;
+        case 62:
+            return this.i;
+        case 63:
+            return this.i;
+        case 64:
+            return this.i;
+        case 65:
+            return this.i;
+        case 66:
+            return this.i;
+        case 67:
+            return this.i;
+        case 68:
+            return this.i;
+        case 69:
+            return this.i;
+        case 70:
+            return this.i;
+        case 71:
+            return this.i;
+        case 72:
+            return this.i;
+        case 73:
+            return this.i;
+        case 74:
+            return this.i;
+        case 75:
+            return this.i;
+        case 76:
+            return this.i;
+        case 77:
+            return this.i;
+        case 78:
+            return this.i;
+        case 79:
+            return this.i;
+        case 80:
+            return this.i;
+        case 81:
+            return this.i;
+        case 82:
+            return this.i;
+        case 83:
+            return this.i;
+        case 84:
+            return this.i;
+        case 85:
+            return this.i;
+        case 86:
+            return this.i;
+        case 87:
+            return this.i;
+        case 88:
+            return this.i;
+        case 89:
+            return this.i;
+        case 90:
+            return this.i;
+        case 91:
+            return this.i;
+        case 92:
+            return this.i;
+        case 93:
+            return this.i;
+        case 94:
+            return this.i;
+        case 95:
+            return this.i;
+        case 96:
+            return this.i;
+        case 97:
+            return this.i;
+        case 98:
+            return this.i;
+        case 99:
+            return this.i;
+        case 100:
+            return this.i;
+        case 101:
+            return this.i;
+        case 102:
+            return this.i;
+        case 103:
+            return this.i;
+        case 104:
+            return this.i;
+        case 105:
+            return this.i;
+        case 106:
+            return this.i;
+        case 107:
+            return this.i;
+        case 108:
+            return this.i;
+        case 109:
+            return this.i;
+        case 110:
+            return this.i;
+        case 111:
+            return this.i;
+        case 112:
+            return this.i;
+        case 113:
+            return this.i;
+        case 114:
+            return this.i;
+        case 115:
+            return this.i;
+        case 116:
+            return this.i;
+        case 117:
+            return this.i;
+        case 118:
+            return this.i;
+        case 119:
+            return this.i;
+        case 120:
+            return this.i;
+        case 121:
+            return this.i;
+        case 122:
+            return this.i;
+        case 123:
+            return this.i;
+        case 124:
+            return this.i;
+        case 125:
+            return this.i;
+        case 126:
+            return this.i;
+        case 127:
+            return this.i;
+        case 128:
+            return this.i;
+        case 129:
+            return this.i;
+        case 130:
+            return this.i;
+        case 131:
+            return this.i;
+        case 132:
+            return this.i;
+        case 133:
+            return this.i;
+        case 134:
+            return this.i;
+        case 135:
+            return this.i;
+        case 136:
+            return this.i;
+        case 137:
+            return this.i;
+        case 138:
+            return this.i;
+        case 139:
+            return this.i;
+        case 140:
+            return this.i;
+        case 141:
+            return this.i;
+        case 142:
+            return this.i;
+        case 143:
+            return this.i;
+        case 144:
+            return this.i;
+        case 145:
+            return this.i;
+        case 146:
+            return this.i;
+        case 147:
+            return this.i;
+        case 148:
+            return this.i;
+        case 149:
+            return this.i;
+        case 150:
+            return this.i;
+        case 151:
+            return this.i;
+        case 152:
+            return this.i;
+        case 153:
+            return this.i;
+        case 154:
+            return this.i;
+        case 155:
+            return this.i;
+        case 156:
+            return this.i;
+        case 157:
+            return this.i;
+        case 158:
+            return this.i;
+        case 159:
+            return this.i;
+        case 160:
+            return this.i;
+        case 161:
+            return this.i;
+        case 162:
+            return this.i;
+        case 163:
+            return this.i;
+        case 164:
+            return this.i;
+        case 165:
+            return this.i;
+        case 166:
+            return this.i;
+        case 167:
+            return this.i;
+        case 168:
+            return this.i;
+        case 169:
+            return this.i;
+        case 170:
+            return this.i;
+        case 171:
+            return this.i;
+        case 172:
+            return this.i;
+        case 173:
+            return this.i;
+        case 174:
+            return this.i;
+        case 175:
+            return this.i;
+        case 176:
+            return this.i;
+        case 177:
+            return this.i;
+        case 178:
+            return this.i;
+        case 179:
+            return this.i;
+        case 180:
+            return this.i;
+        case 181:
+            return this.i;
+        case 182:
+            return this.i;
+        case 183:
+            return this.i;
+        case 184:
+            return this.i;
+        case 185:
+            return this.i;
+        case 186:
+            return this.i;
+        case 187:
+            return this.i;
+        case 188:
+            return this.i;
+        case 189:
+            return this.i;
+        case 190:
+            return this.i;
+        case 191:
+            return this.i;
+        case 192:
+            return this.i;
+        case 193:
+            return this.i;
+        case 194:
+            return this.i;
+        case 195:
+            return this.i;
+        case 196:
+            return this.i;
+        case 197:
+            return this.i;
+        case 198:
+            return this.i;
+        case 199:
+            return this.i;
+        case 200:
+            return this.i;
+        case 201:
+            return this.i;
+        case 202:
+            return this.i;
+        case 203:
+            return this.i;
+        case 204:
+            return this.i;
+        case 205:
+            return this.i;
+        case 206:
+            return this.i;
+        case 207:
+            return this.i;
+        case 208:
+            return this.i;
+        case 209:
+            return this.i;
+        case 210:
+            return this.i;
+        case 211:
+            return this.i;
+        case 212:
+            return this.i;
+        case 213:
+            return this.i;
+        case 214:
+            return this.i;
+        case 215:
+            return this.i;
+        case 216:
+            return this.i;
+        case 217:
+            return this.i;
+        case 218:
+            return this.i;
+        case 219:
+            return this.i;
+        case 220:
+            return this.i;
+        case 221:
+            return this.i;
+        case 222:
+            return this.i;
+        case 223:
+            return this.i;
+        case 224:
+            return this.i;
+        case 225:
+            return this.i;
+        case 226:
+            return this.i;
+        case 227:
+            return this.i;
+        case 228:
+            return this.i;
+        case 229:
+            return this.i;
+        case 230:
+            return this.i;
+        case 231:
+            return this.i;
+        case 232:
+            return this.i;
+        case 233:
+            return this.i;
+        case 234:
+            return this.i;
+        case 235:
+            return this.i;
+        case 236:
+            return this.i;
+        case 237:
+            return this.i;
+        case 238:
+            return this.i;
+        case 239:
+            return this.i;
+        case 240:
+            return this.i;
+        case 241:
+            return this.i;
+        case 242:
+            return this.i;
+        case 243:
+            return this.i;
+        case 244:
+            return this.i;
+        case 245:
+            return this.i;
+        case 246:
+            return this.i;
+        case 247:
+            return this.i;
+        case 248:
+            return this.i;
+        case 249:
+            return this.i;
+        case 250:
+            return this.i;
+        case 251:
+            return this.i;
+        case 252:
+            return this.i;
+        case 253:
+            return this.i;
+        case 254:
+            return this.i;
+        case 255:
+            return this.i;
+        case 256:
+            return this.i;
+        case 257:
+            return this.i;
+        case 258:
+            return this.i;
+        case 259:
+            return this.i;
+        case 260:
+            return this.i;
+        case 261:
+            return this.i;
+        case 262:
+            return this.i;
+        case 263:
+            return this.i;
+        case 264:
+            return this.i;
+        case 265:
+            return this.i;
+        case 266:
+            return this.i;
+        case 267:
+            return this.i;
+        case 268:
+            return this.i;
+        case 269:
+            return this.i;
+        case 270:
+            return this.i;
+        case 271:
+            return this.i;
+        case 272:
+            return this.i;
+        case 273:
+            return this.i;
+        case 274:
+            return this.i;
+        case 275:
+            return this.i;
+        case 276:
+            return this.i;
+        case 277:
+            return this.i;
+        case 278:
+            return this.i;
+        case 279:
+            return this.i;
+        case 280:
+            return this.i;
+        case 281:
+            return this.i;
+        case 282:
+            return this.i;
+        case 283:
+            return this.i;
+        case 284:
+            return this.i;
+        case 285:
+            return this.i;
+        case 286:
+            return this.i;
+        case 287:
+            return this.i;
+        case 288:
+            return this.i;
+        case 289:
+            return this.i;
+        case 290:
+            return this.i;
+        case 291:
+            return this.i;
+        case 292:
+            return this.i;
+        case 293:
+            return this.i;
+        case 294:
+            return this.i;
+        case 295:
+            return this.i;
+        case 296:
+            return this.i;
+        case 297:
+            return this.i;
+        case 298:
+            return this.i;
+        case 299:
+            return this.i;
+        case 300:
+            return this.i;
+        case 301:
+            return this.i;
+        case 302:
+            return this.i;
+        case 303:
+            return this.i;
+        case 304:
+            return this.i;
+        case 305:
+            return this.i;
+        case 306:
+            return this.i;
+        case 307:
+            return this.i;
+        case 308:
+            return this.i;
+        case 309:
+            return this.i;
+        case 310:
+            return this.i;
+        case 311:
+            return this.i;
+        case 312:
+            return this.i;
+        case 313:
+            return this.i;
+        case 314:
+            return this.i;
+        case 315:
+            return this.i;
+        case 316:
+            return this.i;
+        case 317:
+            return this.i;
+        case 318:
+            return this.i;
+        case 319:
+            return this.i;
+        case 320:
+            return this.i;
+        case 321:
+            return this.i;
+        case 322:
+            return this.i;
+        case 323:
+            return this.i;
+        case 324:
+            return this.i;
+        case 325:
+            return this.i;
+        case 326:
+            return this.i;
+        case 327:
+            return this.i;
+        case 328:
+            return this.i;
+        case 329:
+            return this.i;
+        case 330:
+            return this.i;
+        case 331:
+            return this.i;
+        case 332:
+            return this.i;
+        case 333:
+            return this.i;
+        case 334:
+            return this.i;
+        case 335:
+            return this.i;
+        case 336:
+            return this.i;
+        case 337:
+            return this.i;
+        case 338:
+            return this.i;
+        case 339:
+            return this.i;
+        case 340:
+            return this.i;
+        case 341:
+            return this.i;
+        case 342:
+            return this.i;
+        case 343:
+            return this.i;
+        case 344:
+            return this.i;
+        case 345:
+            return this.i;
+        case 346:
+            return this.i;
+        case 347:
+            return this.i;
+        case 348:
+            return this.i;
+        case 349:
+            return this.i;
+        case 350:
+            return this.i;
+        case 351:
+            return this.i;
+        case 352:
+            return this.i;
+        case 353:
+            return this.i;
+        case 354:
+            return this.i;
+        case 355:
+            return this.i;
+        case 356:
+            return this.i;
+        case 357:
+            return this.i;
+        case 358:
+            return this.i;
+        case 359:
+            return this.i;
+        case 360:
+            return this.i;
+        case 361:
+            return this.i;
+        case 362:
+            return this.i;
+        case 363:
+            return this.i;
+        case 364:
+            return this.i;
+        case 365:
+            return this.i;
+        case 366:
+            return this.i;
+        case 367:
+            return this.i;
+        case 368:
+            return this.i;
+        case 369:
+            return this.i;
+        case 370:
+            return this.i;
+        case 371:
+            return this.i;
+        case 372:
+            return this.i;
+        case 373:
+            return this.i;
+        case 374:
+            return this.i;
+        case 375:
+            return this.i;
+        case 376:
+            return this.i;
+        case 377:
+            return this.i;
+        case 378:
+            return this.i;
+        case 379:
+            return this.i;
+        case 380:
+            return this.i;
+        case 381:
+            return this.i;
+        case 382:
+            return this.i;
+        case 383:
+            return this.i;
+        case 384:
+            return this.i;
+        case 385:
+            return this.i;
+        case 386:
+            return this.i;
+        case 387:
+            return this.i;
+        case 388:
+            return this.i;
+        case 389:
+            return this.i;
+        case 390:
+            return this.i;
+        case 391:
+            return this.i;
+        case 392:
+            return this.i;
+        case 393:
+            return this.i;
+        case 394:
+            return this.i;
+        case 395:
+            return this.i;
+        case 396:
+            return this.i;
+        case 397:
+            return this.i;
+        case 398:
+            return this.i;
+        case 399:
+            return this.i;
+        case 400:
+            return this.i;
+        case 401:
+            return this.i;
+        case 402:
+            return this.i;
+        case 403:
+            return this.i;
+        case 404:
+            return this.i;
+        case 405:
+            return this.i;
+        case 406:
+            return this.i;
+        case 407:
+            return this.i;
+        case 408:
+            return this.i;
+        case 409:
+            return this.i;
+        case 410:
+            return this.i;
+        case 411:
+            return this.i;
+        case 412:
+            return this.i;
+        case 413:
+            return this.i;
+        case 414:
+            return this.i;
+        case 415:
+            return this.i;
+        case 416:
+            return this.i;
+        case 417:
+            return this.i;
+        case 418:
+            return this.i;
+        case 419:
+            return this.i;
+        case 420:
+            return this.i;
+        case 421:
+            return this.i;
+        case 422:
+            return this.i;
+        case 423:
+            return this.i;
+        case 424:
+            return this.i;
+        case 425:
+            return this.i;
+        case 426:
+            return this.i;
+        case 427:
+            return this.i;
+        case 428:
+            return this.i;
+        case 429:
+            return this.i;
+        case 430:
+            return this.i;
+        case 431:
+            return this.i;
+        case 432:
+            return this.i;
+        case 433:
+            return this.i;
+        case 434:
+            return this.i;
+        case 435:
+            return this.i;
+        case 436:
+            return this.i;
+        case 437:
+            return this.i;
+        case 438:
+            return this.i;
+        case 439:
+            return this.i;
+        case 440:
+            return this.i;
+        case 441:
+            return this.i;
+        case 442:
+            return this.i;
+        case 443:
+            return this.i;
+        case 444:
+            return this.i;
+        case 445:
+            return this.i;
+        case 446:
+            return this.i;
+        case 447:
+            return this.i;
+        case 448:
+            return this.i;
+        case 449:
+            return this.i;
+        case 450:
+            return this.i;
+        case 451:
+            return this.i;
+        case 452:
+            return this.i;
+        case 453:
+            return this.i;
+        case 454:
+            return this.i;
+        case 455:
+            return this.i;
+        case 456:
+            return this.i;
+        case 457:
+            return this.i;
+        case 458:
+            return this.i;
+        case 459:
+            return this.i;
+        case 460:
+            return this.i;
+        case 461:
+            return this.i;
+        case 462:
+            return this.i;
+        case 463:
+            return this.i;
+        case 464:
+            return this.i;
+        case 465:
+            return this.i;
+        case 466:
+            return this.i;
+        case 467:
+            return this.i;
+        case 468:
+            return this.i;
+        case 469:
+            return this.i;
+        case 470:
+            return this.i;
+        case 471:
+            return this.i;
+        case 472:
+            return this.i;
+        case 473:
+            return this.i;
+        case 474:
+            return this.i;
+        case 475:
+            return this.i;
+        case 476:
+            return this.i;
+        case 477:
+            return this.i;
+        case 478:
+            return this.i;
+        case 479:
+            return this.i;
+        case 480:
+            return this.i;
+        case 481:
+            return this.i;
+        case 482:
+            return this.i;
+        case 483:
+            return this.i;
+        case 484:
+            return this.i;
+        case 485:
+            return this.i;
+        case 486:
+            return this.i;
+        case 487:
+            return this.i;
+        case 488:
+            return this.i;
+        case 489:
+            return this.i;
+        case 490:
+            return this.i;
+        case 491:
+            return this.i;
+        case 492:
+            return this.i;
+        case 493:
+            return this.i;
+        case 494:
+            return this.i;
+        case 495:
+            return this.i;
+        case 496:
+            return this.i;
+        case 497:
+            return this.i;
+        case 498:
+            return this.i;
+        case 499:
+            return this.i;
+        case 500:
+            return this.i;
+        case 501:
+            return this.i;
+        case 502:
+            return this.i;
+        case 503:
+            return this.i;
+        case 504:
+            return this.i;
+        case 505:
+            return this.i;
+        case 506:
+            return this.i;
+        case 507:
+            return this.i;
+        case 508:
+            return this.i;
+        case 509:
+            return this.i;
+        case 510:
+            return this.i;
+        case 511:
+            return this.i;
+        case 512:
+            return this.i;
+        case 513:
+            return this.i;
+        case 514:
+            return this.i;
+        case 515:
+            return this.i;
+        case 516:
+            return this.i;
+        case 517:
+            return this.i;
+        case 518:
+            return this.i;
+        case 519:
+            return this.i;
+        case 520:
+            return this.i;
+        case 521:
+            return this.i;
+        case 522:
+            return this.i;
+        case 523:
+            return this.i;
+        case 524:
+            return this.i;
+        case 525:
+            return this.i;
+        case 526:
+            return this.i;
+        case 527:
+            return this.i;
+        case 528:
+            return this.i;
+        case 529:
+            return this.i;
+        case 530:
+            return this.i;
+        case 531:
+            return this.i;
+        case 532:
+            return this.i;
+        case 533:
+            return this.i;
+        case 534:
+            return this.i;
+        case 535:
+            return this.i;
+        case 536:
+            return this.i;
+        case 537:
+            return this.i;
+        case 538:
+            return this.i;
+        case 539:
+            return this.i;
+        case 540:
+            return this.i;
+        case 541:
+            return this.i;
+        case 542:
+            return this.i;
+        case 543:
+            return this.i;
+        case 544:
+            return this.i;
+        case 545:
+            return this.i;
+        case 546:
+            return this.i;
+        case 547:
+            return this.i;
+        case 548:
+            return this.i;
+        case 549:
+            return this.i;
+        case 550:
+            return this.i;
+        case 551:
+            return this.i;
+        case 552:
+            return this.i;
+        case 553:
+            return this.i;
+        case 554:
+            return this.i;
+        case 555:
+            return this.i;
+        case 556:
+            return this.i;
+        case 557:
+            return this.i;
+        case 558:
+            return this.i;
+        case 559:
+            return this.i;
+        case 560:
+            return this.i;
+        case 561:
+            return this.i;
+        case 562:
+            return this.i;
+        case 563:
+            return this.i;
+        case 564:
+            return this.i;
+        case 565:
+            return this.i;
+        case 566:
+            return this.i;
+        case 567:
+            return this.i;
+        case 568:
+            return this.i;
+        case 569:
+            return this.i;
+        case 570:
+            return this.i;
+        case 571:
+            return this.i;
+        case 572:
+            return this.i;
+        case 573:
+            return this.i;
+        case 574:
+            return this.i;
+        case 575:
+            return this.i;
+        case 576:
+            return this.i;
+        case 577:
+            return this.i;
+        case 578:
+            return this.i;
+        case 579:
+            return this.i;
+        case 580:
+            return this.i;
+        case 581:
+            return this.i;
+        case 582:
+            return this.i;
+        case 583:
+            return this.i;
+        case 584:
+            return this.i;
+        case 585:
+            return this.i;
+        case 586:
+            return this.i;
+        case 587:
+            return this.i;
+        case 588:
+            return this.i;
+        case 589:
+            return this.i;
+        case 590:
+            return this.i;
+        case 591:
+            return this.i;
+        case 592:
+            return this.i;
+        case 593:
+            return this.i;
+        case 594:
+            return this.i;
+        case 595:
+            return this.i;
+        case 596:
+            return this.i;
+        case 597:
+            return this.i;
+        case 598:
+            return this.i;
+        case 599:
+            return this.i;
+        case 600:
+            return this.i;
+        case 601:
+            return this.i;
+        case 602:
+            return this.i;
+        case 603:
+            return this.i;
+        case 604:
+            return this.i;
+        case 605:
+            return this.i;
+        case 606:
+            return this.i;
+        case 607:
+            return this.i;
+        case 608:
+            return this.i;
+        case 609:
+            return this.i;
+        case 610:
+            return this.i;
+        case 611:
+            return this.i;
+        case 612:
+            return this.i;
+        case 613:
+            return this.i;
+        case 614:
+            return this.i;
+        case 615:
+            return this.i;
+        case 616:
+            return this.i;
+        case 617:
+            return this.i;
+        case 618:
+            return this.i;
+        case 619:
+            return this.i;
+        case 620:
+            return this.i;
+        case 621:
+            return this.i;
+        case 622:
+            return this.i;
+        case 623:
+            return this.i;
+        case 624:
+            return this.i;
+        case 625:
+            return this.i;
+        case 626:
+            return this.i;
+        case 627:
+            return this.i;
+        case 628:
+            return this.i;
+        case 629:
+            return this.i;
+        case 630:
+            return this.i;
+        case 631:
+            return this.i;
+        case 632:
+            return this.i;
+        case 633:
+            return this.i;
+        case 634:
+            return this.i;
+        case 635:
+            return this.i;
+        case 636:
+            return this.i;
+        case 637:
+            return this.i;
+        case 638:
+            return this.i;
+        case 639:
+            return this.i;
+        case 640:
+            return this.i;
+        case 641:
+            return this.i;
+        case 642:
+            return this.i;
+        case 643:
+            return this.i;
+        case 644:
+            return this.i;
+        case 645:
+            return this.i;
+        case 646:
+            return this.i;
+        case 647:
+            return this.i;
+        case 648:
+            return this.i;
+        case 649:
+            return this.i;
+        case 650:
+            return this.i;
+        case 651:
+            return this.i;
+        case 652:
+            return this.i;
+        case 653:
+            return this.i;
+        case 654:
+            return this.i;
+        case 655:
+            return this.i;
+        case 656:
+            return this.i;
+        case 657:
+            return this.i;
+        case 658:
+            return this.i;
+        case 659:
+            return this.i;
+        case 660:
+            return this.i;
+        case 661:
+            return this.i;
+        case 662:
+            return this.i;
+        case 663:
+            return this.i;
+        case 664:
+            return this.i;
+        case 665:
+            return this.i;
+        case 666:
+            return this.i;
+        case 667:
+            return this.i;
+        case 668:
+            return this.i;
+        case 669:
+            return this.i;
+        case 670:
+            return this.i;
+        case 671:
+            return this.i;
+        case 672:
+            return this.i;
+        case 673:
+            return this.i;
+        case 674:
+            return this.i;
+        case 675:
+            return this.i;
+        case 676:
+            return this.i;
+        case 677:
+            return this.i;
+        case 678:
+            return this.i;
+        case 679:
+            return this.i;
+        case 680:
+            return this.i;
+        case 681:
+            return this.i;
+        case 682:
+            return this.i;
+        case 683:
+            return this.i;
+        case 684:
+            return this.i;
+        case 685:
+            return this.i;
+        case 686:
+            return this.i;
+        case 687:
+            return this.i;
+        case 688:
+            return this.i;
+        case 689:
+            return this.i;
+        case 690:
+            return this.i;
+        case 691:
+            return this.i;
+        case 692:
+            return this.i;
+        case 693:
+            return this.i;
+        case 694:
+            return this.i;
+        case 695:
+            return this.i;
+        case 696:
+            return this.i;
+        case 697:
+            return this.i;
+        case 698:
+            return this.i;
+        case 699:
+            return this.i;
+        case 700:
+            return this.i;
+        case 701:
+            return this.i;
+        case 702:
+            return this.i;
+        case 703:
+            return this.i;
+        case 704:
+            return this.i;
+        case 705:
+            return this.i;
+        case 706:
+            return this.i;
+        case 707:
+            return this.i;
+        case 708:
+            return this.i;
+        case 709:
+            return this.i;
+        case 710:
+            return this.i;
+        case 711:
+            return this.i;
+        case 712:
+            return this.i;
+        case 713:
+            return this.i;
+        case 714:
+            return this.i;
+        case 715:
+            return this.i;
+        case 716:
+            return this.i;
+        case 717:
+            return this.i;
+        case 718:
+            return this.i;
+        case 719:
+            return this.i;
+        case 720:
+            return this.i;
+        case 721:
+            return this.i;
+        case 722:
+            return this.i;
+        case 723:
+            return this.i;
+        case 724:
+            return this.i;
+        case 725:
+            return this.i;
+        case 726:
+            return this.i;
+        case 727:
+            return this.i;
+        case 728:
+            return this.i;
+        case 729:
+            return this.i;
+        case 730:
+            return this.i;
+        case 731:
+            return this.i;
+        case 732:
+            return this.i;
+        case 733:
+            return this.i;
+        case 734:
+            return this.i;
+        case 735:
+            return this.i;
+        case 736:
+            return this.i;
+        case 737:
+            return this.i;
+        case 738:
+            return this.i;
+        case 739:
+            return this.i;
+        case 740:
+            return this.i;
+        case 741:
+            return this.i;
+        case 742:
+            return this.i;
+        case 743:
+            return this.i;
+        case 744:
+            return this.i;
+        case 745:
+            return this.i;
+        case 746:
+            return this.i;
+        case 747:
+            return this.i;
+        case 748:
+            return this.i;
+        case 749:
+            return this.i;
+        case 750:
+            return this.i;
+        case 751:
+            return this.i;
+        case 752:
+            return this.i;
+        case 753:
+            return this.i;
+        case 754:
+            return this.i;
+        case 755:
+            return this.i;
+        case 756:
+            return this.i;
+        case 757:
+            return this.i;
+        case 758:
+            return this.i;
+        case 759:
+            return this.i;
+        case 760:
+            return this.i;
+        case 761:
+            return this.i;
+        case 762:
+            return this.i;
+        case 763:
+            return this.i;
+        case 764:
+            return this.i;
+        case 765:
+            return this.i;
+        case 766:
+            return this.i;
+        case 767:
+            return this.i;
+        case 768:
+            return this.i;
+        case 769:
+            return this.i;
+        case 770:
+            return this.i;
+        case 771:
+            return this.i;
+        case 772:
+            return this.i;
+        case 773:
+            return this.i;
+        case 774:
+            return this.i;
+        case 775:
+            return this.i;
+        case 776:
+            return this.i;
+        case 777:
+            return this.i;
+        case 778:
+            return this.i;
+        case 779:
+            return this.i;
+        case 780:
+            return this.i;
+        case 781:
+            return this.i;
+        case 782:
+            return this.i;
+        case 783:
+            return this.i;
+        case 784:
+            return this.i;
+        case 785:
+            return this.i;
+        case 786:
+            return this.i;
+        case 787:
+            return this.i;
+        case 788:
+            return this.i;
+        case 789:
+            return this.i;
+        case 790:
+            return this.i;
+        case 791:
+            return this.i;
+        case 792:
+            return this.i;
+        case 793:
+            return this.i;
+        case 794:
+            return this.i;
+        case 795:
+            return this.i;
+        case 796:
+            return this.i;
+        case 797:
+            return this.i;
+        case 798:
+            return this.i;
+        case 799:
+            return this.i;
+        case 800:
+            return this.i;
+        case 801:
+            return this.i;
+        case 802:
+            return this.i;
+        case 803:
+            return this.i;
+        case 804:
+            return this.i;
+        case 805:
+            return this.i;
+        case 806:
+            return this.i;
+        case 807:
+            return this.i;
+        case 808:
+            return this.i;
+        case 809:
+            return this.i;
+        case 810:
+            return this.i;
+        case 811:
+            return this.i;
+        case 812:
+            return this.i;
+        case 813:
+            return this.i;
+        case 814:
+            return this.i;
+        case 815:
+            return this.i;
+        case 816:
+            return this.i;
+        case 817:
+            return this.i;
+        case 818:
+            return this.i;
+        case 819:
+            return this.i;
+        case 820:
+            return this.i;
+        case 821:
+            return this.i;
+        case 822:
+            return this.i;
+        case 823:
+            return this.i;
+        case 824:
+            return this.i;
+        case 825:
+            return this.i;
+        case 826:
+            return this.i;
+        case 827:
+            return this.i;
+        case 828:
+            return this.i;
+        case 829:
+            return this.i;
+        case 830:
+            return this.i;
+        case 831:
+            return this.i;
+        case 832:
+            return this.i;
+        case 833:
+            return this.i;
+        case 834:
+            return this.i;
+        case 835:
+            return this.i;
+        case 836:
+            return this.i;
+        case 837:
+            return this.i;
+        case 838:
+            return this.i;
+        case 839:
+            return this.i;
+        case 840:
+            return this.i;
+        case 841:
+            return this.i;
+        case 842:
+            return this.i;
+        case 843:
+            return this.i;
+        case 844:
+            return this.i;
+        case 845:
+            return this.i;
+        case 846:
+            return this.i;
+        case 847:
+            return this.i;
+        case 848:
+            return this.i;
+        case 849:
+            return this.i;
+        case 850:
+            return this.i;
+        case 851:
+            return this.i;
+        case 852:
+            return this.i;
+        case 853:
+            return this.i;
+        case 854:
+            return this.i;
+        case 855:
+            return this.i;
+        case 856:
+            return this.i;
+        case 857:
+            return this.i;
+        case 858:
+            return this.i;
+        case 859:
+            return this.i;
+        case 860:
+            return this.i;
+        case 861:
+            return this.i;
+        case 862:
+            return this.i;
+        case 863:
+            return this.i;
+        case 864:
+            return this.i;
+        case 865:
+            return this.i;
+        case 866:
+            return this.i;
+        case 867:
+            return this.i;
+        case 868:
+            return this.i;
+        case 869:
+            return this.i;
+        case 870:
+            return this.i;
+        case 871:
+            return this.i;
+        case 872:
+            return this.i;
+        case 873:
+            return this.i;
+        case 874:
+            return this.i;
+        case 875:
+            return this.i;
+        case 876:
+            return this.i;
+        case 877:
+            return this.i;
+        case 878:
+            return this.i;
+        case 879:
+            return this.i;
+        case 880:
+            return this.i;
+        case 881:
+            return this.i;
+        case 882:
+            return this.i;
+        case 883:
+            return this.i;
+        case 884:
+            return this.i;
+        case 885:
+            return this.i;
+        case 886:
+            return this.i;
+        case 887:
+            return this.i;
+        case 888:
+            return this.i;
+        case 889:
+            return this.i;
+        case 890:
+            return this.i;
+        case 891:
+            return this.i;
+        case 892:
+            return this.i;
+        case 893:
+            return this.i;
+        case 894:
+            return this.i;
+        case 895:
+            return this.i;
+        case 896:
+            return this.i;
+        case 897:
+            return this.i;
+        case 898:
+            return this.i;
+        case 899:
+            return this.i;
+        case 900:
+            return this.i;
+        case 901:
+            return this.i;
+        case 902:
+            return this.i;
+        case 903:
+            return this.i;
+        case 904:
+            return this.i;
+        case 905:
+            return this.i;
+        case 906:
+            return this.i;
+        case 907:
+            return this.i;
+        case 908:
+            return this.i;
+        case 909:
+            return this.i;
+        case 910:
+            return this.i;
+        case 911:
+            return this.i;
+        case 912:
+            return this.i;
+        case 913:
+            return this.i;
+        case 914:
+            return this.i;
+        case 915:
+            return this.i;
+        case 916:
+            return this.i;
+        case 917:
+            return this.i;
+        case 918:
+            return this.i;
+        case 919:
+            return this.i;
+        case 920:
+            return this.i;
+        case 921:
+            return this.i;
+        case 922:
+            return this.i;
+        case 923:
+            return this.i;
+        case 924:
+            return this.i;
+        case 925:
+            return this.i;
+        case 926:
+            return this.i;
+        case 927:
+            return this.i;
+        case 928:
+            return this.i;
+        case 929:
+            return this.i;
+        case 930:
+            return this.i;
+        case 931:
+            return this.i;
+        case 932:
+            return this.i;
+        case 933:
+            return this.i;
+        case 934:
+            return this.i;
+        case 935:
+            return this.i;
+        case 936:
+            return this.i;
+        case 937:
+            return this.i;
+        case 938:
+            return this.i;
+        case 939:
+            return this.i;
+        case 940:
+            return this.i;
+        case 941:
+            return this.i;
+        case 942:
+            return this.i;
+        case 943:
+            return this.i;
+        case 944:
+            return this.i;
+        case 945:
+            return this.i;
+        case 946:
+            return this.i;
+        case 947:
+            return this.i;
+        case 948:
+            return this.i;
+        case 949:
+            return this.i;
+        case 950:
+            return this.i;
+        case 951:
+            return this.i;
+        case 952:
+            return this.i;
+        case 953:
+            return this.i;
+        case 954:
+            return this.i;
+        case 955:
+            return this.i;
+        case 956:
+            return this.i;
+        case 957:
+            return this.i;
+        case 958:
+            return this.i;
+        case 959:
+            return this.i;
+        case 960:
+            return this.i;
+        case 961:
+            return this.i;
+        case 962:
+            return this.i;
+        case 963:
+            return this.i;
+        case 964:
+            return this.i;
+        case 965:
+            return this.i;
+        case 966:
+            return this.i;
+        case 967:
+            return this.i;
+        case 968:
+            return this.i;
+        case 969:
+            return this.i;
+        case 970:
+            return this.i;
+        case 971:
+            return this.i;
+        case 972:
+            return this.i;
+        case 973:
+            return this.i;
+        case 974:
+            return this.i;
+        case 975:
+            return this.i;
+        case 976:
+            return this.i;
+        case 977:
+            return this.i;
+        case 978:
+            return this.i;
+        case 979:
+            return this.i;
+        case 980:
+            return this.i;
+        case 981:
+            return this.i;
+        case 982:
+            return this.i;
+        case 983:
+            return this.i;
+        case 984:
+            return this.i;
+        case 985:
+            return this.i;
+        case 986:
+            return this.i;
+        case 987:
+            return this.i;
+        case 988:
+            return this.i;
+        case 989:
+            return this.i;
+        case 990:
+            return this.i;
+        case 991:
+            return this.i;
+        case 992:
+            return this.i;
+        case 993:
+            return this.i;
+        case 994:
+            return this.i;
+        case 995:
+            return this.i;
+        case 996:
+            return this.i;
+        case 997:
+            return this.i;
+        case 998:
+            return this.i;
+        case 999:
+            return this.i;
+        case 1000:
+            return this.i;
+        case 1001:
+            return this.i;
+        case 1002:
+            return this.i;
+        case 1003:
+            return this.i;
+        case 1004:
+            return this.i;
+        case 1005:
+            return this.i;
+        case 1006:
+            return this.i;
+        case 1007:
+            return this.i;
+        case 1008:
+            return this.i;
+        case 1009:
+            return this.i;
+        case 1010:
+            return this.i;
+        case 1011:
+            return this.i;
+        case 1012:
+            return this.i;
+        case 1013:
+            return this.i;
+        case 1014:
+            return this.i;
+        case 1015:
+            return this.i;
+        case 1016:
+            return this.i;
+        case 1017:
+            return this.i;
+        case 1018:
+            return this.i;
+        case 1019:
+            return this.i;
+        case 1020:
+            return this.i;
+        case 1021:
+            return this.i;
+        case 1022:
+            return this.i;
+        case 1023:
+            return this.i;
+        case 1024:
+            return this.i;
+        case 1025:
+            return this.i;
+        case 1026:
+            return this.i;
+        case 1027:
+            return this.i;
+        case 1028:
+            return this.i;
+        case 1029:
+            return this.i;
+        case 1030:
+            return this.i;
+        case 1031:
+            return this.i;
+        case 1032:
+            return this.i;
+        case 1033:
+            return this.i;
+        case 1034:
+            return this.i;
+        case 1035:
+            return this.i;
+        case 1036:
+            return this.i;
+        case 1037:
+            return this.i;
+        case 1038:
+            return this.i;
+        case 1039:
+            return this.i;
+        case 1040:
+            return this.i;
+        case 1041:
+            return this.i;
+        case 1042:
+            return this.i;
+        case 1043:
+            return this.i;
+        case 1044:
+            return this.i;
+        case 1045:
+            return this.i;
+        case 1046:
+            return this.i;
+        case 1047:
+            return this.i;
+        case 1048:
+            return this.i;
+        case 1049:
+            return this.i;
+        case 1050:
+            return this.i;
+        case 1051:
+            return this.i;
+        case 1052:
+            return this.i;
+        case 1053:
+            return this.i;
+        case 1054:
+            return this.i;
+        case 1055:
+            return this.i;
+        case 1056:
+            return this.i;
+        case 1057:
+            return this.i;
+        case 1058:
+            return this.i;
+        case 1059:
+            return this.i;
+        case 1060:
+            return this.i;
+        case 1061:
+            return this.i;
+        case 1062:
+            return this.i;
+        case 1063:
+            return this.i;
+        case 1064:
+            return this.i;
+        case 1065:
+            return this.i;
+        case 1066:
+            return this.i;
+        case 1067:
+            return this.i;
+        case 1068:
+            return this.i;
+        case 1069:
+            return this.i;
+        case 1070:
+            return this.i;
+        case 1071:
+            return this.i;
+        case 1072:
+            return this.i;
+        case 1073:
+            return this.i;
+        case 1074:
+            return this.i;
+        case 1075:
+            return this.i;
+        case 1076:
+            return this.i;
+        case 1077:
+            return this.i;
+        case 1078:
+            return this.i;
+        case 1079:
+            return this.i;
+        case 1080:
+            return this.i;
+        case 1081:
+            return this.i;
+        case 1082:
+            return this.i;
+        case 1083:
+            return this.i;
+        case 1084:
+            return this.i;
+        case 1085:
+            return this.i;
+        case 1086:
+            return this.i;
+        case 1087:
+            return this.i;
+        case 1088:
+            return this.i;
+        case 1089:
+            return this.i;
+        case 1090:
+            return this.i;
+        case 1091:
+            return this.i;
+        case 1092:
+            return this.i;
+        case 1093:
+            return this.i;
+        case 1094:
+            return this.i;
+        case 1095:
+            return this.i;
+        case 1096:
+            return this.i;
+        case 1097:
+            return this.i;
+        case 1098:
+            return this.i;
+        case 1099:
+            return this.i;
+        case 1100:
+            return this.i;
+        case 1101:
+            return this.i;
+        case 1102:
+            return this.i;
+        case 1103:
+            return this.i;
+        case 1104:
+            return this.i;
+        case 1105:
+            return this.i;
+        case 1106:
+            return this.i;
+        case 1107:
+            return this.i;
+        case 1108:
+            return this.i;
+        case 1109:
+            return this.i;
+        case 1110:
+            return this.i;
+        case 1111:
+            return this.i;
+        case 1112:
+            return this.i;
+        case 1113:
+            return this.i;
+        case 1114:
+            return this.i;
+        case 1115:
+            return this.i;
+        case 1116:
+            return this.i;
+        case 1117:
+            return this.i;
+        case 1118:
+            return this.i;
+        case 1119:
+            return this.i;
+        case 1120:
+            return this.i;
+        case 1121:
+            return this.i;
+        case 1122:
+            return this.i;
+        case 1123:
+            return this.i;
+        case 1124:
+            return this.i;
+        case 1125:
+            return this.i;
+        case 1126:
+            return this.i;
+        case 1127:
+            return this.i;
+        case 1128:
+            return this.i;
+        case 1129:
+            return this.i;
+        case 1130:
+            return this.i;
+        case 1131:
+            return this.i;
+        case 1132:
+            return this.i;
+        case 1133:
+            return this.i;
+        case 1134:
+            return this.i;
+        case 1135:
+            return this.i;
+        case 1136:
+            return this.i;
+        case 1137:
+            return this.i;
+        case 1138:
+            return this.i;
+        case 1139:
+            return this.i;
+        case 1140:
+            return this.i;
+        case 1141:
+            return this.i;
+        case 1142:
+            return this.i;
+        case 1143:
+            return this.i;
+        case 1144:
+            return this.i;
+        case 1145:
+            return this.i;
+        case 1146:
+            return this.i;
+        case 1147:
+            return this.i;
+        case 1148:
+            return this.i;
+        case 1149:
+            return this.i;
+        case 1150:
+            return this.i;
+        case 1151:
+            return this.i;
+        case 1152:
+            return this.i;
+        case 1153:
+            return this.i;
+        case 1154:
+            return this.i;
+        case 1155:
+            return this.i;
+        case 1156:
+            return this.i;
+        case 1157:
+            return this.i;
+        case 1158:
+            return this.i;
+        case 1159:
+            return this.i;
+        case 1160:
+            return this.i;
+        case 1161:
+            return this.i;
+        case 1162:
+            return this.i;
+        case 1163:
+            return this.i;
+        case 1164:
+            return this.i;
+        case 1165:
+            return this.i;
+        case 1166:
+            return this.i;
+        case 1167:
+            return this.i;
+        case 1168:
+            return this.i;
+        case 1169:
+            return this.i;
+        case 1170:
+            return this.i;
+        case 1171:
+            return this.i;
+        case 1172:
+            return this.i;
+        case 1173:
+            return this.i;
+        case 1174:
+            return this.i;
+        case 1175:
+            return this.i;
+        case 1176:
+            return this.i;
+        case 1177:
+            return this.i;
+        case 1178:
+            return this.i;
+        case 1179:
+            return this.i;
+        case 1180:
+            return this.i;
+        case 1181:
+            return this.i;
+        case 1182:
+            return this.i;
+        case 1183:
+            return this.i;
+        case 1184:
+            return this.i;
+        case 1185:
+            return this.i;
+        case 1186:
+            return this.i;
+        case 1187:
+            return this.i;
+        case 1188:
+            return this.i;
+        case 1189:
+            return this.i;
+        case 1190:
+            return this.i;
+        case 1191:
+            return this.i;
+        case 1192:
+            return this.i;
+        case 1193:
+            return this.i;
+        case 1194:
+            return this.i;
+        case 1195:
+            return this.i;
+        case 1196:
+            return this.i;
+        case 1197:
+            return this.i;
+        case 1198:
+            return this.i;
+        case 1199:
+            return this.i;
+        case 1200:
+            return this.i;
+        case 1201:
+            return this.i;
+        case 1202:
+            return this.i;
+        case 1203:
+            return this.i;
+        case 1204:
+            return this.i;
+        case 1205:
+            return this.i;
+        case 1206:
+            return this.i;
+        case 1207:
+            return this.i;
+        case 1208:
+            return this.i;
+        case 1209:
+            return this.i;
+        case 1210:
+            return this.i;
+        case 1211:
+            return this.i;
+        case 1212:
+            return this.i;
+        case 1213:
+            return this.i;
+        case 1214:
+            return this.i;
+        case 1215:
+            return this.i;
+        case 1216:
+            return this.i;
+        case 1217:
+            return this.i;
+        case 1218:
+            return this.i;
+        case 1219:
+            return this.i;
+        case 1220:
+            return this.i;
+        case 1221:
+            return this.i;
+        case 1222:
+            return this.i;
+        case 1223:
+            return this.i;
+        case 1224:
+            return this.i;
+        case 1225:
+            return this.i;
+        case 1226:
+            return this.i;
+        case 1227:
+            return this.i;
+        case 1228:
+            return this.i;
+        case 1229:
+            return this.i;
+        case 1230:
+            return this.i;
+        case 1231:
+            return this.i;
+        case 1232:
+            return this.i;
+        case 1233:
+            return this.i;
+        case 1234:
+            return this.i;
+        case 1235:
+            return this.i;
+        case 1236:
+            return this.i;
+        case 1237:
+            return this.i;
+        case 1238:
+            return this.i;
+        case 1239:
+            return this.i;
+        case 1240:
+            return this.i;
+        case 1241:
+            return this.i;
+        case 1242:
+            return this.i;
+        case 1243:
+            return this.i;
+        case 1244:
+            return this.i;
+        case 1245:
+            return this.i;
+        case 1246:
+            return this.i;
+        case 1247:
+            return this.i;
+        case 1248:
+            return this.i;
+        case 1249:
+            return this.i;
+        case 1250:
+            return this.i;
+        case 1251:
+            return this.i;
+        case 1252:
+            return this.i;
+        case 1253:
+            return this.i;
+        case 1254:
+            return this.i;
+        case 1255:
+            return this.i;
+        case 1256:
+            return this.i;
+        case 1257:
+            return this.i;
+        case 1258:
+            return this.i;
+        case 1259:
+            return this.i;
+        case 1260:
+            return this.i;
+        case 1261:
+            return this.i;
+        case 1262:
+            return this.i;
+        case 1263:
+            return this.i;
+        case 1264:
+            return this.i;
+        case 1265:
+            return this.i;
+        case 1266:
+            return this.i;
+        case 1267:
+            return this.i;
+        case 1268:
+            return this.i;
+        case 1269:
+            return this.i;
+        case 1270:
+            return this.i;
+        case 1271:
+            return this.i;
+        case 1272:
+            return this.i;
+        case 1273:
+            return this.i;
+        case 1274:
+            return this.i;
+        case 1275:
+            return this.i;
+        case 1276:
+            return this.i;
+        case 1277:
+            return this.i;
+        case 1278:
+            return this.i;
+        case 1279:
+            return this.i;
+        case 1280:
+            return this.i;
+        case 1281:
+            return this.i;
+        case 1282:
+            return this.i;
+        case 1283:
+            return this.i;
+        case 1284:
+            return this.i;
+        case 1285:
+            return this.i;
+        case 1286:
+            return this.i;
+        case 1287:
+            return this.i;
+        case 1288:
+            return this.i;
+        case 1289:
+            return this.i;
+        case 1290:
+            return this.i;
+        case 1291:
+            return this.i;
+        case 1292:
+            return this.i;
+        case 1293:
+            return this.i;
+        case 1294:
+            return this.i;
+        case 1295:
+            return this.i;
+        case 1296:
+            return this.i;
+        case 1297:
+            return this.i;
+        case 1298:
+            return this.i;
+        case 1299:
+            return this.i;
+        case 1300:
+            return this.i;
+        case 1301:
+            return this.i;
+        case 1302:
+            return this.i;
+        case 1303:
+            return this.i;
+        case 1304:
+            return this.i;
+        case 1305:
+            return this.i;
+        case 1306:
+            return this.i;
+        case 1307:
+            return this.i;
+        case 1308:
+            return this.i;
+        case 1309:
+            return this.i;
+        case 1310:
+            return this.i;
+        case 1311:
+            return this.i;
+        case 1312:
+            return this.i;
+        case 1313:
+            return this.i;
+        case 1314:
+            return this.i;
+        case 1315:
+            return this.i;
+        case 1316:
+            return this.i;
+        case 1317:
+            return this.i;
+        case 1318:
+            return this.i;
+        case 1319:
+            return this.i;
+        case 1320:
+            return this.i;
+        case 1321:
+            return this.i;
+        case 1322:
+            return this.i;
+        case 1323:
+            return this.i;
+        case 1324:
+            return this.i;
+        case 1325:
+            return this.i;
+        case 1326:
+            return this.i;
+        case 1327:
+            return this.i;
+        case 1328:
+            return this.i;
+        case 1329:
+            return this.i;
+        case 1330:
+            return this.i;
+        case 1331:
+            return this.i;
+        case 1332:
+            return this.i;
+        case 1333:
+            return this.i;
+        case 1334:
+            return this.i;
+        case 1335:
+            return this.i;
+        case 1336:
+            return this.i;
+        case 1337:
+            return this.i;
+        case 1338:
+            return this.i;
+        case 1339:
+            return this.i;
+        case 1340:
+            return this.i;
+        case 1341:
+            return this.i;
+        case 1342:
+            return this.i;
+        case 1343:
+            return this.i;
+        case 1344:
+            return this.i;
+        case 1345:
+            return this.i;
+        case 1346:
+            return this.i;
+        case 1347:
+            return this.i;
+        case 1348:
+            return this.i;
+        case 1349:
+            return this.i;
+        case 1350:
+            return this.i;
+        case 1351:
+            return this.i;
+        case 1352:
+            return this.i;
+        case 1353:
+            return this.i;
+        case 1354:
+            return this.i;
+        case 1355:
+            return this.i;
+        case 1356:
+            return this.i;
+        case 1357:
+            return this.i;
+        case 1358:
+            return this.i;
+        case 1359:
+            return this.i;
+        case 1360:
+            return this.i;
+        case 1361:
+            return this.i;
+        case 1362:
+            return this.i;
+        case 1363:
+            return this.i;
+        case 1364:
+            return this.i;
+        case 1365:
+            return this.i;
+        case 1366:
+            return this.i;
+        case 1367:
+            return this.i;
+        case 1368:
+            return this.i;
+        case 1369:
+            return this.i;
+        case 1370:
+            return this.i;
+        case 1371:
+            return this.i;
+        case 1372:
+            return this.i;
+        case 1373:
+            return this.i;
+        case 1374:
+            return this.i;
+        case 1375:
+            return this.i;
+        case 1376:
+            return this.i;
+        case 1377:
+            return this.i;
+        case 1378:
+            return this.i;
+        case 1379:
+            return this.i;
+        case 1380:
+            return this.i;
+        case 1381:
+            return this.i;
+        case 1382:
+            return this.i;
+        case 1383:
+            return this.i;
+        case 1384:
+            return this.i;
+        case 1385:
+            return this.i;
+        case 1386:
+            return this.i;
+        case 1387:
+            return this.i;
+        case 1388:
+            return this.i;
+        case 1389:
+            return this.i;
+        case 1390:
+            return this.i;
+        case 1391:
+            return this.i;
+        case 1392:
+            return this.i;
+        case 1393:
+            return this.i;
+        case 1394:
+            return this.i;
+        case 1395:
+            return this.i;
+        case 1396:
+            return this.i;
+        case 1397:
+            return this.i;
+        case 1398:
+            return this.i;
+        case 1399:
+            return this.i;
+        case 1400:
+            return this.i;
+        case 1401:
+            return this.i;
+        case 1402:
+            return this.i;
+        case 1403:
+            return this.i;
+        case 1404:
+            return this.i;
+        case 1405:
+            return this.i;
+        case 1406:
+            return this.i;
+        case 1407:
+            return this.i;
+        case 1408:
+            return this.i;
+        case 1409:
+            return this.i;
+        case 1410:
+            return this.i;
+        case 1411:
+            return this.i;
+        case 1412:
+            return this.i;
+        case 1413:
+            return this.i;
+        case 1414:
+            return this.i;
+        case 1415:
+            return this.i;
+        case 1416:
+            return this.i;
+        case 1417:
+            return this.i;
+        case 1418:
+            return this.i;
+        case 1419:
+            return this.i;
+        case 1420:
+            return this.i;
+        case 1421:
+            return this.i;
+        case 1422:
+            return this.i;
+        case 1423:
+            return this.i;
+        case 1424:
+            return this.i;
+        case 1425:
+            return this.i;
+        case 1426:
+            return this.i;
+        case 1427:
+            return this.i;
+        case 1428:
+            return this.i;
+        case 1429:
+            return this.i;
+        case 1430:
+            return this.i;
+        case 1431:
+            return this.i;
+        case 1432:
+            return this.i;
+        case 1433:
+            return this.i;
+        case 1434:
+            return this.i;
+        case 1435:
+            return this.i;
+        case 1436:
+            return this.i;
+        case 1437:
+            return this.i;
+        case 1438:
+            return this.i;
+        case 1439:
+            return this.i;
+        case 1440:
+            return this.i;
+        case 1441:
+            return this.i;
+        case 1442:
+            return this.i;
+        case 1443:
+            return this.i;
+        case 1444:
+            return this.i;
+        case 1445:
+            return this.i;
+        case 1446:
+            return this.i;
+        case 1447:
+            return this.i;
+        case 1448:
+            return this.i;
+        case 1449:
+            return this.i;
+        case 1450:
+            return this.i;
+        case 1451:
+            return this.i;
+        case 1452:
+            return this.i;
+        case 1453:
+            return this.i;
+        case 1454:
+            return this.i;
+        case 1455:
+            return this.i;
+        case 1456:
+            return this.i;
+        case 1457:
+            return this.i;
+        case 1458:
+            return this.i;
+        case 1459:
+            return this.i;
+        case 1460:
+            return this.i;
+        case 1461:
+            return this.i;
+        case 1462:
+            return this.i;
+        case 1463:
+            return this.i;
+        case 1464:
+            return this.i;
+        case 1465:
+            return this.i;
+        case 1466:
+            return this.i;
+        case 1467:
+            return this.i;
+        case 1468:
+            return this.i;
+        case 1469:
+            return this.i;
+        case 1470:
+            return this.i;
+        case 1471:
+            return this.i;
+        case 1472:
+            return this.i;
+        case 1473:
+            return this.i;
+        case 1474:
+            return this.i;
+        case 1475:
+            return this.i;
+        case 1476:
+            return this.i;
+        case 1477:
+            return this.i;
+        case 1478:
+            return this.i;
+        case 1479:
+            return this.i;
+        case 1480:
+            return this.i;
+        case 1481:
+            return this.i;
+        case 1482:
+            return this.i;
+        case 1483:
+            return this.i;
+        case 1484:
+            return this.i;
+        case 1485:
+            return this.i;
+        case 1486:
+            return this.i;
+        case 1487:
+            return this.i;
+        case 1488:
+            return this.i;
+        case 1489:
+            return this.i;
+        case 1490:
+            return this.i;
+        case 1491:
+            return this.i;
+        case 1492:
+            return this.i;
+        case 1493:
+            return this.i;
+        case 1494:
+            return this.i;
+        case 1495:
+            return this.i;
+        case 1496:
+            return this.i;
+        case 1497:
+            return this.i;
+        case 1498:
+            return this.i;
+        case 1499:
+            return this.i;
+        case 1500:
+            return this.i;
+        case 1501:
+            return this.i;
+        case 1502:
+            return this.i;
+        case 1503:
+            return this.i;
+        case 1504:
+            return this.i;
+        case 1505:
+            return this.i;
+        case 1506:
+            return this.i;
+        case 1507:
+            return this.i;
+        case 1508:
+            return this.i;
+        case 1509:
+            return this.i;
+        case 1510:
+            return this.i;
+        case 1511:
+            return this.i;
+        case 1512:
+            return this.i;
+        case 1513:
+            return this.i;
+        case 1514:
+            return this.i;
+        case 1515:
+            return this.i;
+        case 1516:
+            return this.i;
+        case 1517:
+            return this.i;
+        case 1518:
+            return this.i;
+        case 1519:
+            return this.i;
+        case 1520:
+            return this.i;
+        case 1521:
+            return this.i;
+        case 1522:
+            return this.i;
+        case 1523:
+            return this.i;
+        case 1524:
+            return this.i;
+        case 1525:
+            return this.i;
+        case 1526:
+            return this.i;
+        case 1527:
+            return this.i;
+        case 1528:
+            return this.i;
+        case 1529:
+            return this.i;
+        case 1530:
+            return this.i;
+        case 1531:
+            return this.i;
+        case 1532:
+            return this.i;
+        case 1533:
+            return this.i;
+        case 1534:
+            return this.i;
+        case 1535:
+            return this.i;
+        case 1536:
+            return this.i;
+        case 1537:
+            return this.i;
+        case 1538:
+            return this.i;
+        case 1539:
+            return this.i;
+        case 1540:
+            return this.i;
+        case 1541:
+            return this.i;
+        case 1542:
+            return this.i;
+        case 1543:
+            return this.i;
+        case 1544:
+            return this.i;
+        case 1545:
+            return this.i;
+        case 1546:
+            return this.i;
+        case 1547:
+            return this.i;
+        case 1548:
+            return this.i;
+        case 1549:
+            return this.i;
+        case 1550:
+            return this.i;
+        case 1551:
+            return this.i;
+        case 1552:
+            return this.i;
+        case 1553:
+            return this.i;
+        case 1554:
+            return this.i;
+        case 1555:
+            return this.i;
+        case 1556:
+            return this.i;
+        case 1557:
+            return this.i;
+        case 1558:
+            return this.i;
+        case 1559:
+            return this.i;
+        case 1560:
+            return this.i;
+        case 1561:
+            return this.i;
+        case 1562:
+            return this.i;
+        case 1563:
+            return this.i;
+        case 1564:
+            return this.i;
+        case 1565:
+            return this.i;
+        case 1566:
+            return this.i;
+        case 1567:
+            return this.i;
+        case 1568:
+            return this.i;
+        case 1569:
+            return this.i;
+        case 1570:
+            return this.i;
+        case 1571:
+            return this.i;
+        case 1572:
+            return this.i;
+        case 1573:
+            return this.i;
+        case 1574:
+            return this.i;
+        case 1575:
+            return this.i;
+        case 1576:
+            return this.i;
+        case 1577:
+            return this.i;
+        case 1578:
+            return this.i;
+        case 1579:
+            return this.i;
+        case 1580:
+            return this.i;
+        case 1581:
+            return this.i;
+        case 1582:
+            return this.i;
+        case 1583:
+            return this.i;
+        case 1584:
+            return this.i;
+        case 1585:
+            return this.i;
+        case 1586:
+            return this.i;
+        case 1587:
+            return this.i;
+        case 1588:
+            return this.i;
+        case 1589:
+            return this.i;
+        case 1590:
+            return this.i;
+        case 1591:
+            return this.i;
+        case 1592:
+            return this.i;
+        case 1593:
+            return this.i;
+        case 1594:
+            return this.i;
+        case 1595:
+            return this.i;
+        case 1596:
+            return this.i;
+        case 1597:
+            return this.i;
+        case 1598:
+            return this.i;
+        case 1599:
+            return this.i;
+        case 1600:
+            return this.i;
+        case 1601:
+            return this.i;
+        case 1602:
+            return this.i;
+        case 1603:
+            return this.i;
+        case 1604:
+            return this.i;
+        case 1605:
+            return this.i;
+        case 1606:
+            return this.i;
+        case 1607:
+            return this.i;
+        case 1608:
+            return this.i;
+        case 1609:
+            return this.i;
+        case 1610:
+            return this.i;
+        case 1611:
+            return this.i;
+        case 1612:
+            return this.i;
+        case 1613:
+            return this.i;
+        case 1614:
+            return this.i;
+        case 1615:
+            return this.i;
+        case 1616:
+            return this.i;
+        case 1617:
+            return this.i;
+        case 1618:
+            return this.i;
+        case 1619:
+            return this.i;
+        case 1620:
+            return this.i;
+        case 1621:
+            return this.i;
+        case 1622:
+            return this.i;
+        case 1623:
+            return this.i;
+        case 1624:
+            return this.i;
+        case 1625:
+            return this.i;
+        case 1626:
+            return this.i;
+        case 1627:
+            return this.i;
+        case 1628:
+            return this.i;
+        case 1629:
+            return this.i;
+        case 1630:
+            return this.i;
+        case 1631:
+            return this.i;
+        case 1632:
+            return this.i;
+        case 1633:
+            return this.i;
+        case 1634:
+            return this.i;
+        case 1635:
+            return this.i;
+        case 1636:
+            return this.i;
+        case 1637:
+            return this.i;
+        case 1638:
+            return this.i;
+        case 1639:
+            return this.i;
+        case 1640:
+            return this.i;
+        case 1641:
+            return this.i;
+        case 1642:
+            return this.i;
+        case 1643:
+            return this.i;
+        case 1644:
+            return this.i;
+        case 1645:
+            return this.i;
+        case 1646:
+            return this.i;
+        case 1647:
+            return this.i;
+        case 1648:
+            return this.i;
+        case 1649:
+            return this.i;
+        case 1650:
+            return this.i;
+        case 1651:
+            return this.i;
+        case 1652:
+            return this.i;
+        case 1653:
+            return this.i;
+        case 1654:
+            return this.i;
+        case 1655:
+            return this.i;
+        case 1656:
+            return this.i;
+        case 1657:
+            return this.i;
+        case 1658:
+            return this.i;
+        case 1659:
+            return this.i;
+        case 1660:
+            return this.i;
+        case 1661:
+            return this.i;
+        case 1662:
+            return this.i;
+        case 1663:
+            return this.i;
+        case 1664:
+            return this.i;
+        case 1665:
+            return this.i;
+        case 1666:
+            return this.i;
+        case 1667:
+            return this.i;
+        case 1668:
+            return this.i;
+        case 1669:
+            return this.i;
+        case 1670:
+            return this.i;
+        case 1671:
+            return this.i;
+        case 1672:
+            return this.i;
+        case 1673:
+            return this.i;
+        case 1674:
+            return this.i;
+        case 1675:
+            return this.i;
+        case 1676:
+            return this.i;
+        case 1677:
+            return this.i;
+        case 1678:
+            return this.i;
+        case 1679:
+            return this.i;
+        case 1680:
+            return this.i;
+        case 1681:
+            return this.i;
+        case 1682:
+            return this.i;
+        case 1683:
+            return this.i;
+        case 1684:
+            return this.i;
+        case 1685:
+            return this.i;
+        case 1686:
+            return this.i;
+        case 1687:
+            return this.i;
+        case 1688:
+            return this.i;
+        case 1689:
+            return this.i;
+        case 1690:
+            return this.i;
+        case 1691:
+            return this.i;
+        case 1692:
+            return this.i;
+        case 1693:
+            return this.i;
+        case 1694:
+            return this.i;
+        case 1695:
+            return this.i;
+        case 1696:
+            return this.i;
+        case 1697:
+            return this.i;
+        case 1698:
+            return this.i;
+        case 1699:
+            return this.i;
+        case 1700:
+            return this.i;
+        case 1701:
+            return this.i;
+        case 1702:
+            return this.i;
+        case 1703:
+            return this.i;
+        case 1704:
+            return this.i;
+        case 1705:
+            return this.i;
+        case 1706:
+            return this.i;
+        case 1707:
+            return this.i;
+        case 1708:
+            return this.i;
+        case 1709:
+            return this.i;
+        case 1710:
+            return this.i;
+        case 1711:
+            return this.i;
+        case 1712:
+            return this.i;
+        case 1713:
+            return this.i;
+        case 1714:
+            return this.i;
+        case 1715:
+            return this.i;
+        case 1716:
+            return this.i;
+        case 1717:
+            return this.i;
+        case 1718:
+            return this.i;
+        case 1719:
+            return this.i;
+        case 1720:
+            return this.i;
+        case 1721:
+            return this.i;
+        case 1722:
+            return this.i;
+        case 1723:
+            return this.i;
+        case 1724:
+            return this.i;
+        case 1725:
+            return this.i;
+        case 1726:
+            return this.i;
+        case 1727:
+            return this.i;
+        case 1728:
+            return this.i;
+        case 1729:
+            return this.i;
+        case 1730:
+            return this.i;
+        case 1731:
+            return this.i;
+        case 1732:
+            return this.i;
+        case 1733:
+            return this.i;
+        case 1734:
+            return this.i;
+        case 1735:
+            return this.i;
+        case 1736:
+            return this.i;
+        case 1737:
+            return this.i;
+        case 1738:
+            return this.i;
+        case 1739:
+            return this.i;
+        case 1740:
+            return this.i;
+        case 1741:
+            return this.i;
+        case 1742:
+            return this.i;
+        case 1743:
+            return this.i;
+        case 1744:
+            return this.i;
+        case 1745:
+            return this.i;
+        case 1746:
+            return this.i;
+        case 1747:
+            return this.i;
+        case 1748:
+            return this.i;
+        case 1749:
+            return this.i;
+        case 1750:
+            return this.i;
+        case 1751:
+            return this.i;
+        case 1752:
+            return this.i;
+        case 1753:
+            return this.i;
+        case 1754:
+            return this.i;
+        case 1755:
+            return this.i;
+        case 1756:
+            return this.i;
+        case 1757:
+            return this.i;
+        case 1758:
+            return this.i;
+        case 1759:
+            return this.i;
+        case 1760:
+            return this.i;
+        case 1761:
+            return this.i;
+        case 1762:
+            return this.i;
+        case 1763:
+            return this.i;
+        case 1764:
+            return this.i;
+        case 1765:
+            return this.i;
+        case 1766:
+            return this.i;
+        case 1767:
+            return this.i;
+        case 1768:
+            return this.i;
+        case 1769:
+            return this.i;
+        case 1770:
+            return this.i;
+        case 1771:
+            return this.i;
+        case 1772:
+            return this.i;
+        case 1773:
+            return this.i;
+        case 1774:
+            return this.i;
+        case 1775:
+            return this.i;
+        case 1776:
+            return this.i;
+        case 1777:
+            return this.i;
+        case 1778:
+            return this.i;
+        case 1779:
+            return this.i;
+        case 1780:
+            return this.i;
+        case 1781:
+            return this.i;
+        case 1782:
+            return this.i;
+        case 1783:
+            return this.i;
+        case 1784:
+            return this.i;
+        case 1785:
+            return this.i;
+        case 1786:
+            return this.i;
+        case 1787:
+            return this.i;
+        case 1788:
+            return this.i;
+        case 1789:
+            return this.i;
+        case 1790:
+            return this.i;
+        case 1791:
+            return this.i;
+        case 1792:
+            return this.i;
+        case 1793:
+            return this.i;
+        case 1794:
+            return this.i;
+        case 1795:
+            return this.i;
+        case 1796:
+            return this.i;
+        case 1797:
+            return this.i;
+        case 1798:
+            return this.i;
+        case 1799:
+            return this.i;
+        case 1800:
+            return this.i;
+        case 1801:
+            return this.i;
+        case 1802:
+            return this.i;
+        case 1803:
+            return this.i;
+        case 1804:
+            return this.i;
+        case 1805:
+            return this.i;
+        case 1806:
+            return this.i;
+        case 1807:
+            return this.i;
+        case 1808:
+            return this.i;
+        case 1809:
+            return this.i;
+        case 1810:
+            return this.i;
+        case 1811:
+            return this.i;
+        case 1812:
+            return this.i;
+        case 1813:
+            return this.i;
+        case 1814:
+            return this.i;
+        case 1815:
+            return this.i;
+        case 1816:
+            return this.i;
+        case 1817:
+            return this.i;
+        case 1818:
+            return this.i;
+        case 1819:
+            return this.i;
+        case 1820:
+            return this.i;
+        case 1821:
+            return this.i;
+        case 1822:
+            return this.i;
+        case 1823:
+            return this.i;
+        case 1824:
+            return this.i;
+        case 1825:
+            return this.i;
+        case 1826:
+            return this.i;
+        case 1827:
+            return this.i;
+        case 1828:
+            return this.i;
+        case 1829:
+            return this.i;
+        case 1830:
+            return this.i;
+        case 1831:
+            return this.i;
+        case 1832:
+            return this.i;
+        case 1833:
+            return this.i;
+        case 1834:
+            return this.i;
+        case 1835:
+            return this.i;
+        case 1836:
+            return this.i;
+        case 1837:
+            return this.i;
+        case 1838:
+            return this.i;
+        case 1839:
+            return this.i;
+        case 1840:
+            return this.i;
+        case 1841:
+            return this.i;
+        case 1842:
+            return this.i;
+        case 1843:
+            return this.i;
+        case 1844:
+            return this.i;
+        case 1845:
+            return this.i;
+        case 1846:
+            return this.i;
+        case 1847:
+            return this.i;
+        case 1848:
+            return this.i;
+        case 1849:
+            return this.i;
+        case 1850:
+            return this.i;
+        case 1851:
+            return this.i;
+        case 1852:
+            return this.i;
+        case 1853:
+            return this.i;
+        case 1854:
+            return this.i;
+        case 1855:
+            return this.i;
+        case 1856:
+            return this.i;
+        case 1857:
+            return this.i;
+        case 1858:
+            return this.i;
+        case 1859:
+            return this.i;
+        case 1860:
+            return this.i;
+        case 1861:
+            return this.i;
+        case 1862:
+            return this.i;
+        case 1863:
+            return this.i;
+        case 1864:
+            return this.i;
+        case 1865:
+            return this.i;
+        case 1866:
+            return this.i;
+        case 1867:
+            return this.i;
+        case 1868:
+            return this.i;
+        case 1869:
+            return this.i;
+        case 1870:
+            return this.i;
+        case 1871:
+            return this.i;
+        case 1872:
+            return this.i;
+        case 1873:
+            return this.i;
+        case 1874:
+            return this.i;
+        case 1875:
+            return this.i;
+        case 1876:
+            return this.i;
+        case 1877:
+            return this.i;
+        case 1878:
+            return this.i;
+        case 1879:
+            return this.i;
+        case 1880:
+            return this.i;
+        case 1881:
+            return this.i;
+        case 1882:
+            return this.i;
+        case 1883:
+            return this.i;
+        case 1884:
+            return this.i;
+        case 1885:
+            return this.i;
+        case 1886:
+            return this.i;
+        case 1887:
+            return this.i;
+        case 1888:
+            return this.i;
+        case 1889:
+            return this.i;
+        case 1890:
+            return this.i;
+        case 1891:
+            return this.i;
+        case 1892:
+            return this.i;
+        case 1893:
+            return this.i;
+        case 1894:
+            return this.i;
+        case 1895:
+            return this.i;
+        case 1896:
+            return this.i;
+        case 1897:
+            return this.i;
+        case 1898:
+            return this.i;
+        case 1899:
+            return this.i;
+        case 1900:
+            return this.i;
+        case 1901:
+            return this.i;
+        case 1902:
+            return this.i;
+        case 1903:
+            return this.i;
+        case 1904:
+            return this.i;
+        case 1905:
+            return this.i;
+        case 1906:
+            return this.i;
+        case 1907:
+            return this.i;
+        case 1908:
+            return this.i;
+        case 1909:
+            return this.i;
+        case 1910:
+            return this.i;
+        case 1911:
+            return this.i;
+        case 1912:
+            return this.i;
+        case 1913:
+            return this.i;
+        case 1914:
+            return this.i;
+        case 1915:
+            return this.i;
+        case 1916:
+            return this.i;
+        case 1917:
+            return this.i;
+        case 1918:
+            return this.i;
+        case 1919:
+            return this.i;
+        case 1920:
+            return this.i;
+        case 1921:
+            return this.i;
+        case 1922:
+            return this.i;
+        case 1923:
+            return this.i;
+        case 1924:
+            return this.i;
+        case 1925:
+            return this.i;
+        case 1926:
+            return this.i;
+        case 1927:
+            return this.i;
+        case 1928:
+            return this.i;
+        case 1929:
+            return this.i;
+        case 1930:
+            return this.i;
+        case 1931:
+            return this.i;
+        case 1932:
+            return this.i;
+        case 1933:
+            return this.i;
+        case 1934:
+            return this.i;
+        case 1935:
+            return this.i;
+        case 1936:
+            return this.i;
+        case 1937:
+            return this.i;
+        case 1938:
+            return this.i;
+        case 1939:
+            return this.i;
+        case 1940:
+            return this.i;
+        case 1941:
+            return this.i;
+        case 1942:
+            return this.i;
+        case 1943:
+            return this.i;
+        case 1944:
+            return this.i;
+        case 1945:
+            return this.i;
+        case 1946:
+            return this.i;
+        case 1947:
+            return this.i;
+        case 1948:
+            return this.i;
+        case 1949:
+            return this.i;
+        case 1950:
+            return this.i;
+        case 1951:
+            return this.i;
+        case 1952:
+            return this.i;
+        case 1953:
+            return this.i;
+        case 1954:
+            return this.i;
+        case 1955:
+            return this.i;
+        case 1956:
+            return this.i;
+        case 1957:
+            return this.i;
+        case 1958:
+            return this.i;
+        case 1959:
+            return this.i;
+        case 1960:
+            return this.i;
+        case 1961:
+            return this.i;
+        case 1962:
+            return this.i;
+        case 1963:
+            return this.i;
+        case 1964:
+            return this.i;
+        case 1965:
+            return this.i;
+        case 1966:
+            return this.i;
+        case 1967:
+            return this.i;
+        case 1968:
+            return this.i;
+        case 1969:
+            return this.i;
+        case 1970:
+            return this.i;
+        case 1971:
+            return this.i;
+        case 1972:
+            return this.i;
+        case 1973:
+            return this.i;
+        case 1974:
+            return this.i;
+        case 1975:
+            return this.i;
+        case 1976:
+            return this.i;
+        case 1977:
+            return this.i;
+        case 1978:
+            return this.i;
+        case 1979:
+            return this.i;
+        case 1980:
+            return this.i;
+        case 1981:
+            return this.i;
+        case 1982:
+            return this.i;
+        case 1983:
+            return this.i;
+        case 1984:
+            return this.i;
+        case 1985:
+            return this.i;
+        case 1986:
+            return this.i;
+        case 1987:
+            return this.i;
+        case 1988:
+            return this.i;
+        case 1989:
+            return this.i;
+        case 1990:
+            return this.i;
+        case 1991:
+            return this.i;
+        case 1992:
+            return this.i;
+        case 1993:
+            return this.i;
+        case 1994:
+            return this.i;
+        case 1995:
+            return this.i;
+        case 1996:
+            return this.i;
+        case 1997:
+            return this.i;
+        case 1998:
+            return this.i;
+        case 1999:
+            return this.i;
+        case 2000:
+            return this.i;
+        case 2001:
+            return this.i;
+        case 2002:
+            return this.i;
+        case 2003:
+            return this.i;
+        case 2004:
+            return this.i;
+        case 2005:
+            return this.i;
+        case 2006:
+            return this.i;
+        case 2007:
+            return this.i;
+        case 2008:
+            return this.i;
+        case 2009:
+            return this.i;
+        case 2010:
+            return this.i;
+        case 2011:
+            return this.i;
+        case 2012:
+            return this.i;
+        case 2013:
+            return this.i;
+        case 2014:
+            return this.i;
+        case 2015:
+            return this.i;
+        case 2016:
+            return this.i;
+        case 2017:
+            return this.i;
+        case 2018:
+            return this.i;
+        case 2019:
+            return this.i;
+        case 2020:
+            return this.i;
+        case 2021:
+            return this.i;
+        case 2022:
+            return this.i;
+        case 2023:
+            return this.i;
+        case 2024:
+            return this.i;
+        case 2025:
+            return this.i;
+        case 2026:
+            return this.i;
+        case 2027:
+            return this.i;
+        case 2028:
+            return this.i;
+        case 2029:
+            return this.i;
+        case 2030:
+            return this.i;
+        case 2031:
+            return this.i;
+        case 2032:
+            return this.i;
+        case 2033:
+            return this.i;
+        case 2034:
+            return this.i;
+        case 2035:
+            return this.i;
+        case 2036:
+            return this.i;
+        case 2037:
+            return this.i;
+        case 2038:
+            return this.i;
+        case 2039:
+            return this.i;
+        case 2040:
+            return this.i;
+        case 2041:
+            return this.i;
+        case 2042:
+            return this.i;
+        case 2043:
+            return this.i;
+        case 2044:
+            return this.i;
+        case 2045:
+            return this.i;
+        case 2046:
+            return this.i;
+    }
+}
+
+// Test if this is working in split array literal
+function hugeArrayLiteral() {
+    return [
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i,
+        this.i
+    ][30];
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8020356.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,2 @@
+20
+10
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8021122.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8021122: Not all callables are handled for toString and other function valued properties
+ *
+ * @test
+ * @run
+ */
+
+var a = {}
+var obj = new java.util.HashMap();
+Object.bindProperties(a, obj);
+try {
+    print(a);
+} catch (e) {
+    print(e);
+}
+
+var a = {}
+var global = loadWithNewGlobal({ name:"xx", script: "this" });
+var obj = global.eval("({ toString: function() { return 'hello'; } })");
+Object.bindProperties(a, obj);
+try {
+    print(a);
+} catch (e) {
+    print(e);
+}
+
+function runLambdaTests() {
+    var r = new java.lang.Runnable() {
+        run: function() { print("I am runnable"); }
+    };
+
+    // call any @FunctionalInterface object as though it is a function
+    r();
+
+    var twice = new java.util.function.Function() {
+        apply: function(x) 2*x
+    };
+
+    print(twice(34));
+
+    var sum = new java.util.function.BiFunction() {
+        apply: function(x, y) x + y
+    };
+
+    print(sum(32, 12))
+
+    // make toString to be a @FunctionalInterface object
+    var a = {};
+    a.toString = new java.util.function.Supplier() {
+        get: function() { return "MyString"; }
+    };
+
+    try {
+        print(a);
+    } catch (e) {
+        print(e);
+    }
+}
+
+try {
+    // check for java.util.function.Function class
+    Java.type("java.util.function.Function");
+    runLambdaTests();
+} catch (e) {
+    // fake output to match .EXPECTED values
+    print("I am runnable");
+    print("68");
+    print("44");
+    print("MyString");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8021122.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,6 @@
+{}
+hello
+I am runnable
+68
+44
+MyString
--- a/nashorn/test/script/basic/NASHORN-473.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/basic/NASHORN-473.js	Tue Aug 06 16:54:56 2013 -0700
@@ -28,7 +28,7 @@
  * @run
  */
 
-var boolArr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 2);
+var boolArr = new (Java.type("boolean[]"))(2);
 boolArr[0] = true;
 boolArr[1] = false;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/NASHORN-592-dual.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * NASHORN-592-dual: test all combos of field types and getters and setters
+ * This time use dual field representation
+ *
+ * @test
+ * @option -Dnashorn.fields.dual=true
+ * @fork
+ * @run/ignore-std-error
+ */
+
+load(__DIR__ + 'NASHORN-592.js');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/NASHORN-592-dual.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,44 @@
+0
+0
+NaN
+undefinedhej!
+17
+8
+34
+17hej!
+17
+8
+34.9422
+17.4711hej!
+0
+0
+NaN
+Fame and fortune Salamander Yahoo!hej!
+24
+11111
+23.23
+23
+23
+Have some pie!
+4711.17
+17172
+23
+23.23
+23
+23
+Have some pie!
+4711.17
+23
+111
+4711.16
+I like cake!
+0
+NaN
+0
+I like cake!
+17
+17.4711
+salamander
+4711.17
+axolotl
+lizard
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/classloader.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Try to extend ClassLoader.
+ *
+ * @test
+ * @security
+ */
+
+try {
+    var l = new (Java.extend(java.lang.ClassLoader))({});
+    fail("should have thrown SecurityException");
+} catch (e) {
+    if (e instanceof java.lang.SecurityException) {
+        print(e);
+    } else {
+        fail("expected SecurityException, got " + e);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/classloader.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,1 @@
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createClassLoader")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/compile-octane-splitter.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @option -Dnashorn.compiler.splitter.threshold=1000
+ * @fork
+ * @runif external.octane
+ */ 
+
+compile_only = true;
+load(__DIR__ + 'run-octane.js');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/compile-octane-splitter.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,13 @@
+Compiled OK: box2d
+Compiled OK: code-load
+Compiled OK: crypto
+Compiled OK: deltablue
+Compiled OK: earley-boyer
+Compiled OK: gbemu
+Compiled OK: mandreel
+Compiled OK: navier-stokes
+Compiled OK: pdfjs
+Compiled OK: raytrace
+Compiled OK: regexp
+Compiled OK: richards
+Compiled OK: splay
--- a/nashorn/test/script/basic/javaarray.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/basic/javaarray.js	Tue Aug 06 16:54:56 2013 -0700
@@ -30,7 +30,7 @@
 
 (function() {
     var nargs = arguments.length;
-    var args = java.lang.reflect.Array.newInstance(java.lang.Object.class, nargs);
+    var args = new (Java.type("java.lang.Object[]"))(nargs);
     print(args.length);
     for (var i = 0; i < nargs; i++) {
         var arg = arguments[i];
@@ -41,7 +41,7 @@
 
 var z; // undefined
 
-var intArray = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 1);
+var intArray = new (Java.type("int[]"))(1);
 intArray[0] = 10;
 print(intArray[0]);
 print(intArray.length);
@@ -50,19 +50,19 @@
 intArray[0] = 10.1;
 print(intArray[0]);
 
-var boolArray = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 2);
+var boolArray = new (Java.type("boolean[]"))(2);
 boolArray[0] = true;
 print(boolArray[0]);
 print(boolArray[1]);
 print(boolArray.length);
 
-var charArray = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 1);
+var charArray = new (Java.type("char[]"))(1);
 charArray[0] = 'j';
 print(charArray[0]);
 print(charArray.length);
 
 
-var doubleArray = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 1)
+var doubleArray = new (Java.type("double[]"))(1)
 doubleArray[0]=z
 print(doubleArray[0])
 doubleArray[0]=1
--- a/nashorn/test/script/basic/runsunspider.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/basic/runsunspider.js	Tue Aug 06 16:54:56 2013 -0700
@@ -1,21 +1,21 @@
 /*
  * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.
- * 
+ *
  * This code is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  * version 2 for more details (a copy is included in the LICENSE file that
  * accompanied this code).
- * 
+ *
  * You should have received a copy of the GNU General Public License version
  * 2 along with this work; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- * 
+ *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
@@ -33,7 +33,7 @@
 
 function assertEq(a, b) {
     if (a !== b) {
-	throw "ASSERTION FAILED: " + a + " should be " + b;
+        throw "ASSERTION FAILED: " + a + " should be " + b;
     }
 }
 
@@ -44,19 +44,19 @@
 function runbench(name) {
     var filename = name.split("/").pop();
     if (verbose_run) {
-	print("Running " + filename);
+        print("Running " + filename);
     }
 
     var start = new Date;
     for (var i = 0; i < iterations__; i++) {
-	load(name);    
+        load(name);
     }
     var stop = new Date - start;
     total_time += stop;
-    
+
     if (verbose_run) {
-	print(filename + " done in " + stop + " ms"); 
-    } 
+        print(filename + " done in " + stop + " ms");
+    }
     runs++;
 }
 
@@ -73,27 +73,23 @@
 
 function runsuite(tests) {
     var changed = false;
-    
+
     var oldRandom = Math.random;
     Math.random = pseudorandom;
-    
+
     try {
-	for (var n = 0; n < tests.length; n++) {
-	    runbench(tests[n].name);
-	    if (typeof tests[n].actual !== 'undefined') {
-		assertEq(tests[n].actual(), tests[n].expected());
-	    }
-	    changed = true;
-	}
-    } catch (e) {
-	print("error: " + e.printStackTrace());
-	if (e.toString().indexOf(tests) == 1) {
-	    throw e;
-	}
-	// no scripting or something, silently fail
+        for (var n = 0; n < tests.length; n++) {
+            path = dir + '../external/sunspider/tests/sunspider-1.0/' + tests[n].name
+            runbench(path);
+            if (typeof tests[n].actual !== 'undefined') {
+                assertEq(tests[n].actual(), tests[n].expected());
+            }
+            changed = true;
+        }
+        // no scripting or something, silently fail
     } finally {
-	Math.random = oldRandom;
     }
+    Math.random = oldRandom;
 
     return changed;
 }
@@ -103,211 +99,211 @@
     var h = 0;
     var off = 0;
     for (var i = 0; i < s.length; i++) {
-	h = 31 * h + s.charCodeAt(off++);
-	h &= 0x7fffffff;
+        h = 31 * h + s.charCodeAt(off++);
+        h &= 0x7fffffff;
     }
     return h ^ s.length;
 }
 
 var tests = [
     { name: 'string-base64.js',
-      actual: function() {	  
-	  return hash(str);
+      actual: function() {
+          return hash(str);
       },
       expected: function() {
-	  return 1544571068;
+          return 1544571068;
       }
-    },    
+    },
     { name: 'string-validate-input.js',
-      actual: function() {	  
-	  return hash(endResult);
+      actual: function() {
+          return hash(endResult);
       },
       expected: function() {
-	  return 2016572373;
+          return 2016572373;
       }
-    },    
+    },
     { name: 'date-format-xparb.js',
-      actual: function() {	  
-	  return shortFormat + longFormat;
+      actual: function() {
+          return shortFormat + longFormat;
       },
       expected: function() {
-	  return "2017-09-05Tuesday, September 05, 2017 8:43:48 AM";
+          return "2017-09-05Tuesday, September 05, 2017 8:43:48 AM";
       }
-    },    
+    },
     { name: '3d-morph.js',
       actual: function() {
-	  var acceptableDelta = 4e-15;
-	  return (testOutput - 6.394884621840902e-14) < acceptableDelta;
+          var acceptableDelta = 4e-15;
+          return (testOutput - 6.394884621840902e-14) < acceptableDelta;
       },
       expected: function() {
-	  return true;
+          return true;
       }
-    },    
+    },
     { name: 'crypto-aes.js',
       actual: function() {
-	  return plainText;
+          return plainText;
       },
       expected: function() {
-	  return decryptedText;
+          return decryptedText;
       }
-    },    
+    },
     { name: 'crypto-md5.js',
       actual: function() {
-	  return md5Output;
+          return md5Output;
       },
       expected: function() {
-	  return "a831e91e0f70eddcb70dc61c6f82f6cd";
+          return "a831e91e0f70eddcb70dc61c6f82f6cd";
       }
-    },    
+    },
     { name: 'crypto-sha1.js',
       actual: function() {
-	  return sha1Output;
+          return sha1Output;
       },
       expected: function() {
-	  return "2524d264def74cce2498bf112bedf00e6c0b796d";
+          return "2524d264def74cce2498bf112bedf00e6c0b796d";
       }
-    },    
-    { name: 'bitops-bitwise-and.js', 
+    },
+    { name: 'bitops-bitwise-and.js',
       actual: function() {
-	  return result;      
+          return result;
       },
       expected: function() {
-	  return 0;
+          return 0;
       }
-    },    
-    { name: 'bitops-bits-in-byte.js', 
+    },
+    { name: 'bitops-bits-in-byte.js',
       actual: function() {
-	  return result;      
+          return result;
       },
       expected: function() {
-	  return 358400;
+          return 358400;
       }
-    },    
-    { name: 'bitops-nsieve-bits.js', 
+    },
+    { name: 'bitops-nsieve-bits.js',
       actual: function() {
-	  var ret = 0;
-	  for (var i = 0; i < result.length; ++i) {
-	      ret += result[i];
-	  }
-	  ret += result.length;
-	  return ret;	    
+          var ret = 0;
+          for (var i = 0; i < result.length; ++i) {
+              ret += result[i];
+          }
+          ret += result.length;
+          return ret;
       },
       expected: function() {
-	  return -1286749539853;
+          return -1286749539853;
       }
-    },    
-    { name: 'bitops-3bit-bits-in-byte.js', 
+    },
+    { name: 'bitops-3bit-bits-in-byte.js',
       actual: function() {
-	  return sum;      
+          return sum;
       },
       expected: function() {
-	  return 512000;
+          return 512000;
       }
-    },    
-    { name: 'access-nbody.js', 
+    },
+    { name: 'access-nbody.js',
       actual: function() {
-	  return ret;  
+          return ret;
       },
       expected: function() {
-	    return -0.16906933525822856;
+            return -1.3524862408537381;
       }
-    },    
-    { name: 'access-binary-trees.js', 
+    },
+    { name: 'access-binary-trees.js',
       actual: function() {
-	  return ret;  
+          return ret;
       },
       expected: function() {
-	  return -1;
+          return -4;
       }
-    },    
+    },
     { name: 'access-fannkuch.js',
       actual: function() {
-	  return ret;  
+          return ret;
       },
       expected: function() {
-	  return 22;
+          return 22;
       }
     },
     { name: 'math-spectral-norm.js',
-      actual: function() {	    
-	  var ret = '';
-	  for (var i = 6; i <= 48; i *= 2) {
-	      ret += spectralnorm(i) + ',';
-	  }
-	  return ret;
+      actual: function() {
+          var ret = '';
+          for (var i = 6; i <= 48; i *= 2) {
+              ret += spectralnorm(i) + ',';
+          }
+          return ret;
       },
       expected: function() {
-	  return "1.2657786149754053,1.2727355112619148,1.273989979775574,1.274190125290389,";
+          return "1.2657786149754053,1.2727355112619148,1.273989979775574,1.274190125290389,";
       }
-    },    
+    },
     { name: '3d-raytrace.js',
       actual: function() {
-	  return hash(testOutput);
+          return hash(testOutput);
       },
       expected: function() {
-	  return 230692593;
+          return 230692593;
       }
-    },    
+    },
     { name: 'regexp-dna.js',
       actual: function() {
-	  return dnaOutputString;
+          return dnaOutputString;
       },
       expected: function() {
-	  return "undefinedagggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n";
+          return "agggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n";
       }
-    },    
+    },
     { name: 'math-cordic.js',
       actual: function() {
-	  return total;
+          return total;
       },
       expected: function() {
-	  return 10362.570468755888;
+          return 10362.570468755888;
       }
     },
     { name: 'controlflow-recursive.js',
       actual: function() {
-	  var ret = 0;
-	  for (var i = 3; i <= 5; i++) {
-	      ret += ack(3,i);
-	      ret += fib(17.0+i);
-	      ret += tak(3*i+3,2*i+2,i+1);
-	  }
-	  return ret;
+          var ret = 0;
+          for (var i = 3; i <= 5; i++) {
+              ret += ack(3,i);
+              ret += fib(17.0+i);
+              ret += tak(3*i+3,2*i+2,i+1);
+          }
+          return ret;
       },
       expected: function() {
-	  return 57775;
+          return 57775;
       }
-    },    
+    },
     { name: 'date-format-tofte.js',
       actual: function() {
-	  return shortFormat + longFormat;
+          return shortFormat + longFormat;
       },
       expected: function() {
-	  return "2008-05-01Thursday, May 01, 2008 6:31:22 PM";
+          return "2008-05-01Thursday, May 01, 2008 6:31:22 PM";
       }
     },
     { name: 'string-tagcloud.js',
       actual: function() {
-	  // The result string embeds floating-point numbers, which can vary a bit on different platforms,
-	  // so we truncate them a bit before comparing.
-	  var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' })
-	  return tagcloud_norm.length;
+          // The result string embeds floating-point numbers, which can vary a bit on different platforms,
+          // so we truncate them a bit before comparing.
+          var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' })
+          return tagcloud_norm.length;
       },
       expected: function() {
-	  return 295906;
+          return 295906;
       }
-    },    
+    },
     { name: 'string-unpack-code.js',
       actual: function() {
-	  return decompressedMochiKit.length == 106415 &&
-	      decompressedMochiKit[2000] == '5' &&
-	      decompressedMochiKit[12000] == '_' &&
-	      decompressedMochiKit[82556] == '>';
+          return decompressedMochiKit.length == 106415 &&
+              decompressedMochiKit[2000] == '5' &&
+              decompressedMochiKit[12000] == '_' &&
+              decompressedMochiKit[82556] == '>';
       },
       expected: function() {
-	  return true;
+          return true;
       }
-    },    
+    },
     //TODO no easy way to sanity check result
     { name: 'string-fasta.js' },
     //TODO no easy way to sanity check result
@@ -315,17 +311,13 @@
     //TODO no easy way to sanity check result
     { name: 'access-nsieve.js' },
     //TODO no easy way to sanity check result
-    { name: '3d-cube.js' },    
+    { name: '3d-cube.js' },
 ];
 
 // handle the case this script may be run by a JS engine that doesn't
 // support __DIR__ global variable.
 var dir = (typeof(__DIR__) == 'undefined') ? "test/script/basic/" : __DIR__;
 
-for (i in tests) {
-    tests[i].name = dir + '../external/sunspider/tests/sunspider-1.0/' + tests[i].name;
-}
-
 var verbose_run = false;
 
 var args = [];
@@ -333,12 +325,12 @@
     args = $ARGS;
 } else if (typeof arguments !== 'undefined' && arguments.length != 0) {
     args = arguments;
-}  
+}
 
 for (i in args) {
     if (args[i] === '--verbose') {
-	verbose_run = true;
-	break;
+        verbose_run = true;
+        break;
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/splitter.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Test various scripts with low splitter threshold
+ *
+ * @test
+ * @option -Dnashorn.compiler.splitter.threshold=200
+ * @run
+ * @fork
+ */
+
+load(__DIR__ + 'prototype.js');
+load(__DIR__ + 'yui.js');
+load(__DIR__ + 'NASHORN-689.js');
+load(__DIR__ + 'NASHORN-58.js');
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/splitter.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,76 @@
+parsed and compiled ok prototype.js
+parsed and compiled ok yui-min.js
+parsed and compiled ok yui.js
+a=10
+a=9
+a=8
+a=7
+a=6
+a=5
+a=4
+a=3
+a=2
+a=1
+a=0
+10
+a=0
+a=1
+a=2
+a=3
+a=4
+a=5
+a=6
+a=7
+a=8
+a=9
+a=10
+ok
+a=0
+a=1
+a=2
+a=3
+a=4
+a=5
+a=6
+a=7
+a=8
+a=9
+a=10
+done
+no arg
+x=0
+x=1
+x=2
+x=3
+x=4
+x=5
+x=6
+x=7
+x=8
+x=9
+x=10
+ok
+done
+try
+finally
+3
+try
+finally
+2
+3
+1
+2
+3
+4
+5
+5
+6
+6
+1
+2
+3
+4
+6
+Error: testing
+finally
+SUCCESS
--- a/nashorn/test/script/representations/NASHORN-592a.js	Thu Aug 01 14:59:05 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- * 
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- * 
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- * 
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/**
- * NASHORN-592a: test all combos of field types and getters and setters
- * This time use dual field representation
- *
- * @test
- * @option --dual-fields
- * @run
- */
-
-//fortype undefined
-var a;
-
-print(a & 0xff);
-print(a >>> 1);
-print(a * 2);
-print(a + "hej!");
-
-var b;
-b = 17;   //set undefined->int
-
-print(b & 0xff);
-print(b >>> 1);
-print(b * 2);
-print(b + "hej!");
-
-var c;
-c = 17.4711 //set undefined->double
-
-print(c & 0xff);
-print(c >>> 1);
-print(c * 2);
-print(c + "hej!");
-
-var d; // set undefined->double
-d = "Fame and fortune Salamander Yahoo!";
-
-print(d & 0xff);
-print(d >>> 1);
-print(d * 2);
-print(d + "hej!");
-
-// now we have exhausted all getters and undefined->everything setters.
-
-
-var e = 23; // int to everything setters,
-e = 24;     //int to int
-print(e);
-e = (22222 >>> 1); //int to long;
-print(e);
-e = 23.23;  //int to double
-print(e);
-e = 23;     //double to int - still double
-print(e);
-print(e & 0xff);
-e = "Have some pie!" //double to string
-print(e);
-e = 4711.17;
-print(e); //still an object not a double
-
-
-var f = (23222 >>> 1); // long to everything setters,
-f = 34344 >>> 1;     //long to long
-print(f);
-f = 23; //long to int - still long
-print(f);
-f = 23.23;  //long to double
-print(f);
-f = 23;     //double to int - still double
-print(f);
-print(f & 0xff);
-f = "Have some pie!" //double to string
-print(f);
-f = 4711.17;
-print(f); //still an object not a double
-
-var g = 4811.16;
-g = 23; //still double
-print(g);
-g = (222 >>> 1); //still double
-print(g);
-g = 4711.16; //double->double
-print(g);
-g = "I like cake!";
-print(g);  //object to various
-print(g & 0xff);
-print(g * 2);
-print(g >>> 2);
-print(g);
-
-var h = {x:17, y:17.4711, z:"salamander"};
-print(h.x);
-print(h.y);
-print(h.z);
-h.x = 4711.17;
-h.y = "axolotl";
-h.z = "lizard";
-print(h.x);
-print(h.y);
-print(h.z);
--- a/nashorn/test/script/sandbox/classloader.js.EXPECTED	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/sandbox/classloader.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -1,1 +1,1 @@
-java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "createClassLoader")
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
--- a/nashorn/test/script/sandbox/nashorninternals.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/sandbox/nashorninternals.js	Tue Aug 06 16:54:56 2013 -0700
@@ -44,17 +44,25 @@
 
 // Not exhaustive - but a representative list of classes
 checkClass("jdk.nashorn.internal.codegen.Compiler");
-checkClass("jdk.nashorn.internal.codegen.objects.MapCreator");
 checkClass("jdk.nashorn.internal.codegen.types.Type");
 checkClass("jdk.nashorn.internal.ir.Node");
 checkClass("jdk.nashorn.internal.ir.FunctionNode");
 checkClass("jdk.nashorn.internal.ir.debug.JSONWriter");
 checkClass("jdk.nashorn.internal.ir.visitor.NodeVisitor");
+checkClass("jdk.nashorn.internal.lookup.MethodHandleFactory");
+checkClass("jdk.nashorn.internal.objects.Global");
 checkClass("jdk.nashorn.internal.parser.AbstractParser");
 checkClass("jdk.nashorn.internal.parser.Parser");
 checkClass("jdk.nashorn.internal.parser.JSONParser");
 checkClass("jdk.nashorn.internal.parser.Lexer");
 checkClass("jdk.nashorn.internal.parser.Scanner");
+checkClass("jdk.nashorn.internal.runtime.Context");
+checkClass("jdk.nashorn.internal.runtime.arrays.ArrayData");
+checkClass("jdk.nashorn.internal.runtime.linker.Bootstrap");
+checkClass("jdk.nashorn.internal.runtime.options.Option");
+checkClass("jdk.nashorn.internal.runtime.regexp.RegExp");
+checkClass("jdk.nashorn.internal.scripts.JO");
+checkClass("jdk.nashorn.tools.Shell");
 checkClass("jdk.internal.dynalink.CallSiteDescriptor");
 checkClass("jdk.internal.dynalink.beans.StaticClass");
 checkClass("jdk.internal.dynalink.linker.LinkRequest");
--- a/nashorn/test/script/sandbox/reflection.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/sandbox/reflection.js	Tue Aug 06 16:54:56 2013 -0700
@@ -35,9 +35,8 @@
     }
 }
 
-var cl = java.lang.Class.class;
 try {
-    cl.getDeclaredMethods();
+    var cl = java.lang.Class.class;
 } catch(e) {
     check(e); 
 }
--- a/nashorn/test/script/trusted/JDK-8006529.js	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/script/trusted/JDK-8006529.js	Tue Aug 06 16:54:56 2013 -0700
@@ -39,19 +39,21 @@
  * and FunctionNode because of package-access check and so reflective calls.
  */
 
-var Parser              = Java.type("jdk.nashorn.internal.parser.Parser")
-var Compiler            = Java.type("jdk.nashorn.internal.codegen.Compiler")
-var Context             = Java.type("jdk.nashorn.internal.runtime.Context")
-var ScriptEnvironment   = Java.type("jdk.nashorn.internal.runtime.ScriptEnvironment")
-var Source              = Java.type("jdk.nashorn.internal.runtime.Source")
-var FunctionNode        = Java.type("jdk.nashorn.internal.ir.FunctionNode")
-var Block               = Java.type("jdk.nashorn.internal.ir.Block")
-var VarNode             = Java.type("jdk.nashorn.internal.ir.VarNode")
-var ExpressionStatement = Java.type("jdk.nashorn.internal.ir.ExpressionStatement")
-var UnaryNode           = Java.type("jdk.nashorn.internal.ir.UnaryNode")
-var BinaryNode          = Java.type("jdk.nashorn.internal.ir.BinaryNode")
-var ThrowErrorManager   = Java.type("jdk.nashorn.internal.runtime.Context$ThrowErrorManager")
-var Debug               = Java.type("jdk.nashorn.internal.runtime.Debug")
+var forName = java.lang.Class["forName(String)"];
+var Parser              = forName("jdk.nashorn.internal.parser.Parser").static
+var Compiler            = forName("jdk.nashorn.internal.codegen.Compiler").static
+var Context             = forName("jdk.nashorn.internal.runtime.Context").static
+var ScriptEnvironment   = forName("jdk.nashorn.internal.runtime.ScriptEnvironment").static
+var Source              = forName("jdk.nashorn.internal.runtime.Source").static
+var FunctionNode        = forName("jdk.nashorn.internal.ir.FunctionNode").static
+var Block               = forName("jdk.nashorn.internal.ir.Block").static
+var VarNode             = forName("jdk.nashorn.internal.ir.VarNode").static
+var ExpressionStatement = forName("jdk.nashorn.internal.ir.ExpressionStatement").static
+var UnaryNode           = forName("jdk.nashorn.internal.ir.UnaryNode").static
+var BinaryNode          = forName("jdk.nashorn.internal.ir.BinaryNode").static
+var ThrowErrorManager   = forName("jdk.nashorn.internal.runtime.Context$ThrowErrorManager").static
+var ErrorManager        = forName("jdk.nashorn.internal.runtime.ErrorManager").static
+var Debug               = forName("jdk.nashorn.internal.runtime.Debug").static
 
 var parseMethod = Parser.class.getMethod("parse");
 var compileMethod = Compiler.class.getMethod("compile", FunctionNode.class);
@@ -111,18 +113,22 @@
 var getContextMethod = Context.class.getMethod("getContext")
 var getEnvMethod = Context.class.getMethod("getEnv")
 
+var SourceConstructor = Source.class.getConstructor(java.lang.String.class, java.lang.String.class)
+var ParserConstructor = Parser.class.getConstructor(ScriptEnvironment.class, Source.class, ErrorManager.class)
+var CompilerConstructor = Compiler.class.getConstructor(ScriptEnvironment.class)
+
 // compile(script) -- compiles a script specified as a string with its 
 // source code, returns a jdk.nashorn.internal.ir.FunctionNode object 
 // representing it.
 function compile(source) {
-    var source   = new Source("<no name>", source);
+    var source = SourceConstructor.newInstance("<no name>", source);
 
     var env = getEnvMethod.invoke(getContextMethod.invoke(null))
 
-    var parser   = new Parser(env, source, new ThrowErrorManager());
+    var parser   = ParserConstructor.newInstance(env, source, ThrowErrorManager.class.newInstance());
     var func     = parseMethod.invoke(parser);
 
-    var compiler = new Compiler(env);
+    var compiler = CompilerConstructor.newInstance(env);
 
     return compileMethod.invoke(compiler, func);
 };
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8020809.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8020809: Java adapter should not allow overriding of caller sensitive methods
+ * 
+ * @test
+ * @run
+ */
+
+// This test runs as trusted as we need the
+// "enableContextClassLoaderOverride" runtime permission.
+
+var T = Java.extend(java.lang.Thread, {
+    getContextClassLoader: function() {
+        // Since getContextClassLoader is caller sensitive, this won't
+        // actually act as an override; it will be ignored. If we could
+        // invoke it, it would be an error.
+        throw new Error()
+    }
+})
+
+// Retrieve the context ClassLoader on our Thread adapter, ensure the
+// method was not, in fact, overridden.
+var cl = (new T()).contextClassLoader
+
+print("cl is class loader: "  + (cl instanceof java.lang.ClassLoader))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8020809.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,1 @@
+cl is class loader: true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8021129.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8021129: Test prevention of access to members of restricted classes.
+ * Note that even though the script runs as trusted, we still don't allow
+ * access to non-public portions of restricted classes.
+ * 
+ * @test
+ * @run
+ */
+
+var InternalRunnableSuperclass = Java.type("jdk.nashorn.test.models.InternalRunnableSuperclass");
+var r1 = InternalRunnableSuperclass.makeInternalRunnable();
+r1.run() // Can execute method from an implemented non-restricted interface
+print(r1.toString()) // Can execute public method from a superclass
+
+print(r1.restrictedRun === undefined) // Can't see method from a restricted interface
+print(r1.canNotInvokeThis === undefined) // Can't see any other public methods
+print(r1.invisibleProperty === undefined) // Can't see any other properties
+print(r1.canSeeThisField === undefined) // Can't see fields from superclasses
+print(r1.canNotSeeThisField === undefined) // Can't see its own fields
+
+var r2 = new InternalRunnableSuperclass();
+print(r2.canSeeThisField) // Superclass field works fine on its own
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8021129.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,9 @@
+InternalRunnable.run() executed!
+InternalRunnable.toString() executed!
+
+true
+true
+true
+true
+true
+19
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8021189.js	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8021189: Prevent access to constructors of restricted classes
+ * 
+ * @test
+ * @run
+ */
+var InternalRunnableSuperclass = Java.type("jdk.nashorn.test.models.InternalRunnableSuperclass");
+try {
+    new (InternalRunnableSuperclass.getInternalRunnableType())();
+} catch(e) {
+    print(e)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/trusted/JDK-8021189.js.EXPECTED	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,1 @@
+java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.jdk.nashorn.internal.test.models")
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -72,7 +72,7 @@
         e.eval("var p_boolean_array = o.publicBooleanArray;");
         assertEquals(o.publicBooleanArray[0], e.eval("o.publicBooleanArray[0]"));
         assertTrue(Arrays.equals(o.publicBooleanArray, (boolean[])e.get("p_boolean_array")));
-        e.eval("var t_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+        e.eval("var t_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
                 "t_boolean_arr[0] = true;" +
                 "t_boolean_arr[1] = false;" +
                 "t_boolean_arr[2] = false;" +
@@ -96,7 +96,7 @@
         e.eval("var ps_boolean_array = SharedObject.publicStaticBooleanArray;");
         assertEquals(SharedObject.publicStaticBooleanArray[0], e.eval("SharedObject.publicStaticBooleanArray[0]"));
         assertTrue(Arrays.equals(SharedObject.publicStaticBooleanArray, (boolean[])e.get("ps_boolean_array")));
-        e.eval("var ts_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+        e.eval("var ts_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
                 "ts_boolean_arr[0] = true;" +
                 "ts_boolean_arr[1] = false;" +
                 "ts_boolean_arr[2] = true;" +
@@ -120,7 +120,7 @@
         e.eval("var pf_boolean_array = o.publicFinalBooleanArray;");
         assertEquals(o.publicFinalBooleanArray[0], e.eval("o.publicFinalBooleanArray[0]"));
         assertTrue(Arrays.equals(o.publicFinalBooleanArray, (boolean[])e.get("pf_boolean_array")));
-        e.eval("var tf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+        e.eval("var tf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
                 "tf_boolean_arr[0] = false;" +
                 "tf_boolean_arr[1] = false;" +
                 "tf_boolean_arr[2] = true;" +
@@ -144,7 +144,7 @@
         e.eval("var psf_boolean_array = SharedObject.publicStaticFinalBooleanArray;");
         assertEquals(SharedObject.publicStaticFinalBooleanArray[0], e.eval("SharedObject.publicStaticFinalBooleanArray[0]"));
         assertTrue(Arrays.equals(SharedObject.publicStaticFinalBooleanArray, (boolean[])e.get("psf_boolean_array")));
-        e.eval("var tsf_boolean_arr = java.lang.reflect.Array.newInstance(java.lang.Boolean.TYPE, 3);" +
+        e.eval("var tsf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
                 "tsf_boolean_arr[0] = false;" +
                 "tsf_boolean_arr[1] = true;" +
                 "tsf_boolean_arr[2] = false;" +
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -73,7 +73,7 @@
         e.eval("var p_long_array = o.publicLongArray;");
         assertEquals(o.publicLongArray[0], e.eval("o.publicLongArray[0];"));
         assertArrayEquals(o.publicLongArray, (long[])e.get("p_long_array"));
-        e.eval("var t_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+        e.eval("var t_long_arr = new (Java.type(\"long[]\"))(3);" +
                 "t_long_arr[0] = -189009;" +
                 "t_long_arr[1] = 456;" +
                 "t_long_arr[2] = 600000001;" +
@@ -97,7 +97,7 @@
         e.eval("var ps_long_array = SharedObject.publicStaticLongArray;");
         assertEquals(SharedObject.publicStaticLongArray[0], e.eval("SharedObject.publicStaticLongArray[0];"));
         assertArrayEquals(SharedObject.publicStaticLongArray, (long[])e.get("ps_long_array"));
-        e.eval("var ts_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+        e.eval("var ts_long_arr = new (Java.type(\"long[]\"))(3);" +
                 "ts_long_arr[0] = -189009;" +
                 "ts_long_arr[1] = 456;" +
                 "ts_long_arr[2] = 600000001;" +
@@ -121,7 +121,7 @@
         e.eval("var pf_long_array = o.publicFinalLongArray;");
         assertEquals(o.publicFinalLongArray[0], e.eval("o.publicFinalLongArray[0];"));
         assertArrayEquals(o.publicFinalLongArray, (long[])e.get("pf_long_array"));
-        e.eval("var tf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+        e.eval("var tf_long_arr = new (Java.type(\"long[]\"))(3);" +
                 "tf_long_arr[0] = -189009;" +
                 "tf_long_arr[1] = 456;" +
                 "tf_long_arr[2] = 600000001;" +
@@ -145,7 +145,7 @@
         e.eval("var psf_long_array = SharedObject.publicStaticFinalLongArray;");
         assertEquals(SharedObject.publicStaticFinalLongArray[0], e.eval("SharedObject.publicStaticFinalLongArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalLongArray, (long[])e.get("psf_long_array"));
-        e.eval("var tsf_long_arr = java.lang.reflect.Array.newInstance(java.lang.Long.TYPE, 3);" +
+        e.eval("var tsf_long_arr = new (Java.type(\"long[]\"))(3);" +
                 "tsf_long_arr[0] = -189009;" +
                 "tsf_long_arr[1] = 456;" +
                 "tsf_long_arr[2] = 600000001;" +
@@ -171,7 +171,7 @@
         e.eval("var p_int_array = o.publicIntArray;");
         assertEquals(o.publicIntArray[0], e.eval("o.publicIntArray[0];"));
         assertArrayEquals(o.publicIntArray, (int[])e.get("p_int_array"));
-        e.eval("var t_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+        e.eval("var t_int_arr = new (Java.type(\"int[]\"))(3);" +
                 "t_int_arr[0] = 4;" +
                 "t_int_arr[1] = 5;" +
                 "t_int_arr[2] = 6;" +
@@ -194,7 +194,7 @@
         e.eval("var ps_int_array = SharedObject.publicStaticIntArray;");
         assertEquals(SharedObject.publicStaticIntArray[0], e.eval("SharedObject.publicStaticIntArray[0];"));
         assertArrayEquals(SharedObject.publicStaticIntArray, (int[])e.get("ps_int_array"));
-        e.eval("var ts_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+        e.eval("var ts_int_arr = new (Java.type(\"int[]\"))(3);" +
                 "ts_int_arr[0] = 4;" +
                 "ts_int_arr[1] = 5;" +
                 "ts_int_arr[2] = 6;" +
@@ -218,7 +218,7 @@
         e.eval("var pf_int_array = o.publicFinalIntArray;");
         assertEquals(o.publicFinalIntArray[0], e.eval("o.publicFinalIntArray[0];"));
         assertArrayEquals(o.publicFinalIntArray, (int[])e.get("pf_int_array"));
-        e.eval("var tf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+        e.eval("var tf_int_arr = new (Java.type(\"int[]\"))(3);" +
                 "tf_int_arr[0] = 4;" +
                 "tf_int_arr[1] = 5;" +
                 "tf_int_arr[2] = 6;" +
@@ -241,7 +241,7 @@
         e.eval("var psf_int_array = SharedObject.publicStaticFinalIntArray;");
         assertEquals(SharedObject.publicStaticFinalIntArray[0], e.eval("SharedObject.publicStaticFinalIntArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalIntArray, (int[])e.get("psf_int_array"));
-        e.eval("var tsf_int_arr = java.lang.reflect.Array.newInstance(java.lang.Integer.TYPE, 3);" +
+        e.eval("var tsf_int_arr = new (Java.type(\"int[]\"))(3);" +
                 "tsf_int_arr[0] = 4;" +
                 "tsf_int_arr[1] = 5;" +
                 "tsf_int_arr[2] = 6;" +
@@ -266,7 +266,7 @@
         e.eval("var p_byte_array = o.publicByteArray;");
         assertEquals(o.publicByteArray[0], e.eval("o.publicByteArray[0];"));
         assertArrayEquals(o.publicByteArray, (byte[])e.get("p_byte_array"));
-        e.eval("var t_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+        e.eval("var t_byte_arr = new (Java.type(\"byte[]\"))(3);" +
                 "t_byte_arr[0] = -18;" +
                 "t_byte_arr[1] = 56;" +
                 "t_byte_arr[2] = 60;" +
@@ -289,7 +289,7 @@
         e.eval("var ps_byte_array = SharedObject.publicStaticByteArray;");
         assertEquals(SharedObject.publicStaticByteArray[0], e.eval("SharedObject.publicStaticByteArray[0];"));
         assertArrayEquals(SharedObject.publicStaticByteArray, (byte[])e.get("ps_byte_array"));
-        e.eval("var ts_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+        e.eval("var ts_byte_arr = new (Java.type(\"byte[]\"))(3);" +
                 "ts_byte_arr[0] = -18;" +
                 "ts_byte_arr[1] = 56;" +
                 "ts_byte_arr[2] = 60;" +
@@ -312,7 +312,7 @@
         e.eval("var pf_byte_array = o.publicFinalByteArray;");
         assertEquals(o.publicFinalByteArray[0], e.eval("o.publicFinalByteArray[0];"));
         assertArrayEquals(o.publicFinalByteArray, (byte[])e.get("pf_byte_array"));
-        e.eval("var tf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+        e.eval("var tf_byte_arr = new (Java.type(\"byte[]\"))(3);" +
                 "tf_byte_arr[0] = -18;" +
                 "tf_byte_arr[1] = 56;" +
                 "tf_byte_arr[2] = 60;" +
@@ -335,7 +335,7 @@
         e.eval("var psf_byte_array = SharedObject.publicStaticFinalByteArray;");
         assertEquals(SharedObject.publicStaticFinalByteArray[0], e.eval("SharedObject.publicStaticFinalByteArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalByteArray, (byte[])e.get("psf_byte_array"));
-        e.eval("var tsf_byte_arr = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 3);" +
+        e.eval("var tsf_byte_arr = new (Java.type(\"byte[]\"))(3);" +
                 "tsf_byte_arr[0] = -18;" +
                 "tsf_byte_arr[1] = 56;" +
                 "tsf_byte_arr[2] = 60;" +
@@ -360,7 +360,7 @@
         e.eval("var p_short_array = o.publicShortArray;");
         assertEquals(o.publicShortArray[0], e.eval("o.publicShortArray[0];"));
         assertArrayEquals(o.publicShortArray, (short[])e.get("p_short_array"));
-        e.eval("var t_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+        e.eval("var t_short_arr = new (Java.type(\"short[]\"))(3);" +
                 "t_short_arr[0] = 90;" +
                 "t_short_arr[1] = 5;" +
                 "t_short_arr[2] = -6000;" +
@@ -383,7 +383,7 @@
         e.eval("var ps_short_array = SharedObject.publicStaticShortArray;");
         assertEquals(SharedObject.publicStaticShortArray[0], e.eval("SharedObject.publicStaticShortArray[0];"));
         assertArrayEquals(SharedObject.publicStaticShortArray, (short[])e.get("ps_short_array"));
-        e.eval("var ts_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+        e.eval("var ts_short_arr = new (Java.type(\"short[]\"))(3);" +
                 "ts_short_arr[0] = 90;" +
                 "ts_short_arr[1] = 5;" +
                 "ts_short_arr[2] = -6000;" +
@@ -406,7 +406,7 @@
         e.eval("var pf_short_array = o.publicFinalShortArray;");
         assertEquals(o.publicFinalShortArray[0], e.eval("o.publicFinalShortArray[0];"));
         assertArrayEquals(o.publicFinalShortArray, (short[])e.get("pf_short_array"));
-        e.eval("var tf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+        e.eval("var tf_short_arr = new (Java.type(\"short[]\"))(3);" +
                 "tf_short_arr[0] = 90;" +
                 "tf_short_arr[1] = 5;" +
                 "tf_short_arr[2] = -6000;" +
@@ -429,7 +429,7 @@
         e.eval("var psf_short_array = SharedObject.publicStaticFinalShortArray;");
         assertEquals(SharedObject.publicStaticFinalShortArray[0], e.eval("SharedObject.publicStaticFinalShortArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalShortArray, (short[])e.get("psf_short_array"));
-        e.eval("var tsf_short_arr = java.lang.reflect.Array.newInstance(java.lang.Short.TYPE, 3);" +
+        e.eval("var tsf_short_arr = new (Java.type(\"short[]\"))(3);" +
                 "tsf_short_arr[0] = 90;" +
                 "tsf_short_arr[1] = 5;" +
                 "tsf_short_arr[2] = -6000;" +
@@ -463,7 +463,7 @@
         e.eval("var p_char_array = o.publicCharArray;");
         assertEquals(o.publicCharArray[0], e.eval("o.publicCharArray[0];"));
         assertArrayEquals(o.publicCharArray, (char[])e.get("p_char_array"));
-        e.eval("var t_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+        e.eval("var t_char_arr = new (Java.type(\"char[]\"))(3);" +
                 "t_char_arr[0] = 'F';" +
                 "t_char_arr[1] = 'o';" +
                 "t_char_arr[2] = 'o';" +
@@ -486,7 +486,7 @@
         e.eval("var ps_char_array = SharedObject.publicStaticCharArray;");
         assertEquals(SharedObject.publicStaticCharArray[0], e.eval("SharedObject.publicStaticCharArray[0];"));
         assertArrayEquals(SharedObject.publicStaticCharArray, (char[])e.get("ps_char_array"));
-        e.eval("var ts_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+        e.eval("var ts_char_arr = new (Java.type(\"char[]\"))(3);" +
                 "ts_char_arr[0] = 'G';" +
                 "ts_char_arr[1] = 'o';" +
                 "ts_char_arr[2] = 'o';" +
@@ -509,7 +509,7 @@
         e.eval("var pf_char_array = o.publicFinalCharArray;");
         assertEquals(o.publicFinalCharArray[0], e.eval("o.publicFinalCharArray[0];"));
         assertArrayEquals(o.publicFinalCharArray, (char[])e.get("pf_char_array"));
-        e.eval("var tf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+        e.eval("var tf_char_arr = new (Java.type(\"char[]\"))(3);" +
                 "tf_char_arr[0] = 'F';" +
                 "tf_char_arr[1] = 'o';" +
                 "tf_char_arr[2] = 'o';" +
@@ -532,7 +532,7 @@
         e.eval("var psf_char_array = SharedObject.publicStaticFinalCharArray;");
         assertEquals(SharedObject.publicStaticFinalCharArray[0], e.eval("SharedObject.publicStaticFinalCharArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalCharArray, (char[])e.get("psf_char_array"));
-        e.eval("var tsf_char_arr = java.lang.reflect.Array.newInstance(java.lang.Character.TYPE, 3);" +
+        e.eval("var tsf_char_arr = new (Java.type(\"char[]\"))(3);" +
                 "tsf_char_arr[0] = 'Z';" +
                 "tsf_char_arr[1] = 'o';" +
                 "tsf_char_arr[2] = 'o';" +
@@ -569,7 +569,7 @@
         e.eval("var p_float_array = o.publicFloatArray;");
         assertEquals(o.publicFloatArray[0], e.eval("o.publicFloatArray[0];"));
         assertArrayEquals(o.publicFloatArray, (float[])e.get("p_float_array"), 1e-10f);
-        e.eval("var t_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+        e.eval("var t_float_arr = new (Java.type(\"float[]\"))(3);" +
                 "t_float_arr[0] = 9.0;" +
                 "t_float_arr[1] = 5.12345;" +
                 "t_float_arr[2] = -60.03;" +
@@ -604,7 +604,7 @@
         e.eval("var ps_float_array = SharedObject.publicStaticFloatArray;");
         assertEquals(SharedObject.publicStaticFloatArray[0], e.eval("SharedObject.publicStaticFloatArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFloatArray, (float[])e.get("ps_float_array"), 1e-10f);
-        e.eval("var ts_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+        e.eval("var ts_float_arr = new (Java.type(\"float[]\"))(3);" +
                 "ts_float_arr[0] = 9.0;" +
                 "ts_float_arr[1] = 5.12345;" +
                 "ts_float_arr[2] = -60.03;" +
@@ -627,7 +627,7 @@
         e.eval("var pf_float_array = o.publicFinalFloatArray;");
         assertEquals(o.publicFinalFloatArray[0], e.eval("o.publicFinalFloatArray[0];"));
         assertArrayEquals(o.publicFinalFloatArray, (float[])e.get("pf_float_array"), 1e-10f);
-        e.eval("var tf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+        e.eval("var tf_float_arr = new (Java.type(\"float[]\"))(3);" +
                 "tf_float_arr[0] = 9.0;" +
                 "tf_float_arr[1] = 5.12345;" +
                 "tf_float_arr[2] = -60.03;" +
@@ -650,7 +650,7 @@
         e.eval("var psf_float_array = SharedObject.publicStaticFinalFloatArray;");
         assertEquals(SharedObject.publicStaticFinalFloatArray[0], e.eval("SharedObject.publicStaticFinalFloatArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalFloatArray, (float[])e.get("psf_float_array"), 1e-10f);
-        e.eval("var tsf_float_arr = java.lang.reflect.Array.newInstance(java.lang.Float.TYPE, 3);" +
+        e.eval("var tsf_float_arr = new (Java.type(\"float[]\"))(3);" +
                 "tsf_float_arr[0] = 9.0;" +
                 "tsf_float_arr[1] = 5.12345;" +
                 "tsf_float_arr[2] = -60.03;" +
@@ -687,7 +687,7 @@
         e.eval("var p_double_array = o.publicDoubleArray;");
         assertEquals(o.publicDoubleArray[0], e.eval("o.publicDoubleArray[0];"));
         assertArrayEquals(o.publicDoubleArray, (double[])e.get("p_double_array"), 1e-10);
-        e.eval("var t_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+        e.eval("var t_double_arr = new (Java.type(\"double[]\"))(3);" +
                 "t_double_arr[0] = 9e10;" +
                 "t_double_arr[1] = 0.677777;" +
                 "t_double_arr[2] = -0.0000001;" +
@@ -722,7 +722,7 @@
         e.eval("var ps_double_array = SharedObject.publicStaticDoubleArray;");
         assertEquals(SharedObject.publicStaticDoubleArray[0], e.eval("SharedObject.publicStaticDoubleArray[0];"));
         assertArrayEquals(SharedObject.publicStaticDoubleArray, (double[])e.get("ps_double_array"), 1e-10);
-        e.eval("var ts_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+        e.eval("var ts_double_arr = new (Java.type(\"double[]\"))(3);" +
                 "ts_double_arr[0] = 9e10;" +
                 "ts_double_arr[1] = 0.677777;" +
                 "ts_double_arr[2] = -0.0000001;" +
@@ -745,7 +745,7 @@
         e.eval("var pf_double_array = o.publicFinalDoubleArray;");
         assertEquals(o.publicFinalDoubleArray[0], e.eval("o.publicFinalDoubleArray[0];"));
         assertArrayEquals(o.publicFinalDoubleArray, (double[])e.get("pf_double_array"), 1e-10);
-        e.eval("var tf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+        e.eval("var tf_double_arr = new (Java.type(\"double[]\"))(3);" +
                 "tf_double_arr[0] = 9e10;" +
                 "tf_double_arr[1] = 0.677777;" +
                 "tf_double_arr[2] = -0.0000001;" +
@@ -768,7 +768,7 @@
         e.eval("var psf_double_array = SharedObject.publicStaticFinalDoubleArray;");
         assertEquals(SharedObject.publicStaticFinalDoubleArray[0], e.eval("SharedObject.publicStaticFinalDoubleArray[0];"));
         assertArrayEquals(SharedObject.publicStaticFinalDoubleArray, (double[])e.get("psf_double_array"), 1e-10);
-        e.eval("var tsf_double_arr = java.lang.reflect.Array.newInstance(java.lang.Double.TYPE, 3);" +
+        e.eval("var tsf_double_arr = new (Java.type(\"double[]\"))(3);" +
                 "tsf_double_arr[0] = 9e10;" +
                 "tsf_double_arr[1] = 0.677777;" +
                 "tsf_double_arr[2] = -0.0000001;" +
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -72,7 +72,7 @@
         e.eval("var p_object_array = o.publicObjectArray;");
         assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]"));
         assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array"));
-        e.eval("var t_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+        e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
                 "t_object_arr[0] = new Person(100);" +
                 "t_object_arr[1] = new Person(120);" +
                 "t_object_arr[2] = new Person(140);" +
@@ -96,7 +96,7 @@
         e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;");
         assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]"));
         assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array"));
-        e.eval("var ts_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+        e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
                 "ts_object_arr[0] = new Person(100);" +
                 "ts_object_arr[1] = new Person(120);" +
                 "ts_object_arr[2] = new Person(140);" +
@@ -120,7 +120,7 @@
         e.eval("var pf_object_array = o.publicFinalObjectArray;");
         assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]"));
         assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array"));
-        e.eval("var tf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+        e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
                 "tf_object_arr[0] = new Person(100);" +
                 "tf_object_arr[1] = new Person(120);" +
                 "tf_object_arr[2] = new Person(140);" +
@@ -144,7 +144,7 @@
         e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;");
         assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]"));
         assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array"));
-        e.eval("var tsf_object_arr = java.lang.reflect.Array.newInstance(Person.class, 3);" +
+        e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
                 "tsf_object_arr[0] = new Person(100);" +
                 "tsf_object_arr[1] = new Person(120);" +
                 "tsf_object_arr[2] = new Person(140);" +
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -71,7 +71,7 @@
         e.eval("var p_string_array = o.publicStringArray;");
         assertEquals(o.publicStringArray[0], e.eval("o.publicStringArray[0]"));
         assertArrayEquals(o.publicStringArray, (String[])e.get("p_string_array"));
-        e.eval("var t_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+        e.eval("var t_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
                 "t_string_arr[0] = 'abc';" +
                 "t_string_arr[1] = '123';" +
                 "t_string_arr[2] = 'xyzzzz';" +
@@ -95,7 +95,7 @@
         e.eval("var ps_string_array = SharedObject.publicStaticStringArray;");
         assertEquals(SharedObject.publicStaticStringArray[0], e.eval("SharedObject.publicStaticStringArray[0]"));
         assertArrayEquals(SharedObject.publicStaticStringArray, (String[])e.get("ps_string_array"));
-        e.eval("var ts_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+        e.eval("var ts_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
                 "ts_string_arr[0] = 'abc';" +
                 "ts_string_arr[1] = '123';" +
                 "ts_string_arr[2] = 'xyzzzz';" +
@@ -119,7 +119,7 @@
         e.eval("var pf_string_array = o.publicFinalStringArray;");
         assertEquals(o.publicFinalStringArray[0], e.eval("o.publicFinalStringArray[0]"));
         assertArrayEquals(o.publicFinalStringArray, (String[])e.get("pf_string_array"));
-        e.eval("var tf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+        e.eval("var tf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
                 "tf_string_arr[0] = 'abc';" +
                 "tf_string_arr[1] = '123';" +
                 "tf_string_arr[2] = 'xyzzzz';" +
@@ -143,7 +143,7 @@
         e.eval("var psf_string_array = SharedObject.publicStaticFinalStringArray;");
         assertEquals(SharedObject.publicStaticFinalStringArray[0], e.eval("SharedObject.publicStaticFinalStringArray[0]"));
         assertArrayEquals(SharedObject.publicStaticFinalStringArray, (String[])e.get("psf_string_array"));
-        e.eval("var tsf_string_arr = java.lang.reflect.Array.newInstance(java.lang.String.class, 3);" +
+        e.eval("var tsf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
                 "tsf_string_arr[0] = 'abc';" +
                 "tsf_string_arr[1] = '123';" +
                 "tsf_string_arr[2] = 'xyzzzz';" +
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Tue Aug 06 16:54:56 2013 -0700
@@ -363,6 +363,90 @@
     }
 
     @Test
+    /**
+     * Check that we can get interface out of a script object even after
+     * switching to use different ScriptContext.
+     */
+    public void getInterfaceDifferentContext() {
+       ScriptEngineManager m = new ScriptEngineManager();
+       ScriptEngine e = m.getEngineByName("nashorn");
+       try {
+           Object obj = e.eval("({ run: function() { } })");
+
+           // change script context
+           ScriptContext ctxt = new SimpleScriptContext();
+           ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+           e.setContext(ctxt);
+
+           Runnable r = ((Invocable)e).getInterface(obj, Runnable.class);
+           r.run();
+       }catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+       }
+    }
+
+    @Test
+    /**
+     * Check that getInterface on non-script object 'thiz' results in IllegalArgumentException.
+     */
+    public void getInterfaceNonScriptObjectThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable)e).getInterface(new Object(), Runnable.class);
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that getInterface on null 'thiz' results in IllegalArgumentException.
+     */
+    public void getInterfaceNullThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable)e).getInterface(null, Runnable.class);
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling getInterface on mirror created by another engine results in IllegalArgumentException.
+     */
+    public void getInterfaceMixEnginesTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine1 = m.getEngineByName("nashorn");
+        final ScriptEngine engine2 = m.getEngineByName("nashorn");
+
+        try {
+            Object obj = engine1.eval("({ run: function() {} })");
+            // pass object from engine1 to engine2 as 'thiz' for getInterface
+            ((Invocable)engine2).getInterface(obj, Runnable.class);
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
     public void accessGlobalTest() {
         final ScriptEngineManager m = new ScriptEngineManager();
         final ScriptEngine e = m.getEngineByName("nashorn");
@@ -649,6 +733,133 @@
     }
 
     @Test
+    /**
+     * Check that we can call invokeMethod on an object that we got by evaluating
+     * script with different Context set.
+     */
+    public void invokeMethodDifferentContextTest() {
+       ScriptEngineManager m = new ScriptEngineManager();
+       ScriptEngine e = m.getEngineByName("nashorn");
+
+       try {
+           // define an object with method on it
+           Object obj = e.eval("({ hello: function() { return 'Hello World!'; } })");
+
+           final ScriptContext ctxt = new SimpleScriptContext();
+           ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+           e.setContext(ctxt);
+
+           // invoke 'func' on obj - but with current script context changed
+           final Object res = ((Invocable)e).invokeMethod(obj, "hello");
+           assertEquals(res, "Hello World!");
+       } catch (final Exception exp) {
+           exp.printStackTrace();
+           fail(exp.getMessage());
+       }
+    }
+
+    @Test
+    /**
+     * Check that invokeMethod throws NPE on null method name.
+     */
+    public void invokeMethodNullNameTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            final Object obj = e.eval("({})");
+            final Object res = ((Invocable)e).invokeMethod(obj, null);
+            fail("should have thrown NPE");
+        } catch (final Exception exp) {
+            if (! (exp instanceof NullPointerException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that invokeMethod throws NoSuchMethodException on missing method.
+     */
+    public void invokeMethodMissingTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            final Object obj = e.eval("({})");
+            final Object res = ((Invocable)e).invokeMethod(obj, "nonExistentMethod");
+            fail("should have thrown NoSuchMethodException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof NoSuchMethodException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling method on non-script object 'thiz' results in IllegalArgumentException.
+     */
+    public void invokeMethodNonScriptObjectThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable)e).invokeMethod(new Object(), "toString");
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling method on null 'thiz' results in IllegalArgumentException.
+     */
+    public void invokeMethodNullThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable)e).invokeMethod(null, "toString");
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+
+    @Test
+    /**
+     * Check that calling method on mirror created by another engine results in IllegalArgumentException.
+     */
+    public void invokeMethodMixEnginesTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine1 = m.getEngineByName("nashorn");
+        final ScriptEngine engine2 = m.getEngineByName("nashorn");
+
+        try {
+            Object obj = engine1.eval("({ run: function() {} })");
+            // pass object from engine1 to engine2 as 'thiz' for invokeMethod
+            ((Invocable)engine2).invokeMethod(obj, "run");
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
     public void noEnumerablePropertiesTest() {
         final ScriptEngineManager m = new ScriptEngineManager();
         final ScriptEngine e = m.getEngineByName("nashorn");
@@ -767,6 +978,70 @@
     }
 
     @Test
+    /**
+     * check that null function name results in NPE.
+     */
+    public void invokeFunctionNullNameTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            final Object res = ((Invocable)e).invokeFunction(null);
+            fail("should have thrown NPE");
+        } catch (final Exception exp) {
+            if (! (exp instanceof NullPointerException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that attempt to call missing function results in NoSuchMethodException.
+     */
+    public void invokeFunctionMissingTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            final Object res = ((Invocable)e).invokeFunction("NonExistentFunc");
+            fail("should have thrown NoSuchMethodException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof NoSuchMethodException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that invokeFunction calls functions only from current context's Bindings.
+     */
+    public void invokeFunctionDifferentContextTest() {
+        ScriptEngineManager m = new ScriptEngineManager();
+        ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            // define an object with method on it
+            Object obj = e.eval("function hello() { return 'Hello World!'; }");
+            final ScriptContext ctxt = new SimpleScriptContext();
+            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+            // change engine's current context
+            e.setContext(ctxt);
+
+            ((Invocable)e).invokeFunction("hello"); // no 'hello' in new context!
+            fail("should have thrown NoSuchMethodException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof NoSuchMethodException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
     public void invokeFunctionExceptionTest() {
         final ScriptEngineManager m = new ScriptEngineManager();
         final ScriptEngine e = m.getEngineByName("nashorn");
@@ -945,4 +1220,38 @@
         Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]");
         Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]");
     }
+
+    @Test
+    // check that print function prints arg followed by newline char
+    public void printTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final StringWriter sw = new StringWriter();
+        e.getContext().setWriter(sw);
+        try {
+            e.eval("print('hello')");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        assertEquals(sw.toString(), "hello\n");
+    }
+
+    @Test
+    // check that print prints all arguments (more than one)
+    public void printManyTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final StringWriter sw = new StringWriter();
+        e.getContext().setWriter(sw);
+        try {
+            e.eval("print(34, true, 'hello')");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        assertEquals(sw.toString(), "34 true hello\n");
+    }
 }
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/AbstractScriptRunnable.java	Tue Aug 06 16:54:56 2013 -0700
@@ -29,6 +29,7 @@
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_COMPARE;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_COMPILE_FAIL;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_RUN_FAIL;
+import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_FORK;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_IGNORE_STD_ERROR;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_JS_FAIL_LIST;
@@ -68,6 +69,8 @@
     protected final boolean checkCompilerMsg;
     // .EXPECTED file compared for this or test?
     protected final boolean compare;
+    // should test run in a separate process?
+    protected final boolean fork;
     // ignore stderr output?
     protected final boolean ignoreStdError;
     // Foo.js.OUTPUT file where test stdout messages go
@@ -98,6 +101,7 @@
         this.checkCompilerMsg = testOptions.containsKey(OPTIONS_CHECK_COMPILE_MSG);
         this.ignoreStdError = testOptions.containsKey(OPTIONS_IGNORE_STD_ERROR);
         this.compare = testOptions.containsKey(OPTIONS_COMPARE);
+        this.fork = testOptions.containsKey(OPTIONS_FORK);
 
         final String testName = testFile.getName();
         this.outputFileName = buildDir + File.separator + testName + ".OUTPUT";
@@ -105,7 +109,6 @@
         this.copyExpectedFileName = buildDir + File.separator + testName + ".EXPECTED";
         this.expectedFileName = testFile.getPath() + ".EXPECTED";
 
-        final String failListString = System.getProperty(TEST_JS_FAIL_LIST);
         if (failListString != null) {
             final String[] failedTests = failListString.split(" ");
             for (final String failedTest : failedTests) {
@@ -147,10 +150,15 @@
     }
 
     // shared context or not?
-    protected static final boolean sharedContext;
+    protected static final boolean sharedContext = Boolean.getBoolean(TEST_JS_SHARED_CONTEXT);
+    protected static final String failListString = System.getProperty(TEST_JS_FAIL_LIST);
+    // VM options when a @fork test is executed by a separate process
+    protected static final String[] forkJVMOptions;
     static {
-        sharedContext = Boolean.getBoolean(TEST_JS_SHARED_CONTEXT);
+        String vmOptions = System.getProperty(TestConfig.TEST_FORK_JVM_OPTIONS);
+        forkJVMOptions = (vmOptions != null)? vmOptions.split(" ") : new String[0];
     }
+
     private static ThreadLocal<ScriptEvaluator> evaluators = new ThreadLocal<>();
 
     /**
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java	Tue Aug 06 16:54:56 2013 -0700
@@ -43,6 +43,8 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
+
+import jdk.nashorn.tools.Shell;
 import org.testng.Assert;
 import org.testng.ITest;
 import org.testng.annotations.Test;
@@ -53,9 +55,6 @@
  * corresponding .EXPECTED file.
  */
 public final class ScriptRunnable extends AbstractScriptRunnable implements ITest {
-    // when test is run in a separate process, this is the command line
-    protected final ArrayList<String> separateProcessArgs;
-
     public ScriptRunnable(final String framework, final File testFile, final List<String> engineOptions, final Map<String, String> testOptions,  final List<String> scriptArguments) {
         super(framework, testFile, engineOptions, testOptions, scriptArguments);
 
@@ -63,9 +62,6 @@
           // add --dump-on-error option always so that we can get detailed error msg.
           engineOptions.add("-doe");
         }
-
-        final String separateProcess = System.getProperty("test.js.separateprocess");
-        this.separateProcessArgs = separateProcess == null ? null : new ArrayList<>(Arrays.asList(separateProcess.split(" ")));
     }
 
     @Override
@@ -81,7 +77,7 @@
 
     @Override
     protected void execute() {
-        if (separateProcessArgs != null) {
+        if (fork) {
             executeInNewProcess();
         } else {
             executeInThisProcess();
@@ -172,15 +168,24 @@
     }
 
     private void executeInNewProcess() {
-        final List<String> args = separateProcessArgs;
+
+        final String separator = System.getProperty("file.separator");
+        final List<String> cmd = new ArrayList<>();
+
+        cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java");
+        cmd.add("-Djava.ext.dirs=dist");
+        for (String str : forkJVMOptions) {
+            cmd.add(str);
+        }
+        cmd.add(Shell.class.getName());
         // now add the rest of the "in process" runtime arguments
-        args.addAll(getRuntimeArgs());
+        cmd.addAll(getRuntimeArgs());
 
         final File outputFileHandle = new File(outputFileName);
         final File errorFileHandle = new File(errorFileName);
 
         try {
-            final ProcessBuilder pb = new ProcessBuilder(args);
+            final ProcessBuilder pb = new ProcessBuilder(cmd);
             pb.redirectOutput(outputFileHandle);
             pb.redirectError(errorFileHandle);
             final Process process = pb.start();
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestConfig.java	Tue Aug 06 16:54:56 2013 -0700
@@ -36,6 +36,7 @@
     public static final String   OPTIONS_EXPECT_RUN_FAIL     = "expect-run-fail";
     public static final String   OPTIONS_IGNORE_STD_ERROR    = "ignore-std-error";
     public static final String   OPTIONS_COMPARE             = "compare";
+    public static final String   OPTIONS_FORK                = "fork";
 
     // System property names used for various test configurations
 
@@ -73,6 +74,8 @@
     // shared context mode or not
     static final String TEST_JS_SHARED_CONTEXT              = "test.js.shared.context";
 
+    static final String TEST_FORK_JVM_OPTIONS               = "test.fork.jvm.options";
+
     // file for storing last run's failed tests
     static final String TEST_FAILED_LIST_FILE = "test.failed.list.file";
 }
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java	Thu Aug 01 14:59:05 2013 +0400
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java	Tue Aug 06 16:54:56 2013 -0700
@@ -29,6 +29,7 @@
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_COMPARE;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_COMPILE_FAIL;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_EXPECT_RUN_FAIL;
+import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_FORK;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_IGNORE_STD_ERROR;
 import static jdk.nashorn.internal.test.framework.TestConfig.OPTIONS_RUN;
 import static jdk.nashorn.internal.test.framework.TestConfig.TEST_FAILED_LIST_FILE;
@@ -208,6 +209,7 @@
         boolean checkCompilerMsg = false;
         boolean noCompare = false;
         boolean ignoreStdError = false;
+        boolean fork = false;
 
         final List<String> engineOptions = new ArrayList<>();
         final List<String> scriptArguments = new ArrayList<>();
@@ -284,6 +286,9 @@
                 case "@option":
                     engineOptions.add(scanner.next());
                     break;
+                case "@fork":
+                    fork = true;
+                    break;
                 }
 
                 // negative tests are expected to fail at runtime only
@@ -324,6 +329,9 @@
             if (ignoreStdError) {
                 testOptions.put(OPTIONS_IGNORE_STD_ERROR, "true");
             }
+            if (fork) {
+                testOptions.put(OPTIONS_FORK, "true");
+            }
 
             tests.add(factory.createTest(framework, testFile.toFile(), engineOptions, testOptions, scriptArguments));
         } else if (!isNotTest) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/models/InternalRunnable.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.test.models;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+public class InternalRunnable implements Runnable, RestrictedRunnable {
+
+    // This is a public field in a restricted class; scripts should not see it.
+    public final int canNotSeeThisField = 42;
+
+    private boolean runExecuted = false;
+
+    @Override
+    public void run() {
+        runExecuted = true;
+    }
+
+    @Override
+    public void restrictedRun() {
+        // This is a public method on a restricted interface; scripts should not see it.
+        throw new AssertionError();
+    }
+
+    @Override
+    public String toString() {
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+        if(runExecuted) {
+            pw.println("InternalRunnable.run() executed!");
+        }
+        pw.println("InternalRunnable.toString() executed!");
+        pw.flush();
+        return sw.toString();
+    }
+
+    public void canNotInvokeThis() {
+        // This is a public method in a restricted class; scripts should not see it.
+        throw new AssertionError();
+    }
+
+    public void getInvisibleProperty() {
+        // This is a public method in a restricted class; scripts should not see it.
+        throw new AssertionError();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/test/models/RestrictedRunnable.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.test.models;
+
+/**
+ * Acts as a restricted interface implemented by a restricted class.
+ *
+ */
+public interface RestrictedRunnable {
+    public void restrictedRun();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/test/models/InternalRunnableSuperclass.java	Tue Aug 06 16:54:56 2013 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.test.models;
+
+import jdk.internal.dynalink.beans.StaticClass;
+import jdk.nashorn.internal.test.models.InternalRunnable;
+
+/**
+ * Acts as a non-restricted superclass for a restricted class.
+ *
+ */
+public class InternalRunnableSuperclass {
+    public final int canSeeThisField = 19;
+
+    public static Object makeInternalRunnable() {
+        return new InternalRunnable();
+    }
+
+    public static StaticClass getInternalRunnableType() {
+        return StaticClass.forClass(InternalRunnable.class);
+    }
+}