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

Chained builders not sending transformed models to next transforms

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P2 P2
    • 23, 24
    • core-libs
    • None
    • behavioral
    • minimal
    • Changes to preview APIs and behavior have minimal compatibility risk.
    • Java API
    • SE

      Summary

      Fix out-of-spec behavior (with|transform)(Field|Method(Body)?|Code) on Class-File API builders supplied to chained transforms.

      Problem

      Some Class-File API builders (ChainedXxxBuilders) accessible to transforms (after they are composed with ClassFileTransform.andThen()) are incorrectly implemented: components produced by those problematic methods are skipped from the next transform. The problematic methods do not return the builder itself, but return another builder intended for another transform in the chain.

      There is no easy way to bypass component skipping issue: users have to commit and re-parse the whole class for every single transform to get the right behavior.

      Solution

      Fix these bug and out-of-spec behaviors, despite that it's possible users have accidentally relied on these bugs. Components will be passed to the next transform, and the methods will return the builder itself for chaining.

      Backport this fix to 23 despite there has been some API renames made in 24, given this significantly affects usability of the transformation API.

      Specification

      No change.

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

              Created:
              Updated:
              Resolved: