Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide deterministic module name #134

Closed
kevemueller opened this issue Feb 8, 2019 · 6 comments
Closed

Provide deterministic module name #134

kevemueller opened this issue Feb 8, 2019 · 6 comments

Comments

@kevemueller
Copy link

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.

@odaira
Copy link
Member

odaira commented Feb 11, 2019

I am not familiar with the Java 9 modularity, but please let me know if you find any problem with 7d7ca2b.

@kevemueller
Copy link
Author

Hi @odaira,
this looks fine to me.
Thanks for the fix!
Cheers,
Keve

@severn-everett
Copy link

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')

@odaira
Copy link
Member

odaira commented Mar 4, 2019

@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?

@severn-everett
Copy link

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.

@odaira
Copy link
Member

odaira commented May 10, 2019

Fixed by 01a3657.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants