Review Request: 8238358: Implementation of JEP 371: Hidden Classes
mandy.chung at oracle.com
Wed Apr 1 17:42:57 UTC 2020
On 4/1/20 7:26 AM, Alan Bateman wrote:
> Maybe I missed it going by, but why is the isHidden check in the field
> offset methods on sun.misc.Unsafe rather than the internal Unsafe?
The reflection and VarHandle implementation uses
jdk.internal.misc.Unsafe to do field access (both read and write). For
fields of a hidden declaring class, Field::get works on final and
non-final fields. Field::set will work on non-final fields and throw
IAE on final fields. That's why no change to the internal Unsafe to
support reflective field access.
The check in the field offset methods in `sun.misc.Unsafe` intends to
constrain the existing use of jdk.unsupported unsafe field offset
methods to existing classes but not hidden classes (perhaps same to
apply to inline classes) moving toward "trusted non-instance finals".
More information about the valhalla-dev