A DESCRIPTION OF THE PROBLEM :
Right now it is not specified and the stacktrace can be confusing:
JDK 11:
```
jshell> new Exception().printStackTrace((PrintStream)null)
| Exception java.lang.NullPointerException
| at Throwable.printStackTrace (Throwable.java:657)
| at Throwable.printStackTrace (Throwable.java:648)
| at (#1:1)
```
JDK 17:
```
jshell> new Exception().printStackTrace((PrintStream)null)
| Exception java.lang.NullPointerException: Cannot enter synchronized block because the return value of "java.lang.Throwable$PrintStreamOrWriter.lock()" is null
| at Throwable.printStackTrace (Throwable.java:668)
| at Throwable.printStackTrace (Throwable.java:659)
| at (#3:1)
```
JDK 19:
```
jshell> new Exception().printStackTrace((PrintStream)null)
| Exception java.lang.NullPointerException: Cannot read field "lock" because "ps" is null
| at PrintStream$1.lock (PrintStream.java:1542)
| at Throwable$WrappedPrintStream.lock (Throwable.java:781)
| at Throwable.printStackTrace (Throwable.java:664)
| at Throwable.printStackTrace (Throwable.java:660)
| at (#3:1)
```
Right now it is not specified and the stacktrace can be confusing:
JDK 11:
```
jshell> new Exception().printStackTrace((PrintStream)null)
| Exception java.lang.NullPointerException
| at Throwable.printStackTrace (Throwable.java:657)
| at Throwable.printStackTrace (Throwable.java:648)
| at (#1:1)
```
JDK 17:
```
jshell> new Exception().printStackTrace((PrintStream)null)
| Exception java.lang.NullPointerException: Cannot enter synchronized block because the return value of "java.lang.Throwable$PrintStreamOrWriter.lock()" is null
| at Throwable.printStackTrace (Throwable.java:668)
| at Throwable.printStackTrace (Throwable.java:659)
| at (#3:1)
```
JDK 19:
```
jshell> new Exception().printStackTrace((PrintStream)null)
| Exception java.lang.NullPointerException: Cannot read field "lock" because "ps" is null
| at PrintStream$1.lock (PrintStream.java:1542)
| at Throwable$WrappedPrintStream.lock (Throwable.java:781)
| at Throwable.printStackTrace (Throwable.java:664)
| at Throwable.printStackTrace (Throwable.java:660)
| at (#3:1)
```