Is it possible to add classes to JPMS module dynamically?

Remi Forax forax at univ-mlv.fr
Thu Jun 4 12:46:56 UTC 2020


----- Mail original -----
> De: "Alex Sviridov" <ooo_saturn7 at mail.ru>
> À: "jigsaw-dev" <jigsaw-dev at openjdk.java.net>
> Envoyé: Jeudi 4 Juin 2020 14:34:08
> Objet: Is it possible to add classes to JPMS module dynamically?

> Hi all,

Hi Alex,

> 
> 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 ?

It will be added automatically, a module only contains packages (exported or not) so any classes in those packages (generated at runtime or not) are part of the module automatically.

> 
> 
> --
> Alex Orlov

cheers,
Rémi


More information about the jigsaw-dev mailing list