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
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
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 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 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 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 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
> 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
18 matches
Mail list logo