Alan Bateman Alan.Bateman at oracle.com
Tue Mar 14 20:47:42 UTC 2017

On 14/03/2017 17:37, Russell Gold wrote:

> Hi Alan,
> I am trying this in SimpleStub, and it seems to work for my current 
> test cases if I do this:
>> MethodHandles.Lookup in = MethodHandles.privateLookupIn(baseClass, MethodHandles.lookup() ).dropLookupMode( MethodHandles.Lookup.PRIVATE );
>> return in.defineClass(classBytes);
> My tests create stubs from public, package-private and protected 
> classes. Is that what you are expecting? It seems a bit overly complex.
You get a full-power lookup on the "baseClass", passing your own lookup 
that proves you have access. Then you drop private access as it's not 
supported by defineClass at this time. So it looks right.

> In gmbal, I see that this may not suffice, as the current interfaces 
> provide no way to supply a class to use as a base. Figuring out how 
> those interfaces are being used might change my answer.
Could you add an overloaded register method to ManagedObjectManager to 
take the Lookup?


More information about the jigsaw-dev mailing list