On Thu, 24 Apr 2025 17:36:29 GMT, Shaojin Wen <s...@openjdk.org> wrote:

>> The current Throwable::printStackTrace implementation uses three inner 
>> classes PrintStreamOrWriter/WrappedPrintStream/WrappedPrintWriter. We can 
>> introduce a static method println to replace these three embedded classes.
>
> Shaojin Wen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   use interface + record

This PR seems like a solution in search of a problem, the goalpost seems to be 
moving and the communication hasn't been great.

The existing wrapper classes are just that - wrapper classes. They don't really 
hold data, their components aren't used as data, they have no hashCode / 
equals. As such, these internal implementation classes do not look like prime 
targets to convert to records to me. If we really want to change every class to 
be a record there will be a lot of code churn for no good reason. Are classes 
toxic legacy now?

@liach suggested to remove the wrapper classes and instead use a static method 
with `instanceof` checking. That would remove the need for both the interface 
and the wrapper classes which seems like a real improvement. @AlanBateman seems 
to have been reluctant to such a change, but I don't think I (or others in this 
PR) quite understood his reasoning for that opposition.

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

PR Comment: https://git.openjdk.org/jdk/pull/24795#issuecomment-2829657158

Reply via email to