On Thu, 27 Aug 2026 18:05:52 GMT, Jaikiran Pai <[email protected]> wrote:

>> src/java.base/share/classes/java/io/InputStreamReader.java line 188:
>> 
>>> 186:     @Override
>>> 187:     public String readAllAsString() throws IOException {
>>> 188:         String s = sd.tryReadAllAsString();
>> 
>> I think one other thing that we would need to consider is that with this 
>> proposed change, unlike previously, where a call too 
>> `InputStreamReader.readAllAsString()` would ultimately call the `read(char[] 
>> cbuf, int off, int len)` on the `InputStreamReader`, that is no longer true 
>> with this change. The `read(cbuf, off, len)` may never get called and 
>> instead the new implementation will directly operate on the underlying 
>> `InputStream`. 
>> 
>> `InputStreamReader` is public and can also be extended by 
>> application/library classes. The `read(cbuf, off, len)` may have been 
>> overridden too, and there might be expectations that the method will be 
>> called. So this is going to be an observable change in behaviour. I think we 
>> would need check how common it is to overridde the `read(cbuf, off, len)` 
>> method in such subclasses. I'll run some experiments for that in the coming 
>> days.
>
> I just noticed that Alan already made a similar mention some minutes ago 
> https://github.com/openjdk/jdk/pull/32264#discussion_r3874091325

Thank you for your experiments, Jaikiran! Suspending myself until you're done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32264#discussion_r3882195258

Reply via email to