JDK-8335935 : Chained builders not sending transformed models to next transforms
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.classfile
  • Affected Version: 23,24
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-07-08
  • Updated: 2024-07-29
  • Resolved: 2024-07-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23 JDK 24
23Fixed 24 b06Fixed
Related Reports
Blocks :  
CSR :  
Description
In chained builders, we have code like `downstream.with` which should instead become `consumer.accept` so the builder's buffered model is sent to the andThen transforms.

This is definitely a bug: currently, they are not only not sending the models to next transforms, but they also return the downstream instead of this builder for chaining. This is a violation of API specification too.

Simple reproducer attached. The "methodB" does not appear in the console output but appears in the class printer output.

A similar problems happens to BlockCodeBuilder writing bypassing downstream ChainedCodeBuilder, initially reported in JDK-8335642; that bug should be fixed in the same patch as all these bugs are of the same nature.

And as a consequence, we can remove TransformingCodeBuilder in favor of ChainedCodeBuilder.
Comments
A pull request was submitted for review. Branch: jdk23 URL: https://git.openjdk.org/jdk/pull/20127 Date: 2024-07-10 22:10:50 +0000
10-07-2024

Changeset: cad68e06 Branch: master Author: Chen Liang <liach@openjdk.org> Date: 2024-07-10 21:06:39 +0000 URL: https://git.openjdk.org/jdk/commit/cad68e06ecad1e19091d1af9c0f9b8145d6842fb
10-07-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20100 Date: 2024-07-09 17:34:14 +0000
09-07-2024