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

Adjust Classfile API's type arg model to better represent the embodied type

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 23
    • None
    • core-libs

      Currently, Class-File API represents type arguments with a record of an enum (unbounded, default, super, extends) and a type bound. The bound is absent when it's unbounded and present otherwise.

      This model causes some inconvenience in usage, mainly that users know the bound will be present in the non-unbounded case, yet they need to unwrap the optional with "risky" code. I propose to remodel type arg into an unbounded and a bounded subinterfaces, so that the bounded subinterface can be a simple product type, easier for users to access the bound type.

      Relevant mailing list thread: https://mail.openjdk.org/pipermail/classfile-api-dev/2023-November/000418.html

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: