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

AccessFlags factories do not require necessary arguments

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 24
    • 24
    • core-libs
    • None

    Description

      AccessFlags is an object modeling access flag as a classfile element. It is essentially an integer bit mask, bound with a location to allow specific parsing.

      However, this bit mask is version specific too. For example, pre-valhalla class files may optionally have the ACC_SUPER bit set for no impact; but once valhalla arrives, it will become ACC_IDENTITY where non-set bit would mean value classes. However, we still want to interpret pre-valhalla classes without this bit set as identity.

      As a result, the current `AccessFlags.ofClass` `AccessFlags.ofMethod` `AccessFlags.ofField` methods become problematic if we want to support version-specific parsing, as it's not always proper to assume a latest class file version.

      The proposed action is to remove the 6 `ofXxx` factory methods, making `AccessFlags` more similar to bytecode `Label` or `BootstrapMethodsAttribute`, that the creation will be through `withFlags` methods on respective builders. These builders can capture ClassFile versions from context, and thus correctly validate/parse/interpret access flags, which we can enhance in the future.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: