On Mon, 27 Sep 2021 11:23:43 GMT, Claes Redestad <redes...@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

Reply via email to