Integrated: 8375119: SwitchBoostraps.enumSwitch does not throw an NPE when lookup is null in some cases
Jan Lahoda
jlahoda at openjdk.org
Fri Jan 23 07:43:56 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
This pull request has now been integrated.
Changeset: 315bf07b
Author: Jan Lahoda <jlahoda at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/315bf07b23ad6c5f86fc8fe976abd9e9a8548404
Stats: 41 lines in 2 files changed: 35 ins; 0 del; 6 mod
8375119: SwitchBoostraps.enumSwitch does not throw an NPE when lookup is null in some cases
Reviewed-by: liach
-------------
PR: https://git.openjdk.org/jdk/pull/29202
More information about the core-libs-dev
mailing list