On Tue, 18 Nov 2025 16:39:32 GMT, Chen Liang <[email protected]> wrote:

>> ClassMethodTransform and ClassFieldTransform are computing the chaining 
>> condition incorrectly - the composed transform should run when any of the 
>> component wants to run instead of when all copmonents want to run, and the 
>> actual content tranforms can only compose if they apply to the same set of 
>> method or fields. So we should restrict this "optimization" to same filters.
>
> Chen Liang has refreshed the contents of this pull request, and previous 
> commits have been removed. The incremental views will show differences 
> compared to the previous content of the PR. The pull request contains one new 
> commit since the last revision:
> 
>   8372047: ClassTransform.transformingMethodBodies andThen composes 
> incorrectly

src/java.base/share/classes/jdk/internal/classfile/impl/TransformImpl.java line 
123:

> 121:         @Override
> 122:         public ClassTransform andThen(ClassTransform next) {
> 123:             if (next instanceof ClassMethodTransform(var nextTransform, 
> var nextFilter) && filter == nextFilter)

I'm trying to figure out a case where filters of the chained transforms are 
identical.
Is it covered by some tests?
Unless there is a real benefit in a frequent use case I suggest to remove this 
optimization.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28377#discussion_r2540884396

Reply via email to