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

Better modeling of access flags in core reflection

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 20
    • 17
    • core-libs
    • None

    Description

      Modifiers in core reflection and currently modeling using bit positions in an integer by java.lang.reflect.Modifier. This simple model does not fully capture existing nuances of modifiers. For example, there are collisions between the modifier bit positions for concepts used for fields, method, and types. These uses need to be disambiguated in for textual representations (JDK-6354476) and elsewhere.

      With the possibility of a bit position being reused in the same kind of construct for different purposes on different class file versions (JDK-8266524), a more capable model of core reflection modifiers will be needed.

      As a straw man proposal:
      - core reflection classes get a new "modifiers" method which returns an enum set of modifiers
      - the modifiers enum has a constant for each modifier. A modifier can include information such as its bit position, what kinds of constructs it is applicable to (classes, fields, methods, etc.), string representation, etc.

      This would allow bit positions with collisions, such as var-args and transient, to be modeled appropriately.

      Such a class would be analogous to javax.lang.model.element.Modifier.

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              darcy Joe Darcy
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: