RFR: 8357286: (bf) Remove obsolete instanceof checks in CharBuffer.append

Alan Bateman alanb at openjdk.org
Wed Jun 11 08:42:30 UTC 2025


On Wed, 11 Jun 2025 00:38:51 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Remove some instanceof checks which are vestigial now that `CharSequence` itself defines `getChars(int,int,char[],int)`.

src/java.base/share/classes/java/nio/Heap-X-Buffer.java.template line 297:

> 295:         checkSession();
> 296: 
> 297:         Objects.checkFromToIndex(start, end, csq.length());

The append(CharSequence) methods are specified to append "null" when the CharSequence is null so append(null, 0, 0) will need to be handled here.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25739#discussion_r2139553057


More information about the nio-dev mailing list