Tidy up Android change markers

Follow-up to http://aosp/713925/

This commit contains changes made after an investigation into cases
where Android has added non-javadoc change marker comments between
javadoc and body declarations. In some cases it would make more sense
to put the change marker above the javadoc comment (e.g. where the
javadoc has been changed or the javadoc itself is an addition).

A short list was generated in ojluni using:
for i in `find . -name "*.java"`; do
  echo $i;
  sed -En '{N; /\*\/(\s+)\/\//{=;p} ; D}' $i;
done | less

... and the results manually inspected. Since it was manual there are
likely a few cases missed but the most obvious ones are contained here.

Methods with just signature changes were left as is so the change marker
is above the declaration.

The files changed were compared with upstream which revealed some other
unusual comments and the more obvious/trivial problems have been
addressed here too.

Bug: 111055375
Test: build
Change-Id: I53b392c85745ff1745f2df262b6729c0b334075f
diff --git a/ojluni/src/main/java/java/io/FileDescriptor.java b/ojluni/src/main/java/java/io/FileDescriptor.java
index a2c833d..ed3ebfe 100644
--- a/ojluni/src/main/java/java/io/FileDescriptor.java
+++ b/ojluni/src/main/java/java/io/FileDescriptor.java
@@ -46,9 +46,9 @@
  * @see     java.io.FileOutputStream
  * @since   JDK1.0
  */
-// Android-changed: Removed parent reference counting. Creator is responsible for closing
-// the file descriptor.
 public final class FileDescriptor {
+    // Android-changed: Removed parent reference counting. Creator is responsible for closing
+    // the file descriptor.
 
     // Android-changed: Renamed fd to descriptor to avoid issues with JNI/reflection
     // fetching the descriptor value.
@@ -206,10 +206,10 @@
     }
     // END Android-added: Methods to enable ownership enforcement of Unix file descriptors.
 
+    // Android-added: Needed for framework to test if it's a socket
     /**
      * @hide internal use only
      */
-    // Android-added: Needed for framework to test if it's a socket
     public boolean isSocket$() {
         return isSocket(descriptor);
     }
diff --git a/ojluni/src/main/java/java/io/InterruptedIOException.java b/ojluni/src/main/java/java/io/InterruptedIOException.java
index 25569dd..29b7c29 100644
--- a/ojluni/src/main/java/java/io/InterruptedIOException.java
+++ b/ojluni/src/main/java/java/io/InterruptedIOException.java
@@ -73,18 +73,18 @@
      */
     public int bytesTransferred = 0;
 
-    /** @hide */
     // Android-added: Additional constructor for internal use.
+    /** @hide */
     public InterruptedIOException(Throwable cause) {
         super(cause);
     }
 
+    // Android-added: Additional constructor for internal use.
     /**
      * Constructs a new instance with given detail message and cause.
      *
      * @hide internal use only
      */
-    // Android-added: Additional constructor for internal use.
     public InterruptedIOException(String detailMessage, Throwable cause) {
         super(detailMessage, cause);
     }
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index 2d16fc6..2e2af6a 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -282,11 +282,11 @@
     private volatile Interruptible blocker;
     private final Object blockerLock = new Object();
 
-    /** Set the blocker field
-     * @hide
-     */
     // Android-changed: Make blockedOn() @hide public, for internal use.
-    // Used by java.nio.channels.spi.AbstractInterruptibleChannel.
+    // Changed comment to reflect usage on Android
+    /* Set the blocker field; used by java.nio.channels.spi.AbstractInterruptibleChannel
+     */
+    /** @hide */
     public void blockedOn(Interruptible b) {
         synchronized (blockerLock) {
             blocker = b;
@@ -662,8 +662,8 @@
         init(group, null, name, 0);
     }
 
+    // BEGIN Android-added: Private constructor - used by the runtime.
     /** @hide */
-    // Android-added: Private constructor - used by the runtime.
     Thread(ThreadGroup group, String name, int priority, boolean daemon) {
         this.group = group;
         this.group.addUnstarted();
@@ -692,6 +692,8 @@
                     parent.inheritableThreadLocals);
         }
     }
+    // END Android-added: Private constructor - used by the runtime.
+
 
     /**
      * Allocates a new {@code Thread} object. This constructor has the same
@@ -1122,7 +1124,7 @@
     private native boolean isInterrupted(boolean ClearInterrupted);
     */
 
-    // Android-changed: Throw UnsupportedOperationException instead of NoSuchMethodError.
+    // BEGIN Android-changed: Throw UnsupportedOperationException instead of NoSuchMethodError.
     /**
      * Throws {@link UnsupportedOperationException}.
      *
@@ -1144,6 +1146,7 @@
     public void destroy() {
         throw new UnsupportedOperationException();
     }
+    // END Android-changed: Throw UnsupportedOperationException instead of NoSuchMethodError.
 
     /**
      * Tests if this thread is alive. A thread is alive if it has
@@ -2106,7 +2109,7 @@
         return defaultUncaughtExceptionHandler;
     }
 
-    // BEGIN Android-added: uncaughtExceptionPreHandler for use by platform.
+    // BEGIN Android-added: The concept of an uncaughtExceptionPreHandler for use by platform.
     // See http://b/29624607 for background information.
     // null unless explicitly set
     private static volatile UncaughtExceptionHandler uncaughtExceptionPreHandler;
@@ -2129,7 +2132,7 @@
     public static UncaughtExceptionHandler getUncaughtExceptionPreHandler() {
         return uncaughtExceptionPreHandler;
     }
-    // END Android-added: uncaughtExceptionPreHandler for use by platform.
+    // END Android-added: The concept of an uncaughtExceptionPreHandler for use by platform.
 
     /**
      * Returns the handler invoked when this thread abruptly terminates
diff --git a/ojluni/src/main/java/java/lang/ref/Reference.java b/ojluni/src/main/java/java/lang/ref/Reference.java
index cf8c8b5..e5126b5 100644
--- a/ojluni/src/main/java/java/lang/ref/Reference.java
+++ b/ojluni/src/main/java/java/lang/ref/Reference.java
@@ -38,10 +38,11 @@
  * @author   Mark Reinhold
  * @since    1.2
  */
-// BEGIN Android-changed: Reimplemented to accommodate a different GC and compiler.
-// ClassLinker knows about the fields of this class.
 
 public abstract class Reference<T> {
+    // BEGIN Android-changed: Reimplemented to accommodate a different GC and compiler.
+    // ClassLinker knows about the fields of this class.
+
     /**
      * Forces JNI path.
      * If GC is not in progress (ie: not going through slow path), the referent
diff --git a/ojluni/src/main/java/java/net/ServerSocket.java b/ojluni/src/main/java/java/net/ServerSocket.java
index bb495e6..444a84d 100644
--- a/ojluni/src/main/java/java/net/ServerSocket.java
+++ b/ojluni/src/main/java/java/net/ServerSocket.java
@@ -244,6 +244,7 @@
         }
     }
 
+    // Android-changed: Made getImpl() public and @hide, for internal use.
     /**
      * Get the {@code SocketImpl} attached to this socket, creating
      * it if necessary.
@@ -253,7 +254,6 @@
      * @since 1.4
      * @hide
      */
-    // Android-changed: Make ctor public and @hide, for internal use.
     public SocketImpl getImpl() throws SocketException {
         if (!created)
             createImpl();
diff --git a/ojluni/src/main/java/java/net/URI.java b/ojluni/src/main/java/java/net/URI.java
index f5a5112..ebba41b 100644
--- a/ojluni/src/main/java/java/net/URI.java
+++ b/ojluni/src/main/java/java/net/URI.java
@@ -44,6 +44,7 @@
 import java.lang.NullPointerException;  // for javadoc
 
 
+// Android-changed: Reformat @see links.
 /**
  * Represents a Uniform Resource Identifier (URI) reference.
  *
@@ -455,7 +456,7 @@
  * @see <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396: Uniform Resource Identifiers (URI): Generic Syntax</a>
  * @see <a href="http://www.ietf.org/rfc/rfc2732.txt">RFC&nbsp;2732: Format for Literal IPv6 Addresses in URLs</a>
  */
-// Android-changed: Reformat @see links.
+
 public final class URI
     implements Comparable<URI>, Serializable
 {
diff --git a/ojluni/src/main/java/java/nio/charset/Charset.java b/ojluni/src/main/java/java/nio/charset/Charset.java
index 31543f0..f5c097e 100755
--- a/ojluni/src/main/java/java/nio/charset/Charset.java
+++ b/ojluni/src/main/java/java/nio/charset/Charset.java
@@ -52,6 +52,7 @@
 import sun.security.action.GetPropertyAction;
 
 
+// Android-changed: Docs to say UTF-8 is always the platform default charset.
 /**
  * A named mapping between sequences of sixteen-bit Unicode <a
  * href="../../lang/Character.html#unicode">code units</a> and sequences of
@@ -318,8 +319,8 @@
         }
     }
 
-    /* The standard set of charsets */
     // Android-removed: We use ICU's list of standard charsets.
+    /* The standard set of charsets */
     // private static CharsetProvider standardProvider = new StandardCharsets();
 
     // Cache of the most-recently-returned charsets,
@@ -566,7 +567,7 @@
         throw new UnsupportedCharsetException(charsetName);
     }
 
-
+    // BEGIN Android-added: forNameUEE(String) method.
     /**
      * Equivalent to {@code forName} but only throws {@code UnsupportedEncodingException},
      * which is all pre-nio code claims to throw.
@@ -582,7 +583,7 @@
             throw ex;
         }
     }
-
+    // END Android-added: forNameUEE(String) method.
 
     // Fold charsets from the given iterator into the given map, ignoring
     // charsets whose names already have entries in the map.
diff --git a/ojluni/src/main/java/java/text/Collator.java b/ojluni/src/main/java/java/text/Collator.java
index ca3a220..15f43b7 100644
--- a/ojluni/src/main/java/java/text/Collator.java
+++ b/ojluni/src/main/java/java/text/Collator.java
@@ -226,14 +226,16 @@
      * @see java.util.Locale
      * @see java.util.ResourceBundle
      */
-    // Android-changed: Switched to ICU.
-    public static synchronized Collator getInstance(Locale desiredLocale)
-    {
-        if (desiredLocale == null) {
-            throw new NullPointerException("locale == null");
+    public static Collator getInstance(Locale desiredLocale) {
+        // BEGIN Android-changed: Switched to ICU.
+        synchronized(Collator.class) {
+            if (desiredLocale == null) {
+                throw new NullPointerException("locale == null");
+            }
+            return new RuleBasedCollator((android.icu.text.RuleBasedCollator)
+                    android.icu.text.Collator.getInstance(desiredLocale));
         }
-        return new RuleBasedCollator((android.icu.text.RuleBasedCollator)
-                android.icu.text.Collator.getInstance(desiredLocale));
+        // END Android-changed: Switched to ICU.
     }
 
     /**
@@ -386,7 +388,7 @@
         icuColl.setDecomposition(decompositionMode_Java_ICU(decompositionMode));
     }
 
-    // Android-changed: Removed references to CollatorProvider.
+    // Android-changed: Removed javadoc references to CollatorProvider.
     /**
      * Returns an array of all locales for which the
      * <code>getInstance</code> methods of this class can return
@@ -425,7 +427,7 @@
     }
     // END Android-added: conversion method for decompositionMode constants.
 
-    // Android-changed: improve documentation.
+    // Android-changed: improve clone() documentation.
     /**
      * Returns a new collator with the same decomposition mode and
      * strength value as this collator.
diff --git a/ojluni/src/main/java/java/util/Deque.java b/ojluni/src/main/java/java/util/Deque.java
index dbd3d6f..3d79952 100644
--- a/ojluni/src/main/java/java/util/Deque.java
+++ b/ojluni/src/main/java/java/util/Deque.java
@@ -187,9 +187,10 @@
  * @since  1.6
  * @param <E> the type of elements held in this deque
  */
-// Android-changed: fix framework docs link to "Collection#optional-restrictions"
-// Several occurrences of the link have been fixed throughout.
 public interface Deque<E> extends Queue<E> {
+    // Android-changed: fix framework docs link to "Collection#optional-restrictions"
+    // Several occurrences of the link have been fixed throughout.
+
     /**
      * Inserts the specified element at the front of this deque if it is
      * possible to do so immediately without violating capacity restrictions,
diff --git a/ojluni/src/main/java/java/util/prefs/FileSystemPreferences.java b/ojluni/src/main/java/java/util/prefs/FileSystemPreferences.java
index 17c50a8..b888c4d 100644
--- a/ojluni/src/main/java/java/util/prefs/FileSystemPreferences.java
+++ b/ojluni/src/main/java/java/util/prefs/FileSystemPreferences.java
@@ -34,6 +34,7 @@
 
 import sun.util.logging.PlatformLogger;
 
+// Android-changed: @hide.
 /**
  * Preferences implementation for Unix.  Preferences are stored in the file
  * system, with one directory per preferences node.  All of the preferences
@@ -50,7 +51,6 @@
  *
  * @hide
  */
-// Android-changed: @hide.
 public class FileSystemPreferences extends AbstractPreferences {
     /**
      * Returns logger for error messages. Backing store exceptions are logged at
diff --git a/ojluni/src/main/java/sun/reflect/CallerSensitive.java b/ojluni/src/main/java/sun/reflect/CallerSensitive.java
index 0c78da0..41d6fd4 100644
--- a/ojluni/src/main/java/sun/reflect/CallerSensitive.java
+++ b/ojluni/src/main/java/sun/reflect/CallerSensitive.java
@@ -28,6 +28,7 @@
 import java.lang.annotation.*;
 import static java.lang.annotation.ElementType.*;
 
+// Android-added: @hide; CallerSensitive is used in source but not part of the public API
 /**
  * A method annotated @CallerSensitive is sensitive to its calling class,
  * via {@link sun.reflect.Reflection#getCallerClass Reflection.getCallerClass},
@@ -37,7 +38,6 @@
  *
  * @hide
  */
-// Android-added @hide
 @Retention(RetentionPolicy.RUNTIME)
 @Target({METHOD})
 public @interface CallerSensitive {