Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8368085

SwitchBootstraps.enumSwitch() args not checked as documented.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • 26
    • tools
    • None
    • minimal
    • Java API
    • SE

      Summary

      The documentation for SwitchBootstraps.enumSwitch and SwitchBootstraps.typeSwitch is not completely in line with the implementation, and could be improved

      Problem

      • the implementation of both enumSwitch and typeSwitch accept null as the value of invocationName
      • the labels array for enumSwitch may contain names of enum constants that don't exist, but the documentation is not clear about this
      • empty strings are not permitted as values of the labels array by the implementation, but the documentation does not state that
      • the documentation could be clearer about the behavior in the situation when no label matches

      Solution

      The documentation is adjusted and clarified to match the implementation. No behavioral changes, only adjustments to align the documentation to the existing behavior.

      Specification

      The proposed API Diff is attached, and is also available for convenience here: https://cr.openjdk.org/~jlahoda/8368085/apidiff.00/java.base/java/lang/runtime/SwitchBootstraps.html

            jlahoda Jan Lahoda
            pchinnasamy Prabushankar Chinnasamy
            Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: