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

Allow transforms to run on elements generated by a builder

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • core-libs
    • None

      Sometimes, an arbitrary user building handler wishes its output be processed by a library transform without going through an intermediate CompoundElement. For example, in ASM, there are trace visitors, and users might want to use trace transforms that log every entry generated for debugging. This request on the list https://mail.openjdk.org/pipermail/classfile-api-dev/2025-April/000698.html is also another proof of the demand.

      We already have CodeBuilder::transforming but it was not expanded to other builders due to their extra required arguments. However, on second thought now, they can just reuse the required args of their base builders - this is how it happens in ASM, for a wrapping ClassVisitor, it returns a wrapped MethodVisitor. For a wrapping ClassTransform, it transforms the call to withMethod to change the required args to the base builder as well.

      We might retrofit the signature of CodeBuilder::transforming for these new APIs.

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

              Created:
              Updated: