Add module-info.java

Issue #495 resolved
Mauro de Wit created an issue

It would be useful to have a module-info.java added. Is there a reason this file is not present yet?
If there is no specific reason, I’m willing to add one. This library is preventing me from creating a build with jlink now.

Is the class org.yaml.snakeyaml.Yaml the only required public API? (It is the only one I’m using, but my use-case is fairly simple)

Comments (15)

  1. Mauro de Wit reporter

    Aha, I wasn’t aware of that. If your plan is to keep this library on Java 7, then things should be left as they are now. The MANIFEST.MF file already contains a module name (org.snake.yaml) which makes it perfectly usable in most cases in java 9+.

    Alternatively the source and target level could be updated to version 9 and a module-info should be added to export only the public API. In my local build this works perfectly as far as I can tell. If you’re willing to go this path, I can create a PR.

  2. Василий Кудрявцев

    It is absolutely possible to add module-info and still be compatible with Java 7

    The trick is to compile all classes to java 7 bytecode and only module-info to java 9

    It works ok with android, too

    If you are ok with this approach, please reopen the issue, I will provide a pull request

  3. Andrey Somov

    Dear Василий, are you ready to jump into all the issues which may occur because of this change ? Spring Boot, Jackson, RAML and all the other projects which already use SnakeYAML. Do you confirm a commitment to explain and resolve any question which may happen because of the build process ? (the misunderstanding will happen, the JDK is not perfect)

  4. Василий Кудрявцев

    Andrey, I think, I am.

    I do not expect any problems (based on experience), but I up ready to investigate any issues and help with clarifications if required

  5. Andres Almiray

    while we wait for 2.0 to be released, it’s also possible to add a module-info.class using ModiTect and keep the JAR compatible with Java 8 or 7.

    If Interested I can send a PR.

  6. Andres Almiray

    Lovely! Then there’s nothing else to be done than patiently wait for the release. Thank you!

  7. Log in to comment