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.

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

Commit messages:
 - 8357728: Optimize Executable#synthesizeAllParams

Changes: https://git.openjdk.org/jdk/pull/25961/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25961&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8357728
  Stats: 84 lines in 3 files changed: 81 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/25961.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25961/head:pull/25961

PR: https://git.openjdk.org/jdk/pull/25961

Reply via email to