Skip to content

Conversation

@naotoj
Copy link
Member

@naotoj naotoj commented Mar 11, 2025

JDK has been using JLine based Console implementation, in JDK20 as opt-in, then in JDK22 as the default. While it has been providing rich functionality for Console, it is increasingly difficult to maintain as a Console implementation. In light of the on-ramp feature (https://bugs.openjdk.org/browse/JDK-8344699), which proposes switching java.lang.IO class to use System.in and System.out instead of Console, reverting the default Console implementation to JDK's built-in one in the java.base module is considered desirable. Some tests are modified along with this change, among them test/jdk/java/io/Console/ConsolePromptTest.java changes were contributed by @lahodaj (thanks!)


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires CSR request JDK-8351573 to be approved

Issues

  • JDK-8351435: Change the default Console implementation back to the built-in one in java.base module (Enhancement - P4)
  • JDK-8351573: Change the default Console implementation back to the built-in one in java.base module (CSR)

Reviewers

Contributors

  • Jan Lahoda <jlahoda@openjdk.org>

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23993/head:pull/23993
$ git checkout pull/23993

Update a local copy of the PR:
$ git checkout pull/23993
$ git pull https://git.openjdk.org/jdk.git pull/23993/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23993

View PR using the GUI difftool:
$ git pr show -t 23993

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23993.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 11, 2025

👋 Welcome back naoto! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Mar 11, 2025

@naotoj This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8351435: Change the default Console implementation back to the built-in one in `java.base` module

Co-authored-by: Jan Lahoda <jlahoda@openjdk.org>
Reviewed-by: alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 277 new commits pushed to the master branch:

  • 7a2e198: 8352277: java.security documentation: incorrect regex syntax describing "usage" algorithm constraint
  • b7ca76e: 8353235: Test jdk/jfr/api/metadata/annotations/TestPeriod.java fails with IllegalArgumentException
  • bbd5b17: 8339280: jarsigner -verify performs cross-checking between CEN and LOC
  • d4d1835: 8352860: Open source events tests batch0
  • c9c3c15: 8330598: java/net/httpclient/Http1ChunkedTest.java fails with java.util.MissingFormatArgumentException: Format specifier '%s'
  • 804a8fa: 8352765: G1CollectedHeap::expand_and_allocate() may fail to allocate even after heap expansion succeeds
  • 22f630c: 8352415: x86: Tighten up template interpreter method entry code
  • 6fbaa06: 8353176: C1: x86 patching stub always calls Thread::current()
  • 79d0c94: 8352114: New test runtime/interpreter/CountBytecodesTest.java is failing
  • 23e3b3f: 8351156: C1: Remove FPU stack support after 32-bit x86 removal
  • ... and 267 more: https://git.openjdk.org/jdk/compare/8450ae902ee012b6447015b24369eee85c091ec5...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels Mar 11, 2025
@openjdk
Copy link

openjdk bot commented Mar 11, 2025

@naotoj The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Mar 11, 2025
@mlbridge
Copy link

mlbridge bot commented Mar 11, 2025

Webrevs

@naotoj
Copy link
Member Author

naotoj commented Mar 11, 2025

/contributor add @lahodaj

@openjdk
Copy link

openjdk bot commented Mar 11, 2025

@naotoj
Contributor Jan Lahoda <jlahoda@openjdk.org> successfully added.

// check "expect" command availability
var expect = Paths.get("/usr/bin/expect");
if (!Files.exists(expect) || !Files.isExecutable(expect)) {
System.out.println("'expect' command not found. Test ignored.");
Copy link
Member

Choose a reason for hiding this comment

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

Hello Naoto, I think throwing a jtreg.SkippedException might be better here so that it's clear that the test was skipped. There have been recent reporting improvements too which make it easier to notice such skipped tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. Modified the piece (w/ some other minor changes)

@naotoj naotoj changed the title 8351435: Change JLine Console implementation back to opt-in 8351435: Change the default Console implementation back to the built-in one in java.base module Mar 13, 2025
@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Mar 24, 2025
var file = Path.of(System.getProperty("test.src", "."), "Output.java")
.toAbsolutePath().toString();
var pb = ProcessTools.createTestJavaProcessBuilder("--enable-preview", file, mode);
var pb = ProcessTools.createTestJavaProcessBuilder("-Djdk.console=jdk.internal.le", "--enable-preview", file, mode);
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you looked into changing the test so that it runs twice, the second with the jline provider?

Copy link
Member Author

Choose a reason for hiding this comment

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

The child java process Output.java calls System.console(), so the launcher has to be run with -Djdk.console=jdk.internal.le, otherwise NPE is thrown in Output.java.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay, no console in the child process for this implementation.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Mar 31, 2025
@naotoj
Copy link
Member Author

naotoj commented Mar 31, 2025

Thanks for the reviews!
/integrate

@openjdk
Copy link

openjdk bot commented Mar 31, 2025

Going to push as commit 4247744.
Since your change was applied there have been 280 commits pushed to the master branch:

  • 9c06dcb: 8349583: Add mechanism to disable signature schemes based on their TLS scope
  • cd5a43a: 8353126: Open source events tests batch1
  • e4e6278: 8346129: Simplify EdDSA & XDH curve name usage
  • 7a2e198: 8352277: java.security documentation: incorrect regex syntax describing "usage" algorithm constraint
  • b7ca76e: 8353235: Test jdk/jfr/api/metadata/annotations/TestPeriod.java fails with IllegalArgumentException
  • bbd5b17: 8339280: jarsigner -verify performs cross-checking between CEN and LOC
  • d4d1835: 8352860: Open source events tests batch0
  • c9c3c15: 8330598: java/net/httpclient/Http1ChunkedTest.java fails with java.util.MissingFormatArgumentException: Format specifier '%s'
  • 804a8fa: 8352765: G1CollectedHeap::expand_and_allocate() may fail to allocate even after heap expansion succeeds
  • 22f630c: 8352415: x86: Tighten up template interpreter method entry code
  • ... and 270 more: https://git.openjdk.org/jdk/compare/8450ae902ee012b6447015b24369eee85c091ec5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 31, 2025
@openjdk openjdk bot closed this Mar 31, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Mar 31, 2025
@openjdk
Copy link

openjdk bot commented Mar 31, 2025

@naotoj Pushed as commit 4247744.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants