The specification of CharBuffer [1] states:
"The methods defined by CharSequence operate relative to the current position of the buffer when they are invoked."
The method CharBuffer.getChars [2] is however specified to be an
"Absolute bulk get method. "
and interprets the source index parameters to be absolute. The implementation is consistent with this.
To adhere to the previously existing specification, the getChars method should be specified to be a
"Relative bulk get method. "
and the implementation modified accordingly.
[1] https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/nio/CharBuffer.html
[2] https://download.java.net/java/early_access/jdk25/docs/api/java.base/java/nio/CharBuffer.html#getChars(int,int,char%5B%5D,int)
"The methods defined by CharSequence operate relative to the current position of the buffer when they are invoked."
The method CharBuffer.getChars [2] is however specified to be an
"Absolute bulk get method. "
and interprets the source index parameters to be absolute. The implementation is consistent with this.
To adhere to the previously existing specification, the getChars method should be specified to be a
"Relative bulk get method. "
and the implementation modified accordingly.
[1] https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/nio/CharBuffer.html
[2] https://download.java.net/java/early_access/jdk25/docs/api/java.base/java/nio/CharBuffer.html#getChars(int,int,char%5B%5D,int)
- caused by
-
JDK-8343110 Add getChars(int, int, char[], int) to CharSequence and CharBuffer
-
- Resolved
-
- csr for
-
JDK-8361308 (bf) CharBuffer.getChars(int,int,char[],int) violates pre-existing specification
-
- Closed
-
- links to
-
Review(master) openjdk/jdk/26104