[Nestmates] Questions about defineAnonymousClass replacement

David Holmes david.holmes at oracle.com
Thu Sep 7 08:50:30 UTC 2017


Hi Michael,

On 7/09/2017 6:00 PM, Michael Rasmussen wrote:
> 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 description here may shed some light:

https://bugs.openjdk.java.net/browse/JDK-8172672

David
-----

> 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