RFR: 8341566: Adding factory for non-synchronized CharSequence Reader
Alan Bateman
alanb at openjdk.org
Wed Oct 9 10:43:59 UTC 2024
On Wed, 9 Oct 2024 06:57:38 GMT, Alan Bateman <alanb at openjdk.org> 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 anything using Reader has to do this already.
>>
>> I think it would be better to drop "API compatible with StringReader" from the method description. An apiNote in StringReader can direct readers to the static factory method.
>>
>> Also I think drop the "lock" field from the API docs as it's a protected field and only interesting to subclasses. The Reader class does not specify if Reader is thread-safe so the method description doesn't need to say too much. For clarify then it could just say something like "the resulting Reader is not safe for use by multiple concurrent threads. If the Reader is to be used by more than one thread it should be controlled by appropriate synchronization".
>>
>> The parameter name is currently "c", maybe you mean "cs"? The method will need to specify NPE for the of(null) case.
>
>> @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?
> @AlanBateman WDYT?
A title like "Add Reader.of(CharSequence)" would make it clear to everyone what this issue, and the CSR, is about.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21371#issuecomment-2401960681
More information about the core-libs-dev
mailing list