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

Peter Levart plevart at openjdk.java.net
Mon Oct 4 15:54:07 UTC 2021


On Sat, 2 Oct 2021 15:31:35 GMT, Peter Levart <plevart at openjdk.org> wrote:

> > I'm fine with going back to the previous iteration. I'd add `@Stable` to the same fields in `Constructor`, too, though.
> 
> Good catch. I'll add @stable to select Constructor fields. They are important for optimizing `Const` use cases.

I checked the git history. `@Stable` annotation was added to `Method::clazz` and `Method::modifiers` fields as part of "JDK-8159746: (proxy) Support for default methods" to speed-up checks since Method instances in Proxy class are assigned to static final fields so this is an example of "Const" use case. But reflective access uses those two fields to perform access checks too, so it makes sense to add @stable to those fields in Field and Constructor classes too.

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

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


More information about the core-libs-dev mailing list