Closed kevemueller closed 5 years ago
I am not familiar with the Java 9 modularity, but please let me know if you find any problem with 7d7ca2b8d184c732ccec7a7c5a2b3ef30ead87c8.
Hi @odaira, this looks fine to me. Thanks for the fix! Cheers, Keve
I'm unable to use this new version in our modularized project:
Package 'net.jpountz.lz4' is declared in module with an invalid name ('org.lz4.lz4-java')
@severn-everett Thanks much for the report. Maybe it is because an illegal character -
is used in the module name...? Would you have a test case or steps to reproduce the problem?
The steps are pretty simple: make a project that uses the 1.5.1 version of the library, and try to modularize it. The code below will build without issues with 1.5.0, but not with 1.5.1:
package com.example;
import net.jpountz.lz4.LZ4FrameOutputStream;
import java.io.ByteArrayOutputStream;
public class JavaPOC {
public static void main(String[] args) {
var loremIpsum = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy " +
"eirmod tempor invidunt ut labore et dolore magna aliquyam";
try (var lz4OutputStream = new LZ4FrameOutputStream(
new ByteArrayOutputStream(),
LZ4FrameOutputStream.BLOCKSIZE.SIZE_256KB,
LZ4FrameOutputStream.FLG.Bits.BLOCK_INDEPENDENCE,
LZ4FrameOutputStream.FLG.Bits.CONTENT_CHECKSUM
)) {
lz4OutputStream.write(loremIpsum.getBytes());
} catch (Exception e) {
e.printStackTrace();
}
}
}
With version 1.5.0, the module name is provided automatically, and the module-info.java
file will use that name to import the LZ4 library:
module com.example.JavaPOC.main {
requires lz4.java;
}
With version 1.5.1, a module name has been provided for the library, and the error occurs in the import
line. The module name doesn't correspond to the package naming scheme; try changing the automatic module name to net.jpountz
and see if that will cause it to build correctly using the modular system.
Fixed by 01a365726a833adfdace925f246ba08bff4bf32c.
Please provide a deterministic module name by adding
Automatic-Module-Name
to the manifest. See https://dzone.com/articles/automatic-module-name-calling-all-java-library-maintainers for a rationale.