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

facilitate writing additional custom attributes in a class file

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 13
    • Fix Version/s: 14
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b27

      Description

      the javac ClassWriter class provides a method writeExtraClassAttributes as follows

          /**Allows subclasses to write additional class attributes
           *
           * @return the number of attributes written
           */
          protected int writeExtraClassAttributes(ClassSymbol c) {
              return 0;
          }

      The method has various problems:

      1. It can be hard to provide subtypes in a modular javac
      2. The field `databuf` is package-private, implying that subtypes would have to be in the same package, which again is problematic in a modular javac
      3. It is unnecessarily restricted to class-level attributes. It would be more useful if it could be extended to field and method attributes as well

      It would be better if a client could register to be called in a timely fashion to be able to write additional class, method, and field attributes.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jjg Jonathan Gibbons
              Reporter:
              jjg Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: