RFR: 8274299: Make Method/Constructor/Field accessors @Stable [v2]

Peter Levart plevart at openjdk.java.net
Tue Sep 28 12:22:11 UTC 2021

On Tue, 28 Sep 2021 09:50:45 GMT, Claes Redestad <redestad at openjdk.org> wrote:

> 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?

I don't think they need special treatment currently. The Method/Constructor/Field instances created by native code and returned via native methods are always the `root` objects that are never handed to user code. They are used internally in the caches and are published to other threads via volatile field write/read (see `java.lang.Class.ReflectionData`). User code only sees copies of those objects which are performed using constructors.


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

More information about the core-libs-dev mailing list