RFR: 8274299: Make Method/Constructor/Field accessors @Stable

Claes Redestad redestad at openjdk.java.net
Mon Sep 27 11:26:53 UTC 2021


On Sat, 25 Sep 2021 10:15:11 GMT, Peter Levart <plevart at openjdk.org> wrote:

> This patch improves reflective access speed as shown by the included benchmarks:
> 
> https://jmh.morethan.io/?gists=902f4b43519c4f96c7abcd14cdc2d27d,ac490481e3001c710d75d6071c10b23a
> 
> ... and is also a prerequisite to make JEP 416 (Reimplement Core Reflection with Method Handle) perform better in some circumstances.

This looks good, assuming Mandy is OK with extracting and adding to the microbenchmarks from JEP 416

A stray thought is why not most fields in `Field`/`Method`/`Constructor` are `final`, as my IDE suggests. I can't find any hotspot code that injects values to these fields. Experimentally changing most fields in `Field` to final seem to pass at least all the java/lang/reflect tests. Since this is a trusted package `@Stable` should then be pointless.

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

Marked as reviewed by redestad (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/5694


More information about the core-libs-dev mailing list