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

Mandy Chung mchung at openjdk.java.net
Mon Sep 27 17:23:59 UTC 2021

On Mon, 27 Sep 2021 11:23:43 GMT, Claes Redestad <redestad at openjdk.org> wrote:

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

I'm okay to include these microbenchmarks in this patch.   I will merge the change with 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. 

See `Reflection::new_method` and `Reflection::new_field`.

> 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 reminds to double check [1] and realized that `java.lang.reflect` is not in the list of trusted packages for `@Stable`.  I'll add that in JEP 416.

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/share/ci/ciField.cpp#L219


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

More information about the core-libs-dev mailing list