Merge "OpenJDK 11: Merging in / Deprecating java.util.Oberver/Observable"
diff --git a/api/current.txt b/api/current.txt
index 3c39c6e..218dce1 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -13482,21 +13482,21 @@
     method @NonNull public static String toString(@Nullable Object, @NonNull String);
   }
 
-  public class Observable {
-    ctor public Observable();
-    method public void addObserver(java.util.Observer);
-    method protected void clearChanged();
-    method public int countObservers();
-    method public void deleteObserver(java.util.Observer);
-    method public void deleteObservers();
-    method public boolean hasChanged();
-    method public void notifyObservers();
-    method public void notifyObservers(Object);
-    method protected void setChanged();
+  @Deprecated public class Observable {
+    ctor @Deprecated public Observable();
+    method @Deprecated public void addObserver(java.util.Observer);
+    method @Deprecated protected void clearChanged();
+    method @Deprecated public int countObservers();
+    method @Deprecated public void deleteObserver(java.util.Observer);
+    method @Deprecated public void deleteObservers();
+    method @Deprecated public boolean hasChanged();
+    method @Deprecated public void notifyObservers();
+    method @Deprecated public void notifyObservers(Object);
+    method @Deprecated protected void setChanged();
   }
 
-  public interface Observer {
-    method public void update(java.util.Observable, Object);
+  @Deprecated public interface Observer {
+    method @Deprecated public void update(java.util.Observable, Object);
   }
 
   public final class Optional<T> {
diff --git a/ojluni/src/main/java/java/util/Observable.java b/ojluni/src/main/java/java/util/Observable.java
index be01640..65e3995 100644
--- a/ojluni/src/main/java/java/util/Observable.java
+++ b/ojluni/src/main/java/java/util/Observable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
  * 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,11 @@
  * object that the application wants to have observed.
  * <p>
  * An observable object can have one or more observers. An observer
- * may be any object that implements interface <tt>Observer</tt>. After an
+ * may be any object that implements interface {@code Observer}. After an
  * observable instance changes, an application calling the
- * <code>Observable</code>'s <code>notifyObservers</code> method
+ * {@code Observable}'s {@code notifyObservers} method
  * causes all of its observers to be notified of the change by a call
- * to their <code>update</code> method.
+ * to their {@code update} method.
  * <p>
  * The order in which notifications will be delivered is unspecified.
  * The default implementation provided in the Observable class will
@@ -45,20 +45,34 @@
  * subclass follows this order, as they choose.
  * <p>
  * Note that this notification mechanism has nothing to do with threads
- * and is completely separate from the <tt>wait</tt> and <tt>notify</tt>
- * mechanism of class <tt>Object</tt>.
+ * and is completely separate from the {@code wait} and {@code notify}
+ * mechanism of class {@code Object}.
  * <p>
  * When an observable object is newly created, its set of observers is
  * empty. Two observers are considered the same if and only if the
- * <tt>equals</tt> method returns true for them.
+ * {@code equals} method returns true for them.
  *
  * @author  Chris Warth
  * @see     java.util.Observable#notifyObservers()
  * @see     java.util.Observable#notifyObservers(java.lang.Object)
  * @see     java.util.Observer
  * @see     java.util.Observer#update(java.util.Observable, java.lang.Object)
- * @since   JDK1.0
+ * @since   1.0
+ *
+ * @deprecated
+ * This class and the {@link Observer} interface have been deprecated.
+ * The event model supported by {@code Observer} and {@code Observable}
+ * is quite limited, the order of notifications delivered by
+ * {@code Observable} is unspecified, and state changes are not in
+ * one-for-one correspondence with notifications.
+ * For a richer event model, consider using the
+ * {@link java.beans} package.  For reliable and ordered
+ * messaging among threads, consider using one of the concurrent data
+ * structures in the {@link java.util.concurrent} package.
+ * For reactive streams style programming, see the
+ * {@link java.util.concurrent.Flow} API.
  */
+@Deprecated(since="9")
 public class Observable {
     private boolean changed = false;
     private Vector<Observer> obs;
@@ -88,7 +102,7 @@
 
     /**
      * Deletes an observer from the set of observers of this object.
-     * Passing <CODE>null</CODE> to this method will have no effect.
+     * Passing {@code null} to this method will have no effect.
      * @param   o   the observer to be deleted.
      */
     public synchronized void deleteObserver(Observer o) {
@@ -97,15 +111,15 @@
 
     /**
      * If this object has changed, as indicated by the
-     * <code>hasChanged</code> method, then notify all of its observers
-     * and then call the <code>clearChanged</code> method to
+     * {@code hasChanged} method, then notify all of its observers
+     * and then call the {@code clearChanged} method to
      * indicate that this object has no longer changed.
      * <p>
-     * Each observer has its <code>update</code> method called with two
-     * arguments: this observable object and <code>null</code>. In other
+     * Each observer has its {@code update} method called with two
+     * arguments: this observable object and {@code null}. In other
      * words, this method is equivalent to:
-     * <blockquote><tt>
-     * notifyObservers(null)</tt></blockquote>
+     * <blockquote>{@code
+     * notifyObservers(null)}</blockquote>
      *
      * @see     java.util.Observable#clearChanged()
      * @see     java.util.Observable#hasChanged()
@@ -117,12 +131,12 @@
 
     /**
      * If this object has changed, as indicated by the
-     * <code>hasChanged</code> method, then notify all of its observers
-     * and then call the <code>clearChanged</code> method to indicate
+     * {@code hasChanged} method, then notify all of its observers
+     * and then call the {@code clearChanged} method to indicate
      * that this object has no longer changed.
      * <p>
-     * Each observer has its <code>update</code> method called with two
-     * arguments: this observable object and the <code>arg</code> argument.
+     * Each observer has its {@code update} method called with two
+     * arguments: this observable object and the {@code arg} argument.
      *
      * @param   arg   any object.
      * @see     java.util.Observable#clearChanged()
@@ -171,8 +185,8 @@
     }
 
     /**
-     * Marks this <tt>Observable</tt> object as having been changed; the
-     * <tt>hasChanged</tt> method will now return <tt>true</tt>.
+     * Marks this {@code Observable} object as having been changed; the
+     * {@code hasChanged} method will now return {@code true}.
      */
     protected synchronized void setChanged() {
         changed = true;
@@ -181,9 +195,9 @@
     /**
      * Indicates that this object has no longer changed, or that it has
      * already notified all of its observers of its most recent change,
-     * so that the <tt>hasChanged</tt> method will now return <tt>false</tt>.
+     * so that the {@code hasChanged} method will now return {@code false}.
      * This method is called automatically by the
-     * <code>notifyObservers</code> methods.
+     * {@code notifyObservers} methods.
      *
      * @see     java.util.Observable#notifyObservers()
      * @see     java.util.Observable#notifyObservers(java.lang.Object)
@@ -195,10 +209,10 @@
     /**
      * Tests if this object has changed.
      *
-     * @return  <code>true</code> if and only if the <code>setChanged</code>
+     * @return  {@code true} if and only if the {@code setChanged}
      *          method has been called more recently than the
-     *          <code>clearChanged</code> method on this object;
-     *          <code>false</code> otherwise.
+     *          {@code clearChanged} method on this object;
+     *          {@code false} otherwise.
      * @see     java.util.Observable#clearChanged()
      * @see     java.util.Observable#setChanged()
      */
@@ -207,7 +221,7 @@
     }
 
     /**
-     * Returns the number of observers of this <tt>Observable</tt> object.
+     * Returns the number of observers of this {@code Observable} object.
      *
      * @return  the number of observers of this object.
      */
diff --git a/ojluni/src/main/java/java/util/Observer.java b/ojluni/src/main/java/java/util/Observer.java
index ef64e14..47f7933 100644
--- a/ojluni/src/main/java/java/util/Observer.java
+++ b/ojluni/src/main/java/java/util/Observer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 1998, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,22 +25,27 @@
 package java.util;
 
 /**
- * A class can implement the <code>Observer</code> interface when it
+ * A class can implement the {@code Observer} interface when it
  * wants to be informed of changes in observable objects.
  *
  * @author  Chris Warth
  * @see     java.util.Observable
- * @since   JDK1.0
+ * @since   1.0
+ *
+ * @deprecated
+ * This interface has been deprecated. See the {@link Observable}
+ * class for further information.
  */
+@Deprecated(since="9")
 public interface Observer {
     /**
      * This method is called whenever the observed object is changed. An
-     * application calls an <tt>Observable</tt> object's
-     * <code>notifyObservers</code> method to have all the object's
+     * application calls an {@code Observable} object's
+     * {@code notifyObservers} method to have all the object's
      * observers notified of the change.
      *
      * @param   o     the observable object.
-     * @param   arg   an argument passed to the <code>notifyObservers</code>
+     * @param   arg   an argument passed to the {@code notifyObservers}
      *                 method.
      */
     void update(Observable o, Object arg);