Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8259638

(bf spec) Clarify byte order of the buffer returned by CharBuffer.subsequence(int,int)

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal

      Description

      Summary

      This CSR relates to JDK-8257212: (bf spec) Clarify byte order of the buffer returned by CharBuffer.subsequence(int,int). CharBuffer::subSequence documentation has been updated to reflect behavior such that when CharBuffer::subSequence is called, "its byte order will be identical to that of this buffer" where this buffer is the the original buffer subSequence is being called on.

      Problem

      While the behavior of CharBuffer::subSequence is already well documented as well as the API documentation implying that the Byte Order of a buffer after subSequence has been called on it will be the same as the original buffer, this was not explicitly defined in the method description.

      Solution

      The text "...and its byte order will be identical to that of this buffer" was added to the method to clearly indicate that the Byte Order of the previous buffer will be preserved in the returned CharBuffer. See the attached specdiff for details.

      Specification

      Specdiff for the above solution...

      --- a/src/java.base/share/classes/java/nio/X-Buffer.java.template
      +++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template
      @@ -1835,9 +1835,10 @@ public abstract class $Type$Buffer
            * content of this buffer is mutable then modifications to one buffer will
            * cause the other to be modified.  The new buffer's capacity will be that
            * of this buffer, its position will be
      -     * {@code position()} + {@code start}, and its limit will be
      -     * {@code position()} + {@code end}.  The new buffer will be
      -     * direct if, and only if, this buffer is direct, and it will be read-only
      +     * {@code position()} + {@code start}, its limit will be
      +     * {@code position()} + {@code end}, and its byte order
      +     * will be identical to that of this buffer. The new buffer will be direct
      +     * if, and only if, this buffer is direct, and it will be read-only
            * if, and only if, this buffer is read-only.  </p>
            *
            * @param  start

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ccleary Conor Cleary (Inactive)
              Reporter:
              chegar Chris Hegarty
              Reviewed By:
              Brian Burkhalter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: