Skip to content

Add Java 9+ module support (JPMS) for jlink compatibility#196

Merged
rlm2002 merged 2 commits intowolfSSL:masterfrom
cconlon:moduleInfo
Feb 6, 2026
Merged

Add Java 9+ module support (JPMS) for jlink compatibility#196
rlm2002 merged 2 commits intowolfSSL:masterfrom
cconlon:moduleInfo

Conversation

@cconlon
Copy link
Copy Markdown
Member

@cconlon cconlon commented Feb 5, 2026

This PR adds Java 9+ module support (JPMS) to wolfCrypt JNI/JCE, enabling use with jlink for creating custom Java runtimes. We maintain full backward compatibility with Java 8, since module-info.java is conditionally compiled in based on Java version.

New Files:

  • src/java9/module-info.java - Module descriptor declaring com.wolfssl module
  • .github/workflows/java-module-test.yml - CI workflow validating module support

Modified Files:

  • build.xml - Added conditional compilation of module-info (Java 9+ only)
  • pom.xml - Added Maven profile for module-info compilation on Java 9+
  • README.md - Added documentation for module support and jlink usage

Both Ant and Maven use conditional compilation based on JDK version:

JDK Used to Build Resulting JAR
Java 8 Standard JAR (no module-info.class)
Java 9+ Modular JAR (includes module-info.class)

The module descriptor:

  • Declares module as com.wolfssl
  • Exports com.wolfssl and com.wolfssl.provider.jce packages
  • Declares uses java.security.Provider for ServiceLoader compatibility
  • Registers WolfCryptProvider as a java.security.Provider service

Addresses issue: wolfSSL/wolfssljni#85

Related to JSSE PR here: wolfSSL/wolfssljni#324

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Java Platform Module System (JPMS) support to wolfCrypt JNI/JCE, enabling the library to be used with jlink for creating custom Java runtimes while maintaining backward compatibility with Java 8.

Changes:

  • Added module descriptor (module-info.java) declaring the com.wolfssl.wolfcrypt module with exports for com.wolfssl.wolfcrypt and com.wolfssl.provider.jce packages
  • Implemented conditional compilation in both Ant and Maven build systems to include module-info only when building with Java 9+
  • Added comprehensive CI workflow testing module support on Java 11/17/21 and verifying Java 8 compatibility

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/java9/module-info.java Defines JPMS module descriptor with package exports, required modules, and service provider registration
build.xml Adds Java version detection and conditional compilation target for module-info with release=9
pom.xml Adds Maven profile that automatically activates on Java 9+ to compile module-info separately
README.md Documents module support, conditional compilation behavior, and provides jlink usage examples
.github/workflows/java-module-test.yml Comprehensive CI workflow testing module compilation, jlink integration, and Java 8 compatibility

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/java9/module-info.java Outdated
Comment thread .github/workflows/java-module-test.yml Outdated
@rlm2002 rlm2002 merged commit f194852 into wolfSSL:master Feb 6, 2026
78 checks passed
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

Successfully merging this pull request may close these issues.

3 participants