RFR: 8375119: SwitchBoostraps.enumSwitch does not throw an NPE when lookup is null in some cases
Chen Liang
liach at openjdk.org
Mon Jan 19 17:51:35 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
TestNG has a `org.testng.Assert.assertThrows` method, but sure we can migrate later. 👍
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29202#issuecomment-3769533609
More information about the core-libs-dev
mailing list