RFR: 8363917: SwitchBootstraps.enumSwitch() args not checked as documented.

Chen Liang liach at openjdk.org
Tue Sep 23 16:36:45 UTC 2025


On Mon, 22 Sep 2025 11:00:37 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> The bug points out the implementation and the documentation for `SwitchBootstraps.enumSwitch` don't completely agree, and that some points in the documentation could be more clear. This PR adjusts the documentation for `SwitchBootstraps`. No behavioral changes. Tests added to verify the behavior.
> 
> The adjustments are:
> - `invocationName` can be `null`
> - being explicit the `labels` array for `enumSwitch` may constain references to enum constants that don't exist
> - disallowing empty strings in the `labels` array
> - rephrasing of the handling of the situation when no element in the `labels` array matches

java.lang.invoke.ConstantBootstraps has a class-level comment that unused arguments may be null. Do you think we should use a similar comment?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27422#issuecomment-3324774696


More information about the core-libs-dev mailing list