JDK-8219118 : (bf spec) CharBuffer.chars() should make it clearer that the sequence starts from the buffer position
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 13
  • Submitted: 2019-02-15
  • Updated: 2019-02-16
  • Resolved: 2019-02-16
Related Reports
CSR :  
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]
```


Comments
Moving to Approved.
16-02-2019