Verify java.nio.{Char,Double,Float,Int,Long,Short}Buffer.

After this CL, these classes are verified against upstream
OpenJDK8u121-b13. This CL reverts some Android changes
in those classes and adopts upstream changes that were forgotten
in the update from OpenJDK 8u60 to 8u121-b13.

There are two behavior changes in this CL:
 - Change in behavior of DoubleBuffer.compareTo(), which didn't
   previously match documentation. A unit test is added.
 - Change in behavior for bulk put() when both ReadOnlyBuffer
   and BufferOverflow are encountered.

ByteBuffer is handled by separate CLs.

Detailed list of changes follows.

All classes
 - Adopt upstream code for early check for readonly buffer
   during bulk put().
   This integrates the upstream fix for JDK-7199551 in OpenJDK8u61,
   which had been forgotten in the update from 8u60 to 8u121-b13.
   This changes behavior only for the case where a put() failed for
   multiple reasons, eg. a read-only buffer that also didn't have
   enough space; before this CL, this could have thrown
   BufferOverflowException but will now throw ReadOnlyBufferException.

   This behavior change is not covered by tests; this CL does
   not add such tests, since the documentation doesn't specify
   either behavior and it appears unlikely to affect apps.

CharBuffer
 - Adopt upstream formatting of documentation for get(char[]).
 - put() had Android changes for ReadOnlyBuffer and
   BufferOverflow checks, but OpenJDK8u121-13 had nearly identical
   checks. This CL reverts the Android changes and adopts upstream's
   version.
 - Revert an unexplained difference in chars() to match the version
   from 8u60 and 8u121-b13. The version before this CL had been
   introduced by commit 5458546631c65f6d375b6a1780d36d0abb5b95af
   which didn't say whether / from which upstream commit it came.
   I didn't check whether that other version matched 7u40 or some
   other upstream revision because I don't have the generated files
   for those readily available and it seemed unimportant.

DoubleBuffer
 - Revert Android change around using Double.compare() instead of
   DoubleBuffer.compare(). A comment from commit
   b304b288d1deafd07ee13e1540acc0a22db07736 suggests that the aim
   of the change was to avoid "duplicating code pointlessly", but
   the documentation for DoubleBuffer.compareTo() explicitly lists
   some differences from Double.compare() that the changed code was
   not consistent with.
   Since Android has kept similar differences between Float.compare()
   vs. FloatBuffer.compareTo(), this CL reverts the Android change in
   DoubleBuffer.compareTo().

   This CL adds a unit tests for the changed behavior, which is
   consistent with the documentation.

Test: CtsLibcoreTestCases
Test: DoubleBufferTest.testCompareTo_positiveAndNegativeZero()
   fails when run against Android 7.1.1.
Bug: 35910877
Change-Id: I5167d9da54aaad63778f8519d23222dda14a87ca
7 files changed