8139891: Prepare Unsafe for true encapsulation

Chris Hegarty chris.hegarty at oracle.com
Fri Oct 23 14:52:28 UTC 2015

On 23/10/15 10:14, Andrew Haley wrote:
> On 22/10/15 15:48, Christoph Engelbert wrote:
>> I don’t like to say it but it sounds very wrong to have another
>> Unsafe like thinggy in the future instead of providing public
>> alternatives right from the start. I agree it might be a faster to
>> just write adapter classes and I really don’t like to repeat what I
>> said in the past but why should Oracle be able to write fast Java
>> code than the public? It just doesn’t make sense to me.
> There is a basic entitlement that anyone, within or outside Oracle,
> who wants to write a Java API should be able to prototype and test it
> on existing systems.  For that to work it must be possible to enable
> the use of Unsafe, and this will require a command-line option.

Yes, exactly.

> I have discussed this at some length with Oracle representatives, and
> it has also been discussed by the JCP Executive.  We have been assured
> by Oracle that this will be possible.  I am sure that the core library
> developers are aware of this and would do nothing to prevent it.

Yes, I am aware of this. What I am proposing will in no way
prevent it.

The motivation for this change is so that we can maintain
the existing sun.misc.Unsafe, from 1.8, to support
applications and libraries currently using it. Future Unsafe
enhancements should take place in the internal Unsafe
equivalent, which will be accessible by a command-line flag.


> Andrew.

More information about the core-libs-dev mailing list