RFR: 8274299: Make Method/Constructor/Field accessors @Stable
Mandy Chung
mchung at openjdk.java.net
Mon Sep 27 20:02:12 UTC 2021
On Mon, 27 Sep 2021 11:23:43 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> 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.
This is a good observation. I took another look. The only place to set those fields are in `Reflection:new_field/new_method/new_constructor`. Making the fields that set by the Method/Field/Constructor constructor be final is a good idea! Those final fields don't need to be `@Stable`.
One thing I'm puzzling is why the performance result is better but `java.lang.reflect` is not in the TNSFF package list.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5694
More information about the core-libs-dev
mailing list