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

Add Java 9/JPMS module support #116

Open
thekalinga opened this issue Sep 5, 2020 · 2 comments
Open

Add Java 9/JPMS module support #116

thekalinga opened this issue Sep 5, 2020 · 2 comments

Comments

@thekalinga
Copy link

Currently even latest version 2.0.1 of the library does not have support for java modules. Since this is a utility, its will everyone who want to use this with JPMS modules post Java-9

@thekalinga
Copy link
Author

thekalinga commented Sep 5, 2020

As of now temporarily using gradle's plugin to create a module-info.java module with the following info

plugins {
    java
    id("de.jjohannes.extra-java-module-info") version "0.1"
}

extraJavaModuleInfo {
    module("nuprocess-2.0.1.jar", "com.zaxxer.nuprocess", "2.0.1") {
        exports("com.zaxxer.nuprocess")

        requires("com.sun.jna")
    }
}

And the plugin automatically generates the following module-info.class as part of the build process

open module com.zaxxer.nuprocess {
  requires java.base;
  requires com.sun.jna;

  exports com.zaxxer.nuprocess;
}

@bturner
Copy link
Collaborator

bturner commented Aug 17, 2022

2.0.4 will add Automatic-Module-Name to the manifest, which should get you at least part of the way there. I'll need to do a little more investigation on what my options are for retaining Java 8 support (technically Java 7, but it's pretty difficult to actually build this library with that) while introducing full module support. Further progress on this may need to wait for a NuProcess 3.0 that drops support for Java 8.

It's worth noting that, unfortunately, workarounds like this don't work for NuProcess because it uses java.nio.ByteBuffer and there are binary-incompatible return type changes to methods on that class. That means if you compile NuProcess with Java 9+, even targeting Java 8 bytecode, the result is broken on Java 8 (see #128). To get a NuProcess jar that works correctly with Java 8, it must actually be compiled with Java 8.

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

2 participants