On 26/11/2013 11:29 AM, John Rose wrote:
On Nov 25, 2013, at 1:49 AM, Paul Sandoz <paul.san...@oracle.com> wrote:

Just curious: why did you chose to add the method, throwIllegalAccessError, to 
s.m.Unsafe and add Unsafe to the list pre-loaded classes rather than modifying 
an existing pre-loaded class?

Unsafe is used everywhere, including from some of the preloaded classes.  Thus 
it will be preloaded even if it is not on the JVM's preload list, so there's no 
harm in naming it this way from the JVM.

Not quite. Unsafe is needed during system class initialization, but it is not needed during class pre-loading. So this change will be loading it earlier, but that is harmless AFAICS.

Non of the other pre-loaded classes are really suitable in any case.

And thus we get to the Naming Question...

As a class, Unsafe is a stable, non-public name space, and is (unusually) 
tightly coupled to the JVM.  It has no other qualifications specific to this 
new use.

We don't already have "sun.misc.InternalMethods", but it's not something we 
want to invent, just for this method.  David has noted that introducing a new class would 
complicate backporting.

We do have the jdk.internal namespace. But I think Unsafe is as good a place as any - though maybe sun.misc.VM is marginally better?

Overall this approach kind of makes me cringe anyway.

Cheers,
David H.

— John

Reply via email to