Comments (4)
We may need additional information such as:
- JDK used for building
- build instructions for HdrHistogram
A reproducible setup would be ideal. Also, if you have a look at the output log from Maven you'll notice Moditect writes an intermediate module-info.java (generated by jdeps). If you could paste it here that would be sweet.
from moditect.
- I tried on 11, 21, and 22
mvn clean compile package
The generated source looks like this
module org.HdrHistogram {
exports org.HdrHistogram;
exports org.HdrHistogram.packedarray;
}
Which is correct, but then this error happens when linking
jlink --module-path target/HdrHistogram-2.2.2-SNAPSHOT.jar --add-modules org.HdrHistogram --output jre
Error: Error reading module: target/HdrHistogram-2.2.2-SNAPSHOT.jar
java.lang.module.FindException: Error reading module: target/HdrHistogram-2.2.2-SNAPSHOT.jar
at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:351)
at java.base/jdk.internal.module.ModulePath.scan(ModulePath.java:238)
at java.base/jdk.internal.module.ModulePath.scanNextEntry(ModulePath.java:191)
at java.base/jdk.internal.module.ModulePath.find(ModulePath.java:155)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.newModuleFinder(JlinkTask.java:455)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.initJlinkConfig(JlinkTask.java:386)
at jdk.jlink/jdk.tools.jlink.internal.JlinkTask.run(JlinkTask.java:281)
at jdk.jlink/jdk.tools.jlink.internal.Main.run(Main.java:56)
at jdk.jlink/jdk.tools.jlink.internal.Main.main(Main.java:34)
Caused by: java.lang.module.InvalidModuleDescriptorException: Package org.HdrHistogram$packedarray not found in module
at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1216)
at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:330)
at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:129)
at java.base/jdk.internal.module.ModulePath.readJar(ModulePath.java:652)
at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:332)
... 8 more
from moditect.
I think the issue might be here:
https://github.com/moditect/moditect/blob/main/core/src/main/java/org/moditect/internal/compiler/ModuleInfoCompiler.java#L139
It appears to (wrongly) assume that names that start with upper case letters must be class names (and cannot be package names), such that subsequent parts that follow such a name are considered to be nested classes, and not sub-packages. This leads to a divergence from how e.g. javac would compile the same module-info.java file...
from moditect.
And BTW, before we go down the "package names should not have uppercase letters in them" rathole: While convention has evolved to follow that rule mostly, the specification (e.g. at 6.5. Determining the Meaning of a Name) never had a rule like that, and is quite specific and prescriptive on the valid way to determine if a name is (or is not) a package name. There have long been examples of popular packages that included uppercase letters. HdrHistogram is one such very popular package (and is a core dependency of a large set of projects), and it clearly works fine with a wide array of tooling.
The conventions were unfortunately much looser early on, and when org.HdrHistogram started off. I've since considered shifting the package name to all-lower at some point, but that would quite obviously need to happen in a major version change. And even then, the wide-ranging source-code-breaking impact of such a shift on so much existing source code makes it a hard sell. In a strange way, the existence of org.HdrHistogram actually plays a positive ecosystem role as it is so popular it can't easily be ignored, so it acts as a forcing function to make new/emerging ecosystem tools fully deal with the actual specifications for java naming rather than make breaking assumptions based on observed conventions that "seem to work" in early adoption situations...
from moditect.
Related Issues (20)
- jdepsExtraArgs gotcha HOT 2
- Support or document how to generate module info for a Maven plugin HOT 4
- Support for new Compression vars HOT 6
- add-module-info no longer allows replacing the existing module-info in a jar HOT 1
- NullPointerException during create-runtime-image HOT 8
- Update Maven deployment strategy HOT 1
- Ability to replace dependencies HOT 1
- `add-module-info` of moditect-maven-plugin fails for multi-module projects, Shade plugin with "xxx-[version].jar is already modular" HOT 4
- Generated JAR file depends on default time zone HOT 10
- [BUILD] Use ${maven.multiModuleProjectDirectory} instead of directory-maven-plugin HOT 2
- Java 22 support HOT 1
- [BUILD] update build to require Java 11+ for building HOT 23
- Contributing CDI SE Example HOT 2
- problem about .\module-info.class and META-INF\services\9 HOT 9
- Update license and maven configuration HOT 1
- NPE in create-runtime-image if jar not created HOT 2
- 1.2.0.Final break builds where 1.1.0 works (Apache Commons IO): `add-module-info failed: Couldn't copy JAR file` HOT 9
- Cannot run verify twice without clean - build complains about split packages HOT 4
- Execution add-module-infos of goal org.moditect:moditect-maven-plugin:1.2.1.Final:add-module-info failed: Encountered unexpected token: "-" "-" HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moditect.