jakartaee / inject

Apache License 2.0
17 stars 17 forks source link

Add explicit module-info class file, to prevent resolving all automatic modules #17

Closed VISTALL closed 3 years ago

VISTALL commented 4 years ago

Is your feature request related to a problem? Please describe. At current moment jakarta-inject library have Automatic-Module-Name attribute, if we using boot classloader it's ok.

But when multi-classloader env, resolving automatic modules have problem. Problem in this jdk code https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/module/Resolver.java#L160

For example:

Describe the solution you'd like Add module-info class file to jar file. It can be placed in jar root, or in META-INF/versions/9/, old jvms skip this file anyway.

There many ways how generate it. Check gson library or log4j2.

Also up release to 9 target.

I use own maven-plugin which generate module-info, and place it to target directory (https://github.com/consulo/java9-maven-plugin)

Describe alternatives you've considered Leave as is Automatic-Module-Name

Thanks

msgilligan commented 3 years ago

Would there be interest in a PR to do this? If so, which of @VISTALL's suggested approaches would be preferred?

UPDATE: There is a PR now: https://github.com/eclipse-ee4j/injection-api/pull/19 (which bumps the target JDK 11, which may not be the most popular approach)

rbygrave commented 3 years ago

FYI: This issue will be resolved with https://github.com/eclipse-ee4j/injection-api/pull/20 which has been just merged.

Ladicek commented 3 years ago

As mentioned, fixed in #20.

VISTALL commented 3 years ago

Hello. New build pushed to public maven repository? If not - when it will be pushed