RFR: 8341566: Adding factory for non-synchronized CharSequence Reader [v2]
Markus KARG
duke at openjdk.org
Sun Oct 6 17:37:36 UTC 2024
On Sun, 6 Oct 2024 16:41:13 GMT, Chen Liang <liach at openjdk.org> 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 has nothing to do with the `of` method) to be sure that we did not modify it in an incompatible way. Unfortunately there is no full test coverage for `StringReader`, and it does not make much sense to duplicate the tests.
>
> 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 add a new API `CharSequence.of(char[])` and test *that* class? WDYT?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1789179234
More information about the core-libs-dev
mailing list