module annotations

Alan Bateman Alan.Bateman at
Tue Oct 9 19:11:10 UTC 2018

On 09/10/2018 17:27, Michał Zegan wrote:
> Hello,
> I know that modules/module declarations can be annotated. Contrary to
> other elements from packages downwards, java has a way to read module
> descriptions before creating modules themselves (in fact it is a
> required step). I am wondering, why doesn't ModuleDescriptor
> contain/parse module annotations from class file? That way the
> module-info.class has to be read twice, once for module descriptor, once
> for annotations. In addition, if I would like to load annotations of a
> module x before it is instantiated (like introspection), I would have to
> still use a library like asm or similar.
This is to avoid bloating the API and also to avoid overlapping with the 
javax.lang.model API. So yes, if you are scanning observable modules, 
maybe to select which modules to resolve based on annotations, then you 
will need ASM or something to help you parse the class files. It's the 
same thing for tools that scan classes or elements for annotations.


More information about the jigsaw-dev mailing list