[Nestmates] Questions about defineAnonymousClass replacement

Michael Rasmussen michael.rasmussen at zeroturnaround.com
Thu Sep 7 08:00:41 UTC 2017


Hi,

I was looking through the JEP for nestmates and noticed:
" - A safe and supported replacement for the
Unsafe.defineAnonymousClass() API could create the new class as a
nestmate of an existing class."

I've been looking though the mailing list archive, to find further
information about this, but failed to find anything -- has there been
any discussions about this, as to what kind of restrictions etc would
be imposed on the use of that API?

The reason I'm asking is, that if I can add an arbitrary mate to an
existing nest, I would gain access to all private state, which is
something that is now restricted reflectively in the JPMS, yet this
JEP mentions that it "is not concerned with large scales of access
control, such as modules.". In an extreme example, could I add a
nestmate to java.lang.String, and start changing its char-array,
making String mutable?

Kind regards
Michael Rasmussen


More information about the valhalla-dev mailing list