On Tue, 1 Dec 2026 14:10:35 GMT, Sean Mullan <[email protected]> wrote:

>> This patch overrides toString() in FileInputStream, FileOutputStream, and 
>> RandomAccessFile to return the file's base name followed by its identity 
>> hash. It follows similar changes made a few years ago for ZipFile 
>> (JDK-8319626). 
>> 
>> Filename retrieval shares the existing File.getName() logic, while streams 
>> constructed from a file descriptor retain their previous behaviour.
>> 
>> ---------
>> - [X] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.base/share/classes/java/io/FileInputStream.java line 530:
> 
>> 528: 
>> 529:     /**
>> 530:      * {@return a string identifying this {@code FileInputStream}}
> 
> It would be useful to be more specific about what is returned (only the 
> basename and hashcode). Could make this an implementation note if you don't 
> want to commit to what is returned.

We need flexibility to change it so not specifying the format is better. Also 
these classes are not final so specifying the format might invalidate existing 
sub-classes. When this came up with ZipFile then the agreement was to include 
"for debugging" in the method description.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/34137#discussion_r4755657608

Reply via email to