Thanks a lot for this great analysis and welcome to the NetBeans community.
I think the main problem here is that I don't think there's anyone who is very knowledgeable about this part of the code. Do you expect that a lot of code will need to be changed to fix this or is this a simple change or tweak that's needed somewhere specific? Thanks, Gj On Mon, May 6, 2019 at 2:13 PM Alten, Jessica-Aileen < jessica-aileen.al...@leibniz-liag.de> wrote: > Hi, > > I am quite new to the JDK 9+ module system but I think I found a bug in the > Netbeans module-info wizard (only tested with Netbeans 11). The problem is > the code generation for automatic modules, which seems too rigorous. In my > case, it is a maven project, but that does not matter, the Netbeans build > mechanism produces the same result. > > Example: Using the jdom2-2.0.6.jar leads to this code > > module mymodulename { > requires jdom; > } > > Netbeans is fine with this, no errors, code completion works, but compiling > the code gives a compilation error: > ... module not found: jdom > > Changing "requires jdom" to "requires jdom2", in module-info.java results > in > lots of red error badges in module-info.java and other classes, code > completion does not work and import statement says, "package > org.jdom2.input > is declared in module jdom, but module mymodulename does not read it." > > But this works! Compilation is ok and the the class using the jdom2 > package > is working fine! > > Calling "jar --describe-module --file=jdom2-2.0.6.jar" gives: > > jdom2@2.0.6 automatic > requires java.base mandated > contains org.jdom2 > contains org.jdom2.adapters > contains org.jdom2.filter > contains org.jdom2.input > contains org.jdom2.input.sax > contains org.jdom2.input.stax > contains org.jdom2.internal > contains org.jdom2.located > contains org.jdom2.output > contains org.jdom2.output.support > contains org.jdom2.transform > contains org.jdom2.util > contains org.jdom2.xpath > contains org.jdom2.xpath.jaxen > contains org.jdom2.xpath.util > > I read some articles about the module mechanism of JDK 9+ especially about > automatic modules and know that name generation for automatic modules > truncates the version string part, in this case that would be "-2.0.6" but > not "2-2.0.6", "2" is a distinctive feature not a version string. I think > the Netbeans wizard is doing too much here. Would you confirm this? > > I know about the workarounds, i.e. modifying META-INF/MANIFEST.MF in the > jar > file and I know that this library should be updated for JDK 9+, but I think > Netbeans should behave like the --describe-module result. > Or did I misunderstand something fundamentally? > > Kind regards, > Jessica > > > >