Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-28 Thread Jaikiran Pai
On Tue, 20 May 2025 17:32:03 GMT, Brian Burkhalter wrote: >> I see this has been changed to "then some characters, but not all" but it >> doesn't flow very well. The original sentence, which was copied/modified >> from InputStream.readAllBytes, is much cleaner and I think I would prefer to >>

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-20 Thread Brian Burkhalter
On Mon, 19 May 2025 07:15:00 GMT, Alan Bateman wrote: >> Thank you Brian, the updated text for this section looks good to me. Once >> this PR gets integrated, I'll go through the Files.readXXX methods and file >> an issue to have that text simplified too. > > I see this has been changed to "th

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-19 Thread Jaikiran Pai
On Fri, 16 May 2025 18:37:38 GMT, Brian Burkhalter wrote: >> src/java.base/share/classes/java/io/Reader.java line 478: >> >>> 476: * >>> 477: * If an I/O error occurs reading from the stream, then it >>> 478: * may do so after some, but not all, characters have been read. >> >>

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-19 Thread Alan Bateman
On Mon, 19 May 2025 06:59:58 GMT, Jaikiran Pai wrote: >>> I read this sentence a couple of times [...] >> >> Please see >> [a86610d](https://github.com/openjdk/jdk/pull/24728/commits/a86610d06169445a5c4b81a0c60527130a45e045). >> >>> I suspect that sentence was motivated from similar existing t

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Markus KARG
On Fri, 16 May 2025 20:00:53 GMT, Roger Riggs wrote: >> This API is concerned with the "what" and not so much the "how." > > The purpose of Reader and subclasses is to normalize characters in various > forms (char arrays, byte streams, char buffers, etc) into a coherent stream > of characters a

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Roger Riggs
On Thu, 15 May 2025 20:34:13 GMT, Brian Burkhalter wrote: >> @stuart-marks Sorry, didn't want to pull you in here, that's why I said, I >> am just *paraphrasing*. >> >> That is correct, it is a different case, but the *final effect* for the >> caller is the same: If he needs to now whether a c

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Brian Burkhalter
On Fri, 16 May 2025 18:21:10 GMT, Brian Burkhalter wrote: >> src/java.base/share/classes/java/io/Reader.java line 478: >> >>> 476: * >>> 477: * If an I/O error occurs reading from the stream, then it >>> 478: * may do so after some, but not all, characters have been read. >> >>

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Brian Burkhalter
On Fri, 16 May 2025 07:57:01 GMT, Jaikiran Pai wrote: > I read this sentence a couple of times [...] Please see [a86610d](https://github.com/openjdk/jdk/pull/24728/commits/a86610d06169445a5c4b81a0c60527130a45e045). > I suspect that sentence was motivated from similar existing text in > `Files

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Brian Burkhalter
On Fri, 16 May 2025 18:13:45 GMT, Roger Riggs wrote: > Is this better? I think it is clearer. - PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2093501372

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Roger Riggs
On Wed, 14 May 2025 18:16:22 GMT, Brian Burkhalter 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: Replace getChars in previous commit with subS

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-16 Thread Jaikiran Pai
On Wed, 14 May 2025 18:16:22 GMT, Brian Burkhalter 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: Replace getChars in previous commit with subS

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-15 Thread Brian Burkhalter
On Thu, 15 May 2025 05:53:44 GMT, Markus KARG wrote: >> @mkarg Please don't invoke my name to try to buttress your arguments. The >> calls the Reader.of() instance makes on its backing CharSequence is a >> different kind of issue from what promises or guarantees the concrete >> methods of the

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Markus KARG
On Wed, 14 May 2025 22:19:39 GMT, Stuart Marks wrote: >> I meant that the implementation of `subSequence` *might or might not* >> perform copy (so we need to tell the javaDoc reader), while `getChar` >> *clearly* performs a copy as part of it design. So `subSequence` can be >> surprising as th

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Stuart Marks
On Wed, 14 May 2025 21:02:20 GMT, Markus KARG wrote: >> Both `subSequence` and `getChars` are implemented by the CharSequence. >> They have the same level of trustworthiness about their implementation. > > I meant that the implementation of `subSequence` *might or might not* perform > copy (so w

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Markus KARG
On Wed, 14 May 2025 20:58:47 GMT, Roger Riggs wrote: >> BTW, paraphrasing Stuart here: "We want to reduce self-calls". `subSequence` >> is a self-call, *as we do not know* how it behaves in the actual >> implementation. For `getChars` we can be sure that it has no overridable >> side effects.

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Roger Riggs
On Wed, 14 May 2025 20:36:47 GMT, Markus KARG wrote: >> Actually I am working on exact these optimizations right now and do not like >> the idea that I have to file another JBS and PR just for a single code line. >> As `subSequence` typically *does* a copy (to not hold the original full text >

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Markus KARG
On Wed, 14 May 2025 20:32:38 GMT, Markus KARG wrote: >> I have no idea whether `subSequence` is more performant than `getChars` but >> it seems cleaner. In any case, at this point we are concerned primarily with >> the APIs getting into JDK 25. We can improve performance after that. > > Actuall

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Markus KARG
On Wed, 14 May 2025 20:14:21 GMT, Brian Burkhalter wrote: >> I think this may be a good way to reduce redundant allocation if the >> CharSequence's subsequence is a simple view (frequently the case for user >> ones) or a String (for StringBuilder, String) > > I have no idea whether `subSequence

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Brian Burkhalter
On Wed, 14 May 2025 20:00:50 GMT, Chen Liang wrote: >> src/java.base/share/classes/java/io/Reader.java line 206: >> >>> 204: ensureOpen(); >>> 205: int len = cs.length(); >>> 206: String result = cs.subSequence(next, len).toString(); >> >> Are you

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Chen Liang
On Wed, 14 May 2025 19:44:56 GMT, Markus KARG wrote: >> Brian Burkhalter has updated the pull request incrementally with one >> additional commit since the last revision: >> >> 8354724: Replace getChars in previous commit with subSequence > > src/java.base/share/classes/java/io/Reader.java li

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Markus KARG
On Wed, 14 May 2025 18:16:22 GMT, Brian Burkhalter 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: Replace getChars in previous commit with subS

Re: RFR: 8354724: Methods in java.io.Reader to read all characters and all lines [v22]

2025-05-14 Thread Brian Burkhalter
> 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: Replace getChars in previous commit with subSequence - Changes: - all: https://git.openjdk.org/jdk/