[jdk21u-dev] RFR: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor}

Rui Li duke at openjdk.org
Wed Sep 3 03:31:20 UTC 2025


A clean backport of https://bugs.openjdk.org/browse/JDK-8332586. 

A perf improvement: when members are empty arrays, return them as it is (empty arrays are non modifiable) rather than clone an new empty array. 

Logic is straightforward. Low risk. On tip for over a year.

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

Commit messages:
 - Backport 27af19d921a5cf15f5146471b58961815690b4f2

Changes: https://git.openjdk.org/jdk21u-dev/pull/2145/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=2145&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8332586
  Stats: 177 lines in 4 files changed: 170 ins; 1 del; 6 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/2145.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/2145/head:pull/2145

PR: https://git.openjdk.org/jdk21u-dev/pull/2145


More information about the jdk-updates-dev mailing list