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

(bf spec) CharBuffer.chars() should make it clearer that the sequence starts from the buffer position

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Update to javadoc supporting existing behavior so no compatibility risk.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Clarify the java.nio.CharBuffer specification to state that all implemented java.lang.CharSequence methods operate relative to the current buffer position.

      Problem

      CharBuffer implements a couple of CharSequence methods, chars() and codePoints(), but does not document that they operate with respect to the current buffer position as it does for the other overridden CharSequence methods.

      Solution

      Add a sentence to the class level specification clarifying that all implemented CharSequence methods operate with respect to the current buffer position.

      Specification

      --- a/src/java.base/share/classes/java/nio/X-Buffer.java.template
      +++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template
      @@ -209,6 +209,8 @@
        * <p> This class implements the {@link CharSequence} interface so that
        * character buffers may be used wherever character sequences are accepted, for
        * example in the regular-expression package {@link java.util.regex}.
      + * The methods defined by {@code CharSequence} operate relative to the current
      + * position of the buffer when they are invoked.
        * </p>
        *
       #end[char]

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              dbessono Dmitry Bessonov
              Reviewed By:
              Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: