It looks like a very simple change. I changed it and it seems to work. Some 
optimizations regarding pattern matching might still be useful. Unfortunately, 
the unit test environment makes me some problems. I hope to have a diff file 
ready today or tomorrow and attach it to 
https://issues.apache.org/jira/browse/NETBEANS-2519 .



When changing the build and runtime requirements for Netbeans to JDK 9+ this 
code should be completely revised.



Of course, my patch does not change the bug of inserting the current module 
name into the requires part of module-info.java when creating it.



Kind regards,

Jessica



From: Alten, Jessica-Aileen <[email protected] 
<mailto:[email protected]> >
Sent: Thursday, May 9, 2019 8:28 AM
To: [email protected] <mailto:[email protected]>
Cc: [email protected] <mailto:[email protected]>
Subject: RE: Java 9+ is the module-info wizard too rigorous?



I don't know. I will have to build Netbeans and understand how Netbeans works, 
where the unit tests are, etc. I've never done that before.  I've also just 
started working with the Java module system!

The bug is documented in JIRA: 
https://issues.apache.org/jira/browse/NETBEANS-2519



Kind regards,

Jessica

From: Geertjan Wielenga <[email protected] <mailto:[email protected]> >
Sent: Thursday, May 9, 2019 5:40 AM
To: Alten, Jessica-Aileen <[email protected] 
<mailto:[email protected]> >
Cc: [email protected] <mailto:[email protected]>
Subject: Re: Java 9+ is the module-info wizard too rigorous?



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 
<[email protected] 
<mailto:[email protected]> > 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:

[email protected] <mailto:[email protected]>  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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to