RFR: 8375119: SwitchBoostraps.enumSwitch does not throw an NPE when lookup is null in some cases
Jan Lahoda
jlahoda at openjdk.org
Tue Jan 13 18:13:32 UTC 2026
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
-------------
Commit messages:
- Cleanup.
- 8375119: SwitchBoostraps.enumSwitch does not throw an NPE when lookup is null in some cases
Changes: https://git.openjdk.org/jdk/pull/29202/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29202&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8375119
Stats: 41 lines in 2 files changed: 35 ins; 0 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/29202.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/29202/head:pull/29202
PR: https://git.openjdk.org/jdk/pull/29202
More information about the core-libs-dev
mailing list