RFR: 8355301: Simplify the code by using record [v2]

ExE Boss duke at openjdk.org
Wed Apr 23 01:11:40 UTC 2025


On Wed, 23 Apr 2025 00:58:08 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> As the title says, this is a simple refactoring that simplifies the code by using record.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   from @liach, Use static pirntln method to replace WrappedStream and WrappedPrintWriter

The shared implementation method either needs to be renamed, or the parameter needs to be cast to `Object`, as otherwise this’ll just lead to infinite self‑recursion.

src/java.base/share/classes/java/lang/Throwable.java line 689:

> 687:     }
> 688: 
> 689:     private void printStackTrace(Object printer) {

Suggestion:

        printStackTrace0(s);
    }

    private void printStackTrace0(Object printer) {

src/java.base/share/classes/java/lang/Throwable.java line 776:

> 774:      */
> 775:     public void printStackTrace(PrintWriter s) {
> 776:         printStackTrace(s);

Suggestion:

        printStackTrace0(s);

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

Changes requested by ExE-Boss at github.com (no known OpenJDK username).

PR Review: https://git.openjdk.org/jdk/pull/24795#pullrequestreview-2785712763
PR Review Comment: https://git.openjdk.org/jdk/pull/24795#discussion_r2055099442
PR Review Comment: https://git.openjdk.org/jdk/pull/24795#discussion_r2055099540


More information about the core-libs-dev mailing list