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

Jan Lahoda jlahoda at openjdk.org
Mon Sep 22 11:12:42 UTC 2025


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

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

Commit messages:
 - Cleanup
 - Cleanup.
 - Cleanup.
 - Cleanup.
 - 8368085: SwitchBootstraps.enumSwitch() args not checked as documented.

Changes: https://git.openjdk.org/jdk/pull/27422/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27422&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8363917
  Stats: 68 lines in 2 files changed: 50 ins; 0 del; 18 mod
  Patch: https://git.openjdk.org/jdk/pull/27422.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27422/head:pull/27422

PR: https://git.openjdk.org/jdk/pull/27422


More information about the core-libs-dev mailing list