On Wed, 9 Oct 2024 06:57:38 GMT, Alan Bateman wrote:
>> Reader.of(CharSequence) looks much better than introducing
>> CharSequenceReader. It won't have an equivalent on Writer but I think that
>> is okay. Also it means that the user will need to deal with close throwing
>> IOException but anyt
On Wed, 9 Oct 2024 07:51:31 GMT, Jaikiran Pai wrote:
> In a different discussion, I have been told previously that the title of the
> CSR and the JBS issue for which the CSR is created, should match. I think we
> should change the title of https://bugs.openjdk.org/browse/JDK-8341566 to
> match
On Wed, 9 Oct 2024 05:50:18 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Wed, 9 Oct 2024 05:50:18 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Wed, 9 Oct 2024 05:50:18 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Wed, 9 Oct 2024 05:50:18 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Wed, 9 Oct 2024 06:57:38 GMT, Alan Bateman wrote:
> > @AlanBateman Can you please review [the CSR
> > request](https://bugs.openjdk.org/browse/JDK-8341596) so I can finish it?
> > Thanks!
>
> Latest API docs looks good, will you update the CSR?
Done. I have replaced the "Specification" sec
On Wed, 9 Oct 2024 06:59:25 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 182:
>>
>>> 180: private void ensureOpen() throws IOException {
>>> 181: if (isClosed)
>>> 182: throw new IOException("Stream closed");
>>
On Wed, 9 Oct 2024 06:43:14 GMT, Jaikiran Pai wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> Improved wording: 'If the sequence changes while the reader is open, e.g.
>> the length changes, the behavior is undefin
On Sun, 6 Oct 2024 13:14:32 GMT, Alan Bateman wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized impleme
On Wed, 9 Oct 2024 05:50:18 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Wed, 9 Oct 2024 05:30:58 GMT, Alan Bateman wrote:
>> I have updated the source code so that it looks up `cs.length()` live each
>> time. Nevertheless, this does not necessarily imply any predictable outcome
>> due to the natur of an interface: Custom implementations could concurrently
>> re
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementation of a `Reader` for each kind of
> `CharSequence` im
On Tue, 8 Oct 2024 17:38:14 GMT, Markus KARG wrote:
>>> @AlanBateman WDYT?
>>
>> It's good question as a CharSequence's length can change over time, e.g.
>> StringBuilder. This scenario comes up regularly with InputStreams and
>> Readers connected to files as the file may be growing and shrink
On Tue, 8 Oct 2024 13:23:23 GMT, Alan Bateman wrote:
>> For `chars()` or `codePoints()`, I believe calling `length()` or not was a
>> matter of implementation convenience instead of the assumption that
>> `length()` can change during calls. Note implementation methods in the
>> anonymous class
On Tue, 8 Oct 2024 12:38:10 GMT, Chen Liang wrote:
>> IIUC I shall just remove the `` but keep the text `After the reader...`?
>
> Yep. Better keep everything about closing in the same paragraph.
Done.
-
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r17922598
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementation of a `Reader` for each kind of
> `CharSequence` im
On Tue, 8 Oct 2024 12:58:17 GMT, Chen Liang wrote:
>>> I cannot image any scenario where such a program would result in useful
>>> outcome.
>>
>> An additional point of reference is the current default implementation of
>> CharSequence's `public default IntStream chars()`, which returns an
>
On Tue, 8 Oct 2024 12:46:42 GMT, Jaikiran Pai wrote:
>>> The question is: Would that make any sense in the end?
>>
>> Consider the example of `StringBuffer`, which is a `CharSequence`. Wouldn't
>> something like the following be a logical use of `Reader.of(CharSequence)`,
>> where you create a
On Tue, 8 Oct 2024 12:32:00 GMT, Jaikiran Pai wrote:
>> I would treat this specific scenario as one of the "no concurrent usage"
>> examples. Note that by this principle, mutable objects like `StringBuilder`
>> should not override object comparison methods as these states can change,
>> but th
On Tue, 8 Oct 2024 11:59:03 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 155:
>>
>>> 153: * have no effect.
>>> 154: *
>>> 155: * After the reader has been closed, the {@code read()},
>>
>> The API docs in 5cbc0450 looks okay. One minor comment
On Tue, 8 Oct 2024 12:30:03 GMT, Chen Liang wrote:
>> As the anonymous class MUST NOT be used with multiple threads, I always have
>> seen the `CharSequence` as *fixed/static* text in the moment the `Reader` is
>> getting used. But indeed, technically one could interleave `Reader::read()`
>> i
On Tue, 8 Oct 2024 12:08:06 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 174:
>>
>>> 172:
>>> 173: return new Reader() {
>>> 174: private final int length = cs.length();
>>
>> Hello Markus, as far as I can see, a `CharSequence` is allowed
On Tue, 8 Oct 2024 06:48:59 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 154:
>>
>>> 152: * have no effect.
>>> 153: *
>>> 154: * After the reader has been closed, the {@code read()},
>>
>> This paragraph is okay but the Reader methods should r
On Tue, 8 Oct 2024 11:54:28 GMT, Jaikiran Pai wrote:
>> Markus KARG has updated the pull request incrementally with six additional
>> commits since the last revision:
>>
>> - renamed source to cs; cs is final; close sets boolean; no adouble
>> reference to source
>> - Fixed Typo: 'resect' ->
On Tue, 8 Oct 2024 11:38:12 GMT, Alan Bateman wrote:
>> Markus KARG has updated the pull request incrementally with six additional
>> commits since the last revision:
>>
>> - renamed source to cs; cs is final; close sets boolean; no adouble
>> reference to source
>> - Fixed Typo: 'resect' ->
On Tue, 8 Oct 2024 11:23:42 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Tue, 8 Oct 2024 11:23:42 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Mon, 7 Oct 2024 04:43:49 GMT, Chen Liang wrote:
>> src/java.base/share/classes/java/io/Reader.java line 203:
>>
>>> 201: int n = Math.min(length - next, len);
>>> 202: switch (cs) {
>>> 203: case String s -> s.getChars(next, next + n, cbuf,
On Sun, 6 Oct 2024 18:13:14 GMT, Bernd wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Dropping non-public JavaDocs
>
> test/jdk/java/io/Reader/Of.java line 63:
>
>> 61: @Tes
On Mon, 7 Oct 2024 07:39:16 GMT, Alan Bateman wrote:
>> I do not see what is "confusing" in that case, as the caller still gets what
>> he intends: a reader for the passed source. I also wonder how likely that
>> case actually is. Anyways, I may be biased as I proposed `of`.
>>
>> @AlanBateman
On Mon, 7 Oct 2024 19:44:12 GMT, Chen Liang wrote:
>> I really do see you point, nevertheless I think we should be kind to "bad"
>> users, too. In the end, there is *no* specification which explicitly tells
>> "bad" users that readers are support to be short-living (despite it being
>> rather
On Sun, 6 Oct 2024 18:10:49 GMT, Bernd wrote:
>> Good idea. But instead, we could also add a new API
>> `CharSequence.of(char[])` and test *that* class? WDYT?
>
>> Good idea. But instead, we could also add a new API
>> `CharSequence.of(char[])` and test _that_ class? WDYT?
>
> Both you need to
On Sun, 6 Oct 2024 18:25:15 GMT, Bernd wrote:
>> src/java.base/share/classes/java/io/Reader.java line 231:
>>
>>> 229: public boolean ready() throws IOException {
>>> 230: ensureOpen();
>>> 231: return true;
>>
>> I guess it’s not wrong, but can this
On Mon, 7 Oct 2024 04:44:43 GMT, Chen Liang wrote:
>> src/java.base/share/classes/java/io/Reader.java line 172:
>>
>>> 170: Objects.requireNonNull(source);
>>> 171:
>>> 172: return new Reader() {
>>
>> Maybe make this into a package‑private `CharSequenceReader` so that
>> [`St
On Sun, 6 Oct 2024 17:56:03 GMT, Bernd wrote:
>> This is not wrong. This exact wording is already used in `Reader.java`, so
>> it would be strange to change it *just here*.
>
> You can “elaborately” the close and mark protocol in the Reader interface and
> then only mention itnadgeres to it her
On Sun, 6 Oct 2024 18:12:33 GMT, Alan Bateman wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Dropping non-public JavaDocs
>
> src/java.base/share/classes/java/io/Reader.java line
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementation of a `Reader` for each kind of
> `CharSequence` im
On Mon, 7 Oct 2024 17:39:33 GMT, Markus KARG wrote:
>>> keep the reference to the char sequence "forever"
>>
>> Note that this only happens if the `Reader` instance is kept forever; but a
>> `Reader` is supposed to be used and closed and discarded instead of being
>> held indefinitely after cl
On Mon, 7 Oct 2024 16:06:08 GMT, Chen Liang wrote:
>> This is correct, but then we would keep the reference to the char sequence
>> "forever", without any good reason. This content could be *huge* (and often
>> it is, as `CharSequence` most often is a `StringBuilder` just because the
>> applic
On Sun, 6 Oct 2024 17:23:51 GMT, Markus KARG wrote:
> keep the reference to the char sequence "forever"
Note that this only happens if the `Reader` instance is kept forever; but a
`Reader` is supposed to be used and closed and discarded instead of being held
indefinitely after closing. If user
On Sun, 6 Oct 2024 14:50:48 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 174:
>>
>>> 172: * @since 24
>>> 173: */
>>> 174: public static Reader of(CharSequence c) {
>>
>> Should we give this factory a more specific name so we don't clash in the
On Sun, 6 Oct 2024 19:24:07 GMT, Brett Okken wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Dropping non-public JavaDocs
>
> src/java.base/share/classes/java/io/Reader.java line
On Mon, 7 Oct 2024 00:04:40 GMT, ExE Boss wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Dropping non-public JavaDocs
>
> src/java.base/share/classes/java/io/Reader.java line 172
On Sun, 6 Oct 2024 17:44:53 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 17:44:53 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 18:05:28 GMT, Bernd wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Dropping non-public JavaDocs
>
> src/java.base/share/classes/java/io/Reader.java line 231:
>
On Sun, 6 Oct 2024 17:44:53 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 17:44:53 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 17:44:53 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 17:31:42 GMT, Markus KARG wrote:
>> I recommend adding another test case against an ad-hoc `CharSequence`
>> implementation wrapping a `char[]` in a record, to ensure the generic paths
>> in `read(char[], int, int)` works as intended.
>
> Good idea. But instead, we could also
On Sun, 6 Oct 2024 17:44:53 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 14:54:22 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 163:
>>
>>> 161: * {@code transferTo()} methods all throw {@code IOException}.
>>> 162: *
>>> 163: * The {@code markSupported()} method returns {@code true}.
>>
>> Suggest
On Sun, 6 Oct 2024 15:23:15 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 17:25:55 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 187:
>>
>>> 185: * Reads a single character.
>>> 186: *
>>> 187: * @return The character read, or -1 if the end of the
>>> stream has been
>>
>
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementation of a `Reader` for each kind of
> `CharSequence` im
On Sun, 6 Oct 2024 16:41:13 GMT, Chen Liang wrote:
>> test/jdk/java/io/Reader/Of.java line 51:
>>
>>> 49: public static Reader[] readers() {
>>> 50: return new Reader[] {
>>> 51: new StringReader(CONTENT),
>>
>> Explicitly including that original class here (even if it h
On Sun, 6 Oct 2024 16:32:51 GMT, Chen Liang wrote:
>> This text already exists in this very file, it is a 1:1 copy from
>> `nullReader()`. It cannot be wrong for `of()` if it was correct for
>> `nullReader()`. To stay consistent with existing JavaDocs in this very same
>> file, we should not h
On Sun, 6 Oct 2024 16:39:02 GMT, Chen Liang wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Updated JavaDocs according to Alan Bateman's review comments:
>> * Dropped "API compa
On Sat, 5 Oct 2024 16:45:01 GMT, Markus KARG wrote:
>> Markus KARG has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> fixup! Reader.of(String)
>>
>> Updated JavaDocs according to Alan Bateman's review comments:
>> * Dropped "API comp
On Sun, 6 Oct 2024 15:23:15 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sun, 6 Oct 2024 14:58:23 GMT, Markus KARG wrote:
>> src/java.base/share/classes/java/io/Reader.java line 161:
>>
>>> 159: * {@code read(char[])}, {@code read(char[], int, int)},
>>> 160: * {@code read(CharBuffer)}, {@code ready()}, {@code skip(long)},
>>> and
>>> 161: * {@code
On Sun, 6 Oct 2024 15:23:15 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementation of a `Reader` for each kind of
> `CharSequence` im
On Sun, 6 Oct 2024 14:35:35 GMT, Chen Liang wrote:
>> src/java.base/share/classes/java/io/Reader.java line 341:
>>
>>> 339: public void close() {
>>> 340: cs = null;
>>> 341: }
>>
>> @AlanBateman I need to confess that I did not understand what you had in
On Sun, 6 Oct 2024 14:29:09 GMT, Chen Liang wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implement
On Sun, 6 Oct 2024 14:21:30 GMT, Chen Liang wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implement
On Sun, 6 Oct 2024 14:20:12 GMT, Chen Liang wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implement
On Sat, 5 Oct 2024 16:48:56 GMT, Markus KARG wrote:
>> This Pull Requests proposes an implementation for
>> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
>> method `public static Reader Reader.of(CharSequence)` will return an
>> anonymous, non-synchronized implemen
On Sat, 5 Oct 2024 16:32:39 GMT, Markus KARG wrote:
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementati
On Sat, 5 Oct 2024 16:32:39 GMT, Markus KARG wrote:
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementati
On Sat, 5 Oct 2024 16:32:39 GMT, Markus KARG wrote:
> This Pull Requests proposes an implementation for
> [JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
> method `public static Reader Reader.of(CharSequence)` will return an
> anonymous, non-synchronized implementati
This Pull Requests proposes an implementation for
[JDK-8341566](https://bugs.openjdk.org/browse/JDK-8341566): Adding the new
method `public static Reader Reader.of(CharSequence)` will return an anonymous,
non-synchronized implementation of a `Reader` for each kind of `CharSequence`
implementati
73 matches
Mail list logo