RFR: 8375119: SwitchBoostraps.enumSwitch does not throw an NPE when lookup is null in some cases
Chen Liang
liach at openjdk.org
Sun Jan 18 08:38:34 UTC 2026
On Tue, 13 Jan 2026 18:05:43 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> The `SwitchBootstraps.enumSwitch` is documented to throw a `NullPointerException` when `lookup` is `null`, but it does not throw the exception in all cases.
>
> Given the `lookup` is in some cases required, the proposal herein is to properly check `lookup` is not `null`. And while doing that, I added similar checks for `invocationType` and `labels` - those were checked implicitly, but doing the check explicitly is better. Note `invocationName` is unused and is permitted to be `null`, and hence there's no check for it.
>
> Please also review the CSR:
> https://bugs.openjdk.org/browse/JDK-8375120
Ok, though ideally tests should use dedicated throws detection tools
-------------
Marked as reviewed by liach (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/29202#pullrequestreview-3675325350
More information about the core-libs-dev
mailing list