-
-
Notifications
You must be signed in to change notification settings - Fork 969
Upgrade JLine to 3.30.6 and Jansi to 2.4.2 #15367
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
base: 8.0.x
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 upgrades JLine from version 2.14.6 to 3.27.1 and Jansi from 1.18 to 2.4.1, requiring a comprehensive migration of all CLI-related code to the JLine 3 API. The changes address Java 24 compatibility warnings related to restricted method calls in the legacy Jansi version.
Changes:
- Updated JLine dependency from
jline:jline:2.14.6toorg.jline:jline:3.27.1and Jansi from1.18to2.4.1 - Migrated console infrastructure from JLine 2 API (
ConsoleReader,Terminal,Completer) to JLine 3 API (LineReader,Terminal,Completer) - Retained JLine 2 as a transitional dependency for Groovy 4.x's groovysh module compatibility, marked with TODO comments for removal when upgrading to Groovy 5
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| dependencies.gradle | Updates JLine version to 3.27.1, Jansi to 2.4.1, adds jline2 version variable for backward compatibility |
| grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java | Migrates from JLine 2 ConsoleReader to JLine 3 LineReader, updates terminal creation and history handling |
| grails-bootstrap/src/main/groovy/grails/build/logging/GrailsEclipseConsole.java | Updates terminal creation to use JLine 3 TerminalBuilder |
| grails-bootstrap/src/main/groovy/org/grails/build/interactive/CandidateListCompletionHandler.java | Converts from JLine 2 CompletionHandler to JLine 3 Completer interface |
| grails-shell-cli/src/main/groovy/org/grails/cli/GrailsCli.groovy | Updates interactive mode handling, terminal access, and history navigation for JLine 3 |
| grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/*.groovy | Updates all command completers to use JLine 3 Completer signature with Candidate objects |
| grails-shell-cli/src/main/groovy/org/grails/cli/interactive/completers/*.{java,groovy} | Migrates all completer implementations to JLine 3 API, replacing CharSequence with Candidate |
| grails-shell-cli/src/test/groovy/org/grails/cli/interactive/completers/RegexCompletorSpec.groovy | Updates tests to use JLine 3 API with ParsedLine and Candidate |
| grails-console/build.gradle, gradle/docs-dependencies.gradle | Adds both JLine 3 and JLine 2 dependencies with TODO comments |
| build-logic/plugins/src/main/groovy/org/apache/grails/buildsrc/SbomPlugin.groovy | Updates license mapping for JLine 3.27.1 to BSD-3-Clause |
| Multiple build.gradle files | Updates JLine dependency references from jline:jline to org.jline:jline |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
...s-bootstrap/src/main/groovy/org/grails/build/interactive/CandidateListCompletionHandler.java
Outdated
Show resolved
Hide resolved
grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreateAppCommand.groovy
Show resolved
Hide resolved
...s-shell-cli/src/main/groovy/org/grails/cli/profile/commands/ArgumentCompletingCommand.groovy
Outdated
Show resolved
Hide resolved
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
958bfea to
5d68523
Compare
5d68523 to
57e5cbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Show resolved
Hide resolved
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
Closes #13752 - Update jline from 2.14.6 to 3.30.6 (org.jline:jline) - Update jansi from 1.18 to 2.4.2 - Migrate all CLI code from JLine 2 API to JLine 3 API: - ConsoleReader -> LineReader/Terminal - jline.console.completer.Completer -> org.jline.reader.Completer - complete(buffer, cursor, candidates) -> complete(reader, line, candidates) - CharSequence candidates -> Candidate objects - Keep JLine 2 (jline:jline:2.14.6) for groovy-groovysh compatibility (Groovy 4.x groovysh requires JLine 2; Groovy 5.x uses JLine 3) - Add TODO comments for JLine 2 removal when upgrading to Groovy 5 - Add JLine 3.30.6 license mapping in SbomPlugin (BSD-3-Clause) - Update RegexCompletorSpec tests for JLine 3 API - Fix history handling to properly attach to LineReader - Fix completion candidates to use full names instead of suffixes - Remove unused imports and fields - Use AggregateCompleter to support multiple completers - Fix readLine method signature for JLine 3 API - Sync jansi version in grails-forge to 2.4.2
57e5cbe to
b4e78a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 36 out of 36 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 44 out of 44 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
Outdated
Show resolved
Hide resolved
grails-shell-cli/src/main/groovy/org/grails/cli/GrailsCli.groovy
Outdated
Show resolved
Hide resolved
GrailsConsole improvements: - Use updateCompleter() with LineReaderImpl.setCompleter() instead of rebuilding the entire LineReader when completers are added - Add dedicated initializeHistory() method that properly attaches DefaultHistory to the LineReader after construction - CandidateListCompletionHandler: Auto-complete common prefix in buffer GrailsCli improvements: - Replace manual terminal attribute manipulation and input polling with JLine 3's native Terminal.Signal.INT handler for CTRL+C cancellation - This is the idiomatic way to handle interrupts in JLine 3 Test coverage: - Add comprehensive tests for GrailsConsole completer management - Add tests for CandidateListCompletionHandler - Add tests for all CLI completers: StringsCompleter, RegexCompletor, ClosureCompleter, SortedAggregateCompleter, EscapingFileNameCompletor, SimpleOrFileNameCompletor, and CommandCompleter
2074cbf to
d86a398
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 44 out of 44 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Closes #13752
This PR upgrades JLine from 2.14.6 to 3.30.6 and Jansi from 1.18 to 2.4.2, migrating all CLI code to the JLine 3 API.
Commits
Changes
Dependency Updates
jline.version:2.14.6→3.30.6(noworg.jline:jline)jansi.version:1.18→2.4.2jline2.version: '2.14.6'for Groovy 4.x compatibilityJLine 3 Migration
jline.console.ConsoleReadertoorg.jline.reader.LineReader/org.jline.terminal.TerminalCompleterimplementations to use new signature:complete(LineReader, ParsedLine, List<Candidate>)CharSequencecandidates withCandidateobjectsTerminalBuilder"dumb".equals(terminal.getType())AggregateCompleterto support multiple completers in GrailsConsolePerformance & UX Improvements
updateCompleter()instead of rebuilding LineReader when adding completersGroovy 4.x Compatibility
jline:jline:2.14.6) as a dependency forgroovy-groovyshcompatibilityjline.*vsorg.jline.*)Files Modified
grails-bootstrap,grails-shell-cli,grails-console,grails-gradle/model, and build configurationNew Test Coverage (~100+ test cases)
New Test Specifications:
StringsCompleterSpec- 20+ tests for string-based completion (edge cases, unicode, special characters)SortedAggregateCompleterSpec- 10 tests for aggregate completer functionalityClosureCompleterSpec- 8 tests for closure-based completion (lazy evaluation, caching)EscapingFileNameCompletorSpec- 10 tests for file name completion with whitespace escapingSimpleOrFileNameCompletorSpec- 12 tests for combined fixed options + file completionCommandCompleterSpec- 12 tests for command completion delegationCandidateListCompletionHandlerSpec- 20+ tests for completion handler and common prefix detectionGrailsConsoleCompleterSpec- 15+ tests for console completer managementEnhanced Existing Tests:
RegexCompletorSpec- Added 10+ edge case tests for regex-based completionTesting Verification
classes,test,installDist,grails-gradle build,grails-forge classesStats