Lookup.defineClass

John Rose john.r.rose at oracle.com
Wed Mar 8 20:41:13 UTC 2017


On Mar 8, 2017, at 10:47 AM, Remi Forax <forax at univ-mlv.fr> wrote:
> 
> The exception if the lookup is PRIVATE should be IllegalStateException and not UnuspportedOperationException.
> then, given that the loaded class will have the same protection domain as the lookup class, i do not fully understand why having a PRIVATE lookup is a problem.

Since lookups are stateless, so there is never a reason for them to throw ISE; thus UOE is better (loose analogy with immutable lists).

We are disallowing PRIVATE in order to reserve it for future use.  If you define a class into a private context, the resulting class *should* have private access to the lookup-class, but we currently cannot express this in the JVM (except by hacks).  Defining a new class with private access to a lookup-class is the replacement we are planning for the unsafe, undocumented notion of "host class".  But first we need a better treatment of what is "private access", which will be provided by a future concept of "nestmate" (at the JVM level) which mirrors the language-level permissions of nestmates.

Make sense?

— John


More information about the jigsaw-dev mailing list