RFR (S + L test) : 8016839 : JSR292: AME instead of IAE when calling a method

David Holmes david.holmes at oracle.com
Tue Nov 26 02:18:59 UTC 2013

On 26/11/2013 11:29 AM, John Rose wrote:
> On Nov 25, 2013, at 1:49 AM, Paul Sandoz <paul.sandoz at 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.

David H.

> — John

More information about the core-libs-dev mailing list