Merge "OpenJDK 11: Merging in / Deprecating java.util.Oberver/Observable"
diff --git a/api/current.txt b/api/current.txt
index 4ebfe7c..218dce1 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -12928,6 +12928,7 @@
   }
 
   public interface Enumeration<E> {
+    method public default java.util.Iterator<E> asIterator();
     method public boolean hasMoreElements();
     method public E nextElement();
   }
diff --git a/ojluni/src/main/java/java/lang/Enum.java b/ojluni/src/main/java/java/lang/Enum.java
index 6b37aea..2824725 100644
--- a/ojluni/src/main/java/java/lang/Enum.java
+++ b/ojluni/src/main/java/java/lang/Enum.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * 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,6 +58,8 @@
  * @see     java.util.EnumMap
  * @since   1.5
  */
+@SuppressWarnings("serial") // No serialVersionUID needed due to
+                            // special-casing of enum types.
 public abstract class Enum<E extends Enum<E>>
         implements Comparable<E>, Serializable {
     /**
@@ -293,6 +295,7 @@
     /**
      * enum classes cannot have finalize methods.
      */
+    @SuppressWarnings("deprecation")
     protected final void finalize() { }
 
     /**
diff --git a/ojluni/src/main/java/java/lang/ref/PhantomReference.java b/ojluni/src/main/java/java/lang/ref/PhantomReference.java
index 1c1364a..b79e338 100644
--- a/ojluni/src/main/java/java/lang/ref/PhantomReference.java
+++ b/ojluni/src/main/java/java/lang/ref/PhantomReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,22 +29,19 @@
 /**
  * Phantom reference objects, which are enqueued after the collector
  * determines that their referents may otherwise be reclaimed.  Phantom
- * references are most often used for scheduling pre-mortem cleanup actions in
- * a more flexible way than is possible with the Java finalization mechanism.
+ * references are most often used to schedule post-mortem cleanup actions.
  *
- * <p> If the garbage collector determines at a certain point in time that the
- * referent of a phantom reference is <a
- * href="package-summary.html#reachability">phantom reachable</a>, then at that
- * time or at some later time it will enqueue the reference.
+ * <p> Suppose the garbage collector determines at a certain point in time
+ * that an object is <a href="package-summary.html#reachability">
+ * phantom reachable</a>.  At that time it will atomically clear
+ * all phantom references to that object and all phantom references to
+ * any other phantom-reachable objects from which that object is reachable.
+ * At the same time or at some later time it will enqueue those newly-cleared
+ * phantom references that are registered with reference queues.
  *
  * <p> In order to ensure that a reclaimable object remains so, the referent of
- * a phantom reference may not be retrieved: The <code>get</code> method of a
- * phantom reference always returns <code>null</code>.
- *
- * <p> Unlike soft and weak references, phantom references are not
- * automatically cleared by the garbage collector as they are enqueued.  An
- * object that is reachable via phantom references will remain so until all
- * such references are cleared or themselves become unreachable.
+ * a phantom reference may not be retrieved: The {@code get} method of a
+ * phantom reference always returns {@code null}.
  *
  * @author   Mark Reinhold
  * @since    1.2
@@ -55,9 +52,9 @@
     /**
      * Returns this reference object's referent.  Because the referent of a
      * phantom reference is always inaccessible, this method always returns
-     * <code>null</code>.
+     * {@code null}.
      *
-     * @return  <code>null</code>
+     * @return {@code null}
      */
     public T get() {
         return null;
@@ -67,14 +64,14 @@
      * Creates a new phantom reference that refers to the given object and
      * is registered with the given queue.
      *
-     * <p> It is possible to create a phantom reference with a <tt>null</tt>
-     * queue, but such a reference is completely useless: Its <tt>get</tt>
-     * method will always return null and, since it does not have a queue, it
-     * will never be enqueued.
+     * <p> It is possible to create a phantom reference with a {@code null}
+     * queue, but such a reference is completely useless: Its {@code get}
+     * method will always return {@code null} and, since it does not have a queue,
+     * it will never be enqueued.
      *
      * @param referent the object the new phantom reference will refer to
      * @param q the queue with which the reference is to be registered,
-     *          or <tt>null</tt> if registration is not required
+     *          or {@code null} if registration is not required
      */
     public PhantomReference(T referent, ReferenceQueue<? super T> q) {
         super(referent, q);
diff --git a/ojluni/src/main/java/java/lang/ref/SoftReference.java b/ojluni/src/main/java/java/lang/ref/SoftReference.java
index 272d1bd..a250ad7 100644
--- a/ojluni/src/main/java/java/lang/ref/SoftReference.java
+++ b/ojluni/src/main/java/java/lang/ref/SoftReference.java
@@ -41,7 +41,7 @@
  *
  * <p> All soft references to softly-reachable objects are guaranteed to have
  * been cleared before the virtual machine throws an
- * <code>OutOfMemoryError</code>.  Otherwise no constraints are placed upon the
+ * {@code OutOfMemoryError}.  Otherwise no constraints are placed upon the
  * time at which a soft reference will be cleared or the order in which a set
  * of such references to different objects will be cleared.  Virtual machine
  * implementations are, however, encouraged to bias against clearing
@@ -70,7 +70,7 @@
     /**
      * Timestamp clock, updated by the garbage collector
      */
-    static private long clock;
+    private static long clock;
 
     /**
      * Timestamp updated by each invocation of the get method.  The VM may use
@@ -96,7 +96,7 @@
      *
      * @param referent object the new soft reference will refer to
      * @param q the queue with which the reference is to be registered,
-     *          or <tt>null</tt> if registration is not required
+     *          or {@code null} if registration is not required
      *
      */
     public SoftReference(T referent, ReferenceQueue<? super T> q) {
@@ -107,10 +107,10 @@
     /**
      * Returns this reference object's referent.  If this reference object has
      * been cleared, either by the program or by the garbage collector, then
-     * this method returns <code>null</code>.
+     * this method returns {@code null}.
      *
      * @return   The object to which this reference refers, or
-     *           <code>null</code> if this reference object has been cleared
+     *           {@code null} if this reference object has been cleared
      */
     public T get() {
         T o = super.get();
diff --git a/ojluni/src/main/java/java/lang/ref/WeakReference.java b/ojluni/src/main/java/java/lang/ref/WeakReference.java
index 025949a..fdf2b5c 100644
--- a/ojluni/src/main/java/java/lang/ref/WeakReference.java
+++ b/ojluni/src/main/java/java/lang/ref/WeakReference.java
@@ -63,7 +63,7 @@
      *
      * @param referent object the new weak reference will refer to
      * @param q the queue with which the reference is to be registered,
-     *          or <tt>null</tt> if registration is not required
+     *          or {@code null} if registration is not required
      */
     public WeakReference(T referent, ReferenceQueue<? super T> q) {
         super(referent, q);
diff --git a/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java b/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java
index 7bb2a60..7338802 100644
--- a/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java
+++ b/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java
@@ -100,28 +100,44 @@
  * <p>The table below summarizes which kind of annotation presence
  * different methods in this interface examine.
  *
- * <table border>
+ * <table class="plain">
  * <caption>Overview of kind of presence detected by different AnnotatedElement methods</caption>
- * <tr><th colspan=2></th><th colspan=4>Kind of Presence</th>
- * <tr><th colspan=2>Method</th><th>Directly Present</th><th>Indirectly Present</th><th>Present</th><th>Associated</th>
- * <tr><td align=right>{@code T}</td><td>{@link #getAnnotation(Class) getAnnotation(Class&lt;T&gt;)}
- * <td></td><td></td><td>X</td><td></td>
+ * <thead>
+ * <tr><th colspan=2 scope="col">Method</th>
+ *     <th colspan=4 scope="col">Kind of Presence</th>
+ * <tr><th scope="col">Return Type</th>
+ *     <th scope="col">Signature</th>
+ *     <th scope="col">Directly Present</th>
+ *     <th scope="col">Indirectly Present</th>
+ *     <th scope="col">Present</th>
+ *     <th scope="col">Associated</th>
+ * </thead>
+ * <tbody>
+ * <tr><td style="text-align:right">{@code T}</td>
+ * <th scope="row" style="font-weight:normal; text-align:left">{@link #getAnnotation(Class) getAnnotation(Class&lt;T&gt;)}
+ * <td></td><td></td><td style="text-align:center">X</td><td></td>
  * </tr>
- * <tr><td align=right>{@code Annotation[]}</td><td>{@link #getAnnotations getAnnotations()}
- * <td></td><td></td><td>X</td><td></td>
+ * <tr><td style="text-align:right">{@code Annotation[]}</td>
+ * <th scope="row" style="font-weight:normal; text-align:left">{@link #getAnnotations getAnnotations()}
+ * <td></td><td></td><td style="text-align:center">X</td><td></td>
  * </tr>
- * <tr><td align=right>{@code T[]}</td><td>{@link #getAnnotationsByType(Class) getAnnotationsByType(Class&lt;T&gt;)}
- * <td></td><td></td><td></td><td>X</td>
+ * <tr><td style="text-align:right">{@code T[]}</td>
+ * <th scope="row" style="font-weight:normal; text-align:left">{@link #getAnnotationsByType(Class) getAnnotationsByType(Class&lt;T&gt;)}
+ * <td></td><td></td><td></td><td style="text-align:center">X</td>
  * </tr>
- * <tr><td align=right>{@code T}</td><td>{@link #getDeclaredAnnotation(Class) getDeclaredAnnotation(Class&lt;T&gt;)}
- * <td>X</td><td></td><td></td><td></td>
+ * <tr><td style="text-align:right">{@code T}</td>
+ * <th scope="row" style="font-weight:normal; text-align:left">{@link #getDeclaredAnnotation(Class) getDeclaredAnnotation(Class&lt;T&gt;)}
+ * <td style="text-align:center">X</td><td></td><td></td><td></td>
  * </tr>
- * <tr><td align=right>{@code Annotation[]}</td><td>{@link #getDeclaredAnnotations getDeclaredAnnotations()}
- * <td>X</td><td></td><td></td><td></td>
+ * <tr><td style="text-align:right">{@code Annotation[]}</td>
+ * <th scope="row" style="font-weight:normal; text-align:left">{@link #getDeclaredAnnotations getDeclaredAnnotations()}
+ * <td style="text-align:center">X</td><td></td><td></td><td></td>
  * </tr>
- * <tr><td align=right>{@code T[]}</td><td>{@link #getDeclaredAnnotationsByType(Class) getDeclaredAnnotationsByType(Class&lt;T&gt;)}
- * <td>X</td><td>X</td><td></td><td></td>
+ * <tr><td style="text-align:right">{@code T[]}</td>
+ * <th scope="row" style="font-weight:normal; text-align:left">{@link #getDeclaredAnnotationsByType(Class) getDeclaredAnnotationsByType(Class&lt;T&gt;)}
+ * <td style="text-align:center">X</td><td style="text-align:center">X</td><td></td><td></td>
  * </tr>
+ * </tbody>
  * </table>
  *
  * <p>For an invocation of {@code get[Declared]AnnotationsByType( Class <
diff --git a/ojluni/src/main/java/java/lang/reflect/InvocationTargetException.java b/ojluni/src/main/java/java/lang/reflect/InvocationTargetException.java
index 360d0ba..e1133e3 100644
--- a/ojluni/src/main/java/java/lang/reflect/InvocationTargetException.java
+++ b/ojluni/src/main/java/java/lang/reflect/InvocationTargetException.java
@@ -38,6 +38,7 @@
  *
  * @see Method
  * @see Constructor
+ * @since 1.1
  */
 public class InvocationTargetException extends ReflectiveOperationException {
     /**
diff --git a/ojluni/src/main/java/java/lang/reflect/Member.java b/ojluni/src/main/java/java/lang/reflect/Member.java
index 2241d45..3ac457d 100644
--- a/ojluni/src/main/java/java/lang/reflect/Member.java
+++ b/ojluni/src/main/java/java/lang/reflect/Member.java
@@ -35,6 +35,7 @@
  * @see Constructor
  *
  * @author Nakul Saraiya
+ * @since 1.1
  */
 public
 interface Member {
diff --git a/ojluni/src/main/java/java/lang/reflect/WildcardType.java b/ojluni/src/main/java/java/lang/reflect/WildcardType.java
index aa8e824..7b8f396 100644
--- a/ojluni/src/main/java/java/lang/reflect/WildcardType.java
+++ b/ojluni/src/main/java/java/lang/reflect/WildcardType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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,7 +34,7 @@
 public interface WildcardType extends Type {
     /**
      * Returns an array of {@code Type} objects representing the  upper
-     * bound(s) of this type variable.  Note that if no upper bound is
+     * bound(s) of this type variable.  If no upper bound is
      * explicitly declared, the upper bound is {@code Object}.
      *
      * <p>For each upper bound B :
@@ -57,7 +57,7 @@
 
     /**
      * Returns an array of {@code Type} objects representing the
-     * lower bound(s) of this type variable.  Note that if no lower bound is
+     * lower bound(s) of this type variable.  If no lower bound is
      * explicitly declared, the lower bound is the type of {@code null}.
      * In this case, a zero length array is returned.
      *
diff --git a/ojluni/src/main/java/java/nio/file/FileSystem.java b/ojluni/src/main/java/java/nio/file/FileSystem.java
index 0720fa5..f1944b4 100644
--- a/ojluni/src/main/java/java/nio/file/FileSystem.java
+++ b/ojluni/src/main/java/java/nio/file/FileSystem.java
@@ -343,18 +343,12 @@
      * </tr>
      * <tr>
      *   <th scope="row"><code>&#47;home&#47;*&#47;*</code>
-     *   <td>Matches <code>&#47;home&#47;gus&#47;data</code> on UNIX platforms</td>
+     *   <td>Matches <code>&#47;home&#47;gus&#47;data</code></td>
      * </tr>
      * <tr>
      *   <th scope="row"><code>&#47;home&#47;**</code>
      *   <td>Matches <code>&#47;home&#47;gus</code> and
-     *   <code>&#47;home&#47;gus&#47;data</code> on UNIX platforms</td>
-     * </tr>
-     * <tr>
-     *   <th scope="row"><code>C:&#92;&#92;*</code>
-     *   <td>Matches <code>C:&#92;foo</code> and <code>C:&#92;bar</code> on the Windows
-     *   platform (note that the backslash is escaped; as a string literal in the
-     *   Java Language the pattern would be <code>"C:&#92;&#92;&#92;&#92;*"</code>) </td>
+     *   <code>&#47;home&#47;gus&#47;data</code></td>
      * </tr>
      * </tbody>
      * </table>
diff --git a/ojluni/src/main/java/java/text/FieldPosition.java b/ojluni/src/main/java/java/text/FieldPosition.java
index 955221d..7a6e2a5 100644
--- a/ojluni/src/main/java/java/text/FieldPosition.java
+++ b/ojluni/src/main/java/java/text/FieldPosition.java
@@ -68,6 +68,7 @@
  * <code>formatToCharacterIterator</code>.
  *
  * @author      Mark Davis
+ * @since 1.1
  * @see         java.text.Format
  */
 public class FieldPosition {
diff --git a/ojluni/src/main/java/java/time/Month.java b/ojluni/src/main/java/java/time/Month.java
index 57382cd..1a0d9ee 100644
--- a/ojluni/src/main/java/java/time/Month.java
+++ b/ojluni/src/main/java/java/time/Month.java
@@ -379,7 +379,7 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Returns the month-of-year that is the specified number of quarters after this one.
+     * Returns the month-of-year that is the specified number of months after this one.
      * <p>
      * The calculation rolls around the end of the year from December to January.
      * The specified period may be negative.
diff --git a/ojluni/src/main/java/java/time/format/TextStyle.java b/ojluni/src/main/java/java/time/format/TextStyle.java
index ed65d27..27a6f91 100644
--- a/ojluni/src/main/java/java/time/format/TextStyle.java
+++ b/ojluni/src/main/java/java/time/format/TextStyle.java
@@ -82,6 +82,8 @@
  *
  * @implSpec
  * This is immutable and thread-safe enum.
+ *
+ * @since 1.8
  */
 public enum TextStyle {
     // ordered from large to small
diff --git a/ojluni/src/main/java/java/time/zone/Ser.java b/ojluni/src/main/java/java/time/zone/Ser.java
index 31c2f2d..0017fb8 100644
--- a/ojluni/src/main/java/java/time/zone/Ser.java
+++ b/ojluni/src/main/java/java/time/zone/Ser.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -91,7 +91,7 @@
     static final byte ZRULES = 1;
     /** Type for ZoneOffsetTransition. */
     static final byte ZOT = 2;
-    /** Type for ZoneOffsetTransition. */
+    /** Type for ZoneOffsetTransitionRule. */
     static final byte ZOTRULE = 3;
 
     /** The type being serialized. */
diff --git a/ojluni/src/main/java/java/util/Deque.java b/ojluni/src/main/java/java/util/Deque.java
index 3d79952..5396673 100644
--- a/ojluni/src/main/java/java/util/Deque.java
+++ b/ojluni/src/main/java/java/util/Deque.java
@@ -57,41 +57,44 @@
  * <p>The twelve methods described above are summarized in the
  * following table:
  *
- * <table BORDER CELLPADDING=3 CELLSPACING=1>
+ * <table class="striped">
  * <caption>Summary of Deque methods</caption>
+ *  <thead>
  *  <tr>
- *    <td></td>
- *    <td ALIGN=CENTER COLSPAN = 2> <b>First Element (Head)</b></td>
- *    <td ALIGN=CENTER COLSPAN = 2> <b>Last Element (Tail)</b></td>
+ *    <td rowspan="2"></td>
+ *    <th scope="col" colspan="2"> First Element (Head)</th>
+ *    <th scope="col" colspan="2"> Last Element (Tail)</th>
  *  </tr>
  *  <tr>
- *    <td></td>
- *    <td ALIGN=CENTER><em>Throws exception</em></td>
- *    <td ALIGN=CENTER><em>Special value</em></td>
- *    <td ALIGN=CENTER><em>Throws exception</em></td>
- *    <td ALIGN=CENTER><em>Special value</em></td>
+ *    <th scope="col" style="font-weight:normal; font-style:italic">Throws exception</th>
+ *    <th scope="col" style="font-weight:normal; font-style:italic">Special value</th>
+ *    <th scope="col" style="font-weight:normal; font-style:italic">Throws exception</th>
+ *    <th scope="col" style="font-weight:normal; font-style:italic">Special value</th>
+ *  </tr>
+ *  </thead>
+ *  <tbody>
+ *  <tr>
+ *    <th scope="row">Insert</th>
+ *    <td>{@link #addFirst(Object) addFirst(e)}</td>
+ *    <td>{@link #offerFirst(Object) offerFirst(e)}</td>
+ *    <td>{@link #addLast(Object) addLast(e)}</td>
+ *    <td>{@link #offerLast(Object) offerLast(e)}</td>
  *  </tr>
  *  <tr>
- *    <td><b>Insert</b></td>
- *    <td>{@link Deque#addFirst addFirst(e)}</td>
- *    <td>{@link Deque#offerFirst offerFirst(e)}</td>
- *    <td>{@link Deque#addLast addLast(e)}</td>
- *    <td>{@link Deque#offerLast offerLast(e)}</td>
+ *    <th scope="row">Remove</th>
+ *    <td>{@link #removeFirst() removeFirst()}</td>
+ *    <td>{@link #pollFirst() pollFirst()}</td>
+ *    <td>{@link #removeLast() removeLast()}</td>
+ *    <td>{@link #pollLast() pollLast()}</td>
  *  </tr>
  *  <tr>
- *    <td><b>Remove</b></td>
- *    <td>{@link Deque#removeFirst removeFirst()}</td>
- *    <td>{@link Deque#pollFirst pollFirst()}</td>
- *    <td>{@link Deque#removeLast removeLast()}</td>
- *    <td>{@link Deque#pollLast pollLast()}</td>
+ *    <th scope="row">Examine</th>
+ *    <td>{@link #getFirst() getFirst()}</td>
+ *    <td>{@link #peekFirst() peekFirst()}</td>
+ *    <td>{@link #getLast() getLast()}</td>
+ *    <td>{@link #peekLast() peekLast()}</td>
  *  </tr>
- *  <tr>
- *    <td><b>Examine</b></td>
- *    <td>{@link Deque#getFirst getFirst()}</td>
- *    <td>{@link Deque#peekFirst peekFirst()}</td>
- *    <td>{@link Deque#getLast getLast()}</td>
- *    <td>{@link Deque#peekLast peekLast()}</td>
- *  </tr>
+ *  </tbody>
  * </table>
  *
  * <p>This interface extends the {@link Queue} interface.  When a deque is
@@ -100,62 +103,70 @@
  * inherited from the {@code Queue} interface are precisely equivalent to
  * {@code Deque} methods as indicated in the following table:
  *
- * <table BORDER CELLPADDING=3 CELLSPACING=1>
+ * <table class="striped">
  * <caption>Comparison of Queue and Deque methods</caption>
+ *  <thead>
  *  <tr>
- *    <td ALIGN=CENTER> <b>{@code Queue} Method</b></td>
- *    <td ALIGN=CENTER> <b>Equivalent {@code Deque} Method</b></td>
+ *    <th scope="col"> {@code Queue} Method</th>
+ *    <th scope="col"> Equivalent {@code Deque} Method</th>
+ *  </tr>
+ *  </thead>
+ *  <tbody>
+ *  <tr>
+ *    <th scope="row">{@link #add(Object) add(e)}</th>
+ *    <td>{@link #addLast(Object) addLast(e)}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link java.util.Queue#add add(e)}</td>
- *    <td>{@link #addLast addLast(e)}</td>
+ *    <th scope="row">{@link #offer(Object) offer(e)}</th>
+ *    <td>{@link #offerLast(Object) offerLast(e)}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link java.util.Queue#offer offer(e)}</td>
- *    <td>{@link #offerLast offerLast(e)}</td>
+ *    <th scope="row">{@link #remove() remove()}</th>
+ *    <td>{@link #removeFirst() removeFirst()}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link java.util.Queue#remove remove()}</td>
- *    <td>{@link #removeFirst removeFirst()}</td>
+ *    <th scope="row">{@link #poll() poll()}</th>
+ *    <td>{@link #pollFirst() pollFirst()}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link java.util.Queue#poll poll()}</td>
- *    <td>{@link #pollFirst pollFirst()}</td>
+ *    <th scope="row">{@link #element() element()}</th>
+ *    <td>{@link #getFirst() getFirst()}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link java.util.Queue#element element()}</td>
- *    <td>{@link #getFirst getFirst()}</td>
+ *    <th scope="row">{@link #peek() peek()}</th>
+ *    <td>{@link #peekFirst() peekFirst()}</td>
  *  </tr>
- *  <tr>
- *    <td>{@link java.util.Queue#peek peek()}</td>
- *    <td>{@link #peek peekFirst()}</td>
- *  </tr>
+ *  </tbody>
  * </table>
  *
  * <p>Deques can also be used as LIFO (Last-In-First-Out) stacks.  This
  * interface should be used in preference to the legacy {@link Stack} class.
  * When a deque is used as a stack, elements are pushed and popped from the
- * beginning of the deque.  Stack methods are precisely equivalent to
- * {@code Deque} methods as indicated in the table below:
+ * beginning of the deque.  Stack methods are equivalent to {@code Deque}
+ * methods as indicated in the table below:
  *
- * <table BORDER CELLPADDING=3 CELLSPACING=1>
+ * <table class="striped">
  * <caption>Comparison of Stack and Deque methods</caption>
+ *  <thead>
  *  <tr>
- *    <td ALIGN=CENTER> <b>Stack Method</b></td>
- *    <td ALIGN=CENTER> <b>Equivalent {@code Deque} Method</b></td>
+ *    <th scope="col"> Stack Method</th>
+ *    <th scope="col"> Equivalent {@code Deque} Method</th>
+ *  </tr>
+ *  </thead>
+ *  <tbody>
+ *  <tr>
+ *    <th scope="row">{@link #push(Object) push(e)}</th>
+ *    <td>{@link #addFirst(Object) addFirst(e)}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link #push push(e)}</td>
- *    <td>{@link #addFirst addFirst(e)}</td>
+ *    <th scope="row">{@link #pop() pop()}</th>
+ *    <td>{@link #removeFirst() removeFirst()}</td>
  *  </tr>
  *  <tr>
- *    <td>{@link #pop pop()}</td>
- *    <td>{@link #removeFirst removeFirst()}</td>
+ *    <th scope="row">{@link #peek() peek()}</th>
+ *    <td>{@link #getFirst() getFirst()}</td>
  *  </tr>
- *  <tr>
- *    <td>{@link #peek peek()}</td>
- *    <td>{@link #peekFirst peekFirst()}</td>
- *  </tr>
+ *  </tbody>
  * </table>
  *
  * <p>Note that the {@link #peek peek} method works equally well when
@@ -175,7 +186,7 @@
  * that do allow null elements are strongly encouraged <i>not</i> to
  * take advantage of the ability to insert nulls.  This is so because
  * {@code null} is used as a special return value by various methods
- * to indicated that the deque is empty.
+ * to indicate that the deque is empty.
  *
  * <p>{@code Deque} implementations generally do not define
  * element-based versions of the {@code equals} and {@code hashCode}
@@ -430,8 +441,8 @@
     /**
      * Retrieves and removes the head of the queue represented by this deque
      * (in other words, the first element of this deque).
-     * This method differs from {@link #poll poll} only in that it throws an
-     * exception if this deque is empty.
+     * This method differs from {@link #poll() poll()} only in that it
+     * throws an exception if this deque is empty.
      *
      * <p>This method is equivalent to {@link #removeFirst()}.
      *
@@ -477,6 +488,31 @@
      */
     E peek();
 
+    /**
+     * Adds all of the elements in the specified collection at the end
+     * of this deque, as if by calling {@link #addLast} on each one,
+     * in the order that they are returned by the collection's iterator.
+     *
+     * <p>When using a capacity-restricted deque, it is generally preferable
+     * to call {@link #offer(Object) offer} separately on each element.
+     *
+     * <p>An exception encountered while trying to add an element may result
+     * in only some of the elements having been successfully added when
+     * the associated exception is thrown.
+     *
+     * @param c the elements to be inserted into this deque
+     * @return {@code true} if this deque changed as a result of the call
+     * @throws IllegalStateException if not all the elements can be added at
+     *         this time due to insertion restrictions
+     * @throws ClassCastException if the class of an element of the specified
+     *         collection prevents it from being added to this deque
+     * @throws NullPointerException if the specified collection contains a
+     *         null element and this deque does not permit null elements,
+     *         or if the specified collection is null
+     * @throws IllegalArgumentException if some property of an element of the
+     *         specified collection prevents it from being added to this deque
+     */
+    boolean addAll(Collection<? extends E> c);
 
     // *** Stack methods ***
 
diff --git a/ojluni/src/main/java/java/util/Enumeration.java b/ojluni/src/main/java/java/util/Enumeration.java
index 8aebb5c..96aa3a9 100644
--- a/ojluni/src/main/java/java/util/Enumeration.java
+++ b/ojluni/src/main/java/java/util/Enumeration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
 /**
  * An object that implements the Enumeration interface generates a
  * series of elements, one at a time. Successive calls to the
- * <code>nextElement</code> method return successive elements of the
+ * {@code nextElement} method return successive elements of the
  * series.
  * <p>
- * For example, to print all elements of a <tt>Vector&lt;E&gt;</tt> <i>v</i>:
+ * For example, to print all elements of a {@code Vector<E>} <i>v</i>:
  * <pre>
  *   for (Enumeration&lt;E&gt; e = v.elements(); e.hasMoreElements();)
  *       System.out.println(e.nextElement());</pre>
@@ -39,12 +39,15 @@
  * Methods are provided to enumerate through the elements of a
  * vector, the keys of a hashtable, and the values in a hashtable.
  * Enumerations are also used to specify the input streams to a
- * <code>SequenceInputStream</code>.
- * <p>
- * NOTE: The functionality of this interface is duplicated by the Iterator
- * interface.  In addition, Iterator adds an optional remove operation, and
- * has shorter method names.  New implementations should consider using
- * Iterator in preference to Enumeration.
+ * {@code SequenceInputStream}.
+ *
+ * @apiNote
+ * The functionality of this interface is duplicated by the {@link Iterator}
+ * interface.  In addition, {@code Iterator} adds an optional remove operation,
+ * and has shorter method names.  New implementations should consider using
+ * {@code Iterator} in preference to {@code Enumeration}. It is possible to
+ * adapt an {@code Enumeration} to an {@code Iterator} by using the
+ * {@link #asIterator} method.
  *
  * @see     java.util.Iterator
  * @see     java.io.SequenceInputStream
@@ -56,15 +59,15 @@
  * @see     java.util.Vector#elements()
  *
  * @author  Lee Boynton
- * @since   JDK1.0
+ * @since   1.0
  */
 public interface Enumeration<E> {
     /**
      * Tests if this enumeration contains more elements.
      *
-     * @return  <code>true</code> if and only if this enumeration object
+     * @return  {@code true} if and only if this enumeration object
      *           contains at least one more element to provide;
-     *          <code>false</code> otherwise.
+     *          {@code false} otherwise.
      */
     boolean hasMoreElements();
 
@@ -76,4 +79,49 @@
      * @exception  NoSuchElementException  if no more elements exist.
      */
     E nextElement();
+
+    /**
+     * Returns an {@link Iterator} that traverses the remaining elements
+     * covered by this enumeration. Traversal is undefined if any methods
+     * are called on this enumeration after the call to {@code asIterator}.
+     *
+     * @apiNote
+     * This method is intended to help adapt code that produces
+     * {@code Enumeration} instances to code that consumes {@code Iterator}
+     * instances. For example, the {@link java.util.jar.JarFile#entries
+     * JarFile.entries()} method returns an {@code Enumeration<JarEntry>}.
+     * This can be turned into an {@code Iterator}, and then the
+     * {@code forEachRemaining()} method can be used:
+     *
+     * <pre>{@code
+     *     JarFile jarFile = ... ;
+     *     jarFile.entries().asIterator().forEachRemaining(entry -> { ... });
+     * }</pre>
+     *
+     * (Note that there is also a {@link java.util.jar.JarFile#stream
+     * JarFile.stream()} method that returns a {@code Stream} of entries,
+     * which may be more convenient in some cases.)
+     *
+     * @implSpec
+     * The default implementation returns an {@code Iterator} whose
+     * {@link Iterator#hasNext hasNext} method calls this Enumeration's
+     * {@code hasMoreElements} method, whose {@link Iterator#next next}
+     * method calls this Enumeration's {@code nextElement} method, and
+     * whose {@link Iterator#remove remove} method throws
+     * {@code UnsupportedOperationException}.
+     *
+     * @return an Iterator representing the remaining elements of this Enumeration
+     *
+     * @since 9
+     */
+    default Iterator<E> asIterator() {
+        return new Iterator<>() {
+            @Override public boolean hasNext() {
+                return hasMoreElements();
+            }
+            @Override public E next() {
+                return nextElement();
+            }
+        };
+    }
 }
diff --git a/ojluni/src/main/java/java/util/TreeMap.java b/ojluni/src/main/java/java/util/TreeMap.java
index 3359635..8768aab 100644
--- a/ojluni/src/main/java/java/util/TreeMap.java
+++ b/ojluni/src/main/java/java/util/TreeMap.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,7 +93,7 @@
  * associated map using {@code put}.)
  *
  * <p>This class is a member of the
- * <a href="{@docRoot}/../technotes/guides/collections/index.html">
+ * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
  * Java Collections Framework</a>.
  *
  * @param <K> the type of keys maintained by this map
@@ -199,8 +199,7 @@
         comparator = m.comparator();
         try {
             buildFromSorted(m.size(), m.entrySet().iterator(), null, null);
-        } catch (java.io.IOException cannotHappen) {
-        } catch (ClassNotFoundException cannotHappen) {
+        } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
         }
     }
 
@@ -319,8 +318,7 @@
                 try {
                     buildFromSorted(mapSize, map.entrySet().iterator(),
                                     null, null);
-                } catch (java.io.IOException cannotHappen) {
-                } catch (ClassNotFoundException cannotHappen) {
+                } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
                 }
                 return;
             }
@@ -645,8 +643,7 @@
         // Initialize clone with our mappings
         try {
             clone.buildFromSorted(size, entrySet().iterator(), null, null);
-        } catch (java.io.IOException cannotHappen) {
-        } catch (ClassNotFoundException cannotHappen) {
+        } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
         }
 
         return clone;
@@ -867,7 +864,7 @@
      * Returns a {@link Set} view of the mappings contained in this map.
      *
      * <p>The set's iterator returns the entries in ascending key order. The
-     * sets's spliterator is
+     * set's spliterator is
      * <em><a href="Spliterator.html#binding">late-binding</a></em>,
      * <em>fail-fast</em>, and additionally reports {@link Spliterator#SORTED} and
      * {@link Spliterator#ORDERED} with an encounter order that is ascending key
@@ -1055,7 +1052,7 @@
         }
 
         public Spliterator<V> spliterator() {
-            return new ValueSpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+            return new ValueSpliterator<>(TreeMap.this, null, null, 0, -1, 0);
         }
     }
 
@@ -1095,7 +1092,7 @@
         }
 
         public Spliterator<Map.Entry<K,V>> spliterator() {
-            return new EntrySpliterator<K,V>(TreeMap.this, null, null, 0, -1, 0);
+            return new EntrySpliterator<>(TreeMap.this, null, null, 0, -1, 0);
         }
     }
 
@@ -2462,8 +2459,7 @@
         s.writeInt(size);
 
         // Write out keys and values (alternating)
-        for (Iterator<Map.Entry<K,V>> i = entrySet().iterator(); i.hasNext(); ) {
-            Map.Entry<K,V> e = i.next();
+        for (Map.Entry<K, V> e : entrySet()) {
             s.writeObject(e.getKey());
             s.writeObject(e.getValue());
         }
@@ -2494,8 +2490,7 @@
     void addAllForTreeSet(SortedSet<? extends K> set, V defaultVal) {
         try {
             buildFromSorted(set.size(), set.iterator(), null, defaultVal);
-        } catch (java.io.IOException cannotHappen) {
-        } catch (ClassNotFoundException cannotHappen) {
+        } catch (java.io.IOException | ClassNotFoundException cannotHappen) {
         }
     }
 
@@ -2620,19 +2615,17 @@
     }
 
     /**
-     * Find the level down to which to assign all nodes BLACK.  This is the
-     * last `full' level of the complete binary tree produced by
-     * buildTree. The remaining nodes are colored RED. (This makes a `nice'
-     * set of color assignments wrt future insertions.) This level number is
+     * Finds the level down to which to assign all nodes BLACK.  This is the
+     * last `full' level of the complete binary tree produced by buildTree.
+     * The remaining nodes are colored RED. (This makes a `nice' set of
+     * color assignments wrt future insertions.) This level number is
      * computed by finding the number of splits needed to reach the zeroeth
-     * node.  (The answer is ~lg(N), but in any case must be computed by same
-     * quick O(lg(N)) loop.)
+     * node.
+     *
+     * @param size the (non-negative) number of keys in the tree to be built
      */
-    private static int computeRedLevel(int sz) {
-        int level = 0;
-        for (int m = sz - 1; m >= 0; m = m / 2 - 1)
-            level++;
-        return level;
+    private static int computeRedLevel(int size) {
+        return 31 - Integer.numberOfLeadingZeros(size + 1);
     }
 
     /**
@@ -2666,11 +2659,11 @@
     }
 
     final Spliterator<K> keySpliterator() {
-        return new KeySpliterator<K,V>(this, null, null, 0, -1, 0);
+        return new KeySpliterator<>(this, null, null, 0, -1, 0);
     }
 
     final Spliterator<K> descendingKeySpliterator() {
-        return new DescendingKeySpliterator<K,V>(this, null, null, 0, -2, 0);
+        return new DescendingKeySpliterator<>(this, null, null, 0, -2, 0);
     }
 
     /**
@@ -2682,7 +2675,7 @@
      * child, also serving as origin for the split-off spliterator.
      * Left-hands are symmetric. Descending versions place the origin
      * at the end and invert ascending split rules.  This base class
-     * is non-commital about directionality, or whether the top-level
+     * is non-committal about directionality, or whether the top-level
      * spliterator covers the whole tree. This means that the actual
      * split mechanics are located in subclasses. Some of the subclass
      * trySplit methods are identical (except for return types), but