On Tue, 22 Apr 2025 11:06:17 GMT, Shaojin Wen <s...@openjdk.org> wrote:
> As the title says, this is a simple refactoring that simplifies the code by > using record. src/java.base/share/classes/java/lang/Throwable.java line 770: > 768: * implementation of printStackTrace. > 769: */ > 770: private interface PrintStreamOrWriter { This is still too many classes. Can we just pull out `println` to a method like: private static void println(Object printer, Object o) { if (printer instanceof printStream ps) { ps.println(o); } else { ((PrintWriter) printer).println(o); } } Should be fewer classes to accomplish the same functionality. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24795#discussion_r2054597738