On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter <b...@openjdk.org> wrote:
>> Implement the requested methods and add a test thereof. > > Brian Burkhalter has updated the pull request incrementally with one > additional commit since the last revision: > > 8354724: Fix readAllChars gaffe in Reader returned by Readed.of and account > for it in test src/java.base/share/classes/java/io/Reader.java line 211: > 209: } > 210: > 211: public String readAllChars() throws IOException { Now that the method got renamed from `readString()` to `readAllChars()` I'd like to suggest that the return type should not be `String` anymore but `CharSequence`. This would open potential for more efficient implementations. For example, we can omit the final `.toString()` after `.subSequence()`, effectively preventing the *double* copy implied (the first copy already was created by `subSequence()`). *Iff* a caller essentially needs a `String` (for whatever reason), he can add a `.toString()` *in the calling code* easily. But unless that is the case, we should not *enforce* `String` for efficiency reasons. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2072360280