RFR: 8274299: Make Method/Constructor/Field accessors @Stable [v2]
redestad at openjdk.java.net
Tue Sep 28 09:53:57 UTC 2021
On Tue, 28 Sep 2021 08:25:17 GMT, Peter Levart <plevart at openjdk.org> wrote:
>> This patch improves reflective access speed as shown by the included benchmarks:
>> ... and is also a prerequisite to make JEP 416 (Reimplement Core Reflection with Method Handle) perform better in some circumstances.
> Peter Levart has updated the pull request incrementally with one additional commit since the last revision:
> Make Method/Constructor/Field instance fields initialized in the constructors final
Does `Reflection::new_method/...` (which are natively implemented constructors) need any special treatment for them to follow the same semantics as a Java-based constructor w.r.t. final field writes? Or could they be rewritten to call the equivalent java constructor in each case?
We lack a microbenchmark for `Constructor`, but I suspect it might be a similar improvement to annotate the same fields in `Constructor` with `@Stable`. If not else it seems prudent to be consistent.
More information about the core-libs-dev