-
Notifications
You must be signed in to change notification settings - Fork 236
feat: Add JPMS (Java Platform Module System) support #1374
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
Merged
Merged
+1,305
−428
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dfbe2df
to
3baaab1
Compare
Open
7 tasks
norrisjeremy
reviewed
Aug 7, 2025
7782a93
to
da99f27
Compare
This PR implements comprehensive Java Platform Module System (JPMS) support for JLine 4.0, enabling modular applications while maintaining full backward compatibility. ## Key Changes JPMS Modules (12 modules): - Core: terminal, reader, style, native - Providers: terminal-jni (recommended), terminal-ffm (JDK 22+), terminal-jna - Extended: builtins, console, console-ui, jansi-core, curses Automatic Modules (6 modules): - terminal-jansi (deprecated), groovy, remote-ssh, remote-telnet, demo, graal - Remain automatic for compatibility with complex dependencies Java 24 Support: - FFM (Foreign Function Memory) API integration - Requires --enable-native-access=org.jline.terminal.ffm on module path - Best performance terminal provider for modern JDK ## Technical Implementation Strong Encapsulation: - Proper module-info.java with explicit exports/requires - Internal APIs hidden from consumers - Service Provider Interface (SPI) for terminal providers Provider Recommendations: 1. JNI (recommended): No external dependencies, no special permissions, JDK 11+ 2. FFM (best performance): Requires --enable-native-access, JDK 22+ 3. JNA (alternative): Requires JNA dependency 4. Jansi (deprecated): Use JNI instead Key Technical Details: - JNI provider uses traditional JNI (no native access permissions needed) - FFM provider uses Panama FFM API (requires --enable-native-access) - Module path required for FFM native access to work - Service provider discovery for automatic terminal provider selection Backward Compatibility: - Classpath applications work unchanged - Uber-bundles (jline, jansi) remain as automatic modules - No breaking API changes ## Documentation Complete JPMS guide with migration instructions, provider selection recommendations, module path requirements for FFM native access, JNI vs FFM comparison and setup instructions, troubleshooting guide for common JPMS issues, and best practices for different application types. This migration provides the foundation for JLine's future development while ensuring existing applications continue to work seamlessly.
gnodet
added a commit
to gnodet/jline3
that referenced
this pull request
Aug 7, 2025
This PR implements comprehensive Java Platform Module System (JPMS) support for JLine 4.0, enabling modular applications while maintaining full backward compatibility. ## Key Changes JPMS Modules (12 modules): - Core: terminal, reader, style, native - Providers: terminal-jni (recommended), terminal-ffm (JDK 22+), terminal-jna - Extended: builtins, console, console-ui, jansi-core, curses Automatic Modules (6 modules): - terminal-jansi (deprecated), groovy, remote-ssh, remote-telnet, demo, graal - Remain automatic for compatibility with complex dependencies Java 24 Support: - FFM (Foreign Function Memory) API integration - Requires --enable-native-access=org.jline.terminal.ffm on module path - Best performance terminal provider for modern JDK ## Technical Implementation Strong Encapsulation: - Proper module-info.java with explicit exports/requires - Internal APIs hidden from consumers - Service Provider Interface (SPI) for terminal providers Provider Recommendations: 1. JNI (recommended): No external dependencies, no special permissions, JDK 11+ 2. FFM (best performance): Requires --enable-native-access, JDK 22+ 3. JNA (alternative): Requires JNA dependency 4. Jansi (deprecated): Use JNI instead Key Technical Details: - JNI provider uses traditional JNI (no native access permissions needed) - FFM provider uses Panama FFM API (requires --enable-native-access) - Module path required for FFM native access to work - Service provider discovery for automatic terminal provider selection Backward Compatibility: - Classpath applications work unchanged - Uber-bundles (jline, jansi) remain as automatic modules - No breaking API changes ## Documentation Complete JPMS guide with migration instructions, provider selection recommendations, module path requirements for FFM native access, JNI vs FFM comparison and setup instructions, troubleshooting guide for common JPMS issues, and best practices for different application types. This migration provides the foundation for JLine's future development while ensuring existing applications continue to work seamlessly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Complete JPMS Migration with Java 24 Support
This PR implements comprehensive Java Platform Module System (JPMS) support for JLine 4.0, enabling modular applications while maintaining full backward compatibility.
🎯 Key Achievements
✅ JPMS Modules (12 modules)
terminal
,reader
,style
,native
terminal-jni
(recommended),terminal-ffm
(Java 22+),terminal-jna
builtins
,console
,console-ui
,jansi-core
curses
(newly converted from automatic module)❌ Automatic Modules (6 modules)
terminal-jansi
(deprecated - use JNI instead),groovy
,remote-ssh
,remote-telnet
,demo
,graal
🚀 Java 24 Support
--enable-native-access=org.jline.terminal.ffm
on module path🔧 Technical Implementation
Strong Module Boundaries
Service Provider Interface
Recommended Provider Priority
org.jline.terminal.jni
) - No external dependencies, JDK 11+org.jline.terminal.ffm
) - Best performance, JDK 22+org.jline.terminal.jna
) - Alternative with JNA dependencyorg.jline.terminal.jansi
) - Deprecated, use JNI instead📋 Migration Guide
For New Modular Applications
For Existing Applications
jline
uber-jar (automatic module)FFM Provider Setup (JDK 22+)
🧪 Testing & Validation
mvn install
📚 Documentation
New JPMS Guide
Key Documentation Sections
🔄 Backward Compatibility
jline
,jansi
) remain as automatic modules🎁 Benefits
🏗️ Architecture
This migration establishes JLine as a modern, modular Java library ready for the next decade of Java development while ensuring existing applications continue to work seamlessly.