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

facilitate writing additional custom attributes in a class file

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 14
    • 13
    • tools
    • b27

      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.

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

              Created:
              Updated:
              Resolved: