Alan, Remi, Andrew - thanks to you all for the examples/links, I will look into 
it when I got a spare moment.


Also to answer Alan's previous question:

> If you can find the defining loader of
> org.jboss.weld.proxies.util.Map$Proxy then I think it would be useful to
> this discussion. If the defining loader is your own implementation then
> there be no issue invoking that class loader's defineClass (from the
> right context of course).

I inspected the currect code and the defining loader in EE (on Wildfly) was 
ModuleClassLoader, which is an additional CL on top of Application CL (so its 
Boot->Ext->App->ModuleCL).
This creates a special module layer in wfly. However, to my knowldege, Weld 
does not really have control over this. And even if we had, we still need a 
portable way - same stuff needs to work in, say, Glassfish.
If we are talking Weld SE, than Application CL does the defining 
(sun.misc.Launcher$AppClassLoader).
Not sure if this is exactly what you asked for, I am relatively new to this and 
trying to learn more about CLs as we speak.

Matej


----- Original Message -----
> From: "Alan Bateman" <[email protected]>
> To: [email protected], "Matej Novotny" <[email protected]>
> Cc: [email protected], "Tomas Remes" <[email protected]>, "Martin 
> Kouba" <[email protected]>
> Sent: Wednesday, April 26, 2017 5:40:09 PM
> Subject: Re: setAccessible() alternative with Jigsaw - feedback on Lookup
> 
> On 26/04/2017 16:31, [email protected] wrote:
> 
> > :
> >    4. create a classloader
> >       ClassLoader classLoader = new ClassLoader(parentClassLoader()) { /*
> >       make defineClass more visible */};
> >    5. create your own layer [4]
> >       ModuleLayer layer = boot.defineModulesWithOneLoader(cf, classloader;
> >    6. profit (i.e. now you can call define class on your classloader)
> >
> At #5 then you probably want defineModules(cf, m -> classloader);
> 
> -Alan
> 

Reply via email to