RFR: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor}
jengebr
duke at openjdk.org
Thu May 30 19:30:12 UTC 2024
Improve `java/lang/reflect/Method.java` by eliminating needless cloning of Class[0] instances. This cloning is intended to prevent callers from changing array contents, but smany Methods have zero exceptions or zero parameters, and returning the original `Class[0]` is sufficient.
-------------
Commit messages:
- Merge branch 'openjdk:master' into Method_ArrayCloning
- Updating copyright year
- Merge branch 'openjdk:master' into Method_ArrayCloning
- Merge branch 'openjdk:master' into Method_ArrayCloning
- Reverting to expressions rather than utility method
- Moving utility method to AccessibleObject
- Fixing whitespace
- Extracted logic to utility method
- Expanding no-cloning coverage to Constructor
- Reducing array allocation rate by eliminating cloned Class[0]
Changes: https://git.openjdk.org/jdk/pull/19327/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19327&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8332586
Stats: 7 lines in 2 files changed: 0 ins; 1 del; 6 mod
Patch: https://git.openjdk.org/jdk/pull/19327.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/19327/head:pull/19327
PR: https://git.openjdk.org/jdk/pull/19327
More information about the core-libs-dev
mailing list