RFR: 8357728: Avoid caching synthesized names in synthesized parameters [v2]
Jorn Vernee
jvernee at openjdk.org
Mon Nov 17 15:48:11 UTC 2025
On Fri, 14 Nov 2025 23:03:22 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Currently, fake parameters are created with "arg0" etc. strings that are retained for class file methods with no MethodParameters attribute. The original issue report observes many of these strings present in the heap. To address this issue, we can remove these eagerly created fake names, bringing their behavior in line with nameless parameters from MethodParameters attribute, such as those from inner class constructors. A unit test verifies that no name is retained in the Parameter object when the name is fake.
>>
>> The original report recommends using a pool to store the arg name strings. I did not take that approach as I don't think it is very necessary; if the issue of retained fake names persist, we can update `Parameter::getName` to return fake names from a pool instead.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'master' of https://github.com/openjdk/jdk into fix/fake-param-name
> - 8357728: Optimize Executable#synthesizeAllParams
Looks good.
-------------
Marked as reviewed by jvernee (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/25961#pullrequestreview-3473381755
More information about the core-libs-dev
mailing list