eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
202 stars 110 forks source link

Annotation and javadoc support for JModule #1565

Open virtual-machinist opened 3 years ago

virtual-machinist commented 3 years ago

Right now module-info file generation supports only adding requires and exports directives.

Since java.lang.Module implements java.lang.reflect.AnnotatedElement and thus can in theory be annotated, so should com.sun.codemodel.JModule implement com.sun.codemodel.JAnnotatable.

Besides that module-info files can contain JavaDoc, so they should probably implement com.sun.codemodel.JDocCommentable.

virtual-machinist commented 3 years ago

As a side note - any reason com.sun.codemodel.JModule does not implement com.sun.codemodel.JGenerable while having a similar generate method (returns the passed JFormatter instead of void required by the interface, although value not used anywhere in this library)?

In addition to code alignment with other code model classes this allows for some code reuse. I for example use JGenerable in custom assertions for tests of my XJC plugins.