On Thu, 17 Apr 2025 23:07:35 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 two > additional commits since the last revision: > > - 8354724: Increment copyright year in Reader > - 8354724: Move readString from BufferedReader to Reader A couple responses to previous comments: Optimization. I concur with @bplb here; the discussion of encodings and trying to avoid reallocation/copying and such really feels like premature optimization. Let's make sure we get the API and specs right first. Line-oriented methods on Reader instead of BufferedReader. In a sense it would be nice if the line-oriented stuff, which bottoms out at readLine(), were on Reader instead of on BufferedReader. I did an investigation of this a while back and concluded that this isn't possible, at least not compatibly. The reason is the way lines are defined by BufferedReader. Specifically: a line is terminated by a CR, an LF, or a CRLF. There's logic in readLine() that terminates the current line if a CR is encountered, and it _also_ sets a `skipLF` flag which skips the LF if it's the very next character. This is an instance field of BufferedReader. The problem is that if this were promoted to Reader, this would change the behavior of existing methods. Maybe somebody can come up with a clever way to avoid these behavior changes. Or, maybe we might decide this change is sufficiently compatible as to be acceptable. I thought about this for a while and concluded that we couldn't do this. But I could be convinced otherwise by sufficiently rigorous analysis. ------------- PR Comment: https://git.openjdk.org/jdk/pull/24728#issuecomment-2815902725