Replacement for sun.misc.Unsafe.allocateInstance(Class<?>) ?

Christoph Engelbert me at
Fri Jul 31 20:12:45 UTC 2015

Hey Jörg,

It will not yet be unaccessible, you just have to force JDK 9 to export the sun.misc package to be visible to user code. There will be a command line flag for that purpose, however I agree eventually we’ll need a replacement, whatever it looks like.


> Am 31.07.2015 um 20:33 schrieb Jörg Schaible <joerg.schaible at>:
> Hello guys,
> there's a lot of talk about making sun.misc.Unsafe unaccessible in JDK 9 ... 
> however, there seems no replacement for the allocateInstance method.
> XStream is relying heavily on this functionality and without it the library 
> will no longer be able to deserialize a lot of objects from XML. What are 
> the long-term options? 
> Cheers,
> jörg

More information about the core-libs-dev mailing list