RFR: 8355301: Simplify the code by using record
Chen Liang
liach at openjdk.org
Tue Apr 22 18:03:57 UTC 2025
On Tue, 22 Apr 2025 11:06:17 GMT, Shaojin Wen <swen at 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
More information about the core-libs-dev
mailing list