On Fri, 20 Oct 2023 10:13:40 GMT, Dmitry Markov <[email protected]> wrote:
> It would be good to ensure that f is not NULL before dispose.
I know we're doing it all the time… But is it really relevant?
This has been bothering me for a while now… Let's clear things up.
If the frame is `null`, something has gone awry. If the test code itself didn't
throw the exception, we'll get:
Exception in thread "main" java.lang.NullPointerException
at WheelModifier.main(WheelModifier.java:173)
The bad thing is that any exception thrown from the test itself — in the `try`
block — gets overridden by the exception thrown from the `finally` block. Thus,
we get the same exception as above.
The overall result is that the test fails, yet it may hide the real reason,
which makes it harder to analyse the root cause of the failure.
Taking into account the above, *`null`-check is good even though it makes the
code longer.*
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16281#discussion_r1366862441