Is it possible to add classes to JPMS module dynamically?

Alan Bateman Alan.Bateman at oracle.com
Thu Jun 4 13:01:01 UTC 2020


On 04/06/2020 13:34, Alex Orlov wrote:
> Hi all,
>   
> Let's suppose we have a JPMS module  moduleA with the following  module-info :
> module moduleA {
>      exports modulea.generated;
> }
> Now, using javassist/byte-buddy we generate new  modulea.generated.Foo class. Could anyone say if we can add this class to  moduleA dynamically (at runtime) so as JPMS work with it as it works with module existing classes?
Yes, if you use Lookup.defineClass or some other means to define a class 
into one of moduleA's run-time packages then it be in moduleA.

-Alan.


More information about the jigsaw-dev mailing list