JDK-8362116 : System.in.read() etc. don't accept input once immediate Ctrl+D pressed in JShell
  • Type: Bug
  • Component: tools
  • Sub-Component: jshell
  • Affected Version: 26
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2025-07-14
  • Updated: 2025-07-15
  • Resolved: 2025-07-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26 masterFixed
Related Reports
Causes :  
Description
ADDITIONAL SYSTEM INFORMATION :
openjdk 26-ea 2026-03-17
OpenJDK Runtime Environment (build 26-ea+6-582)
OpenJDK 64-Bit Server VM (build 26-ea+6-582, mixed mode, sharing)

Windows 24H2

A DESCRIPTION OF THE PROBLEM :

This is a regression caused by the fact that the fix (https://github.com/openjdk/jdk/pull/25713 / https://github.com/openjdk/jdk/commit/9449fea2cd7aa7375f1b127e5f0d2a36ffaa1814) for JDK-8358552 is not sufficient. I personally tried to fix that bug by myself but gave up due to *this* regression.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. jdk-26/bin/jshell
2. jshell> IO.readln() or jshell> System.in.read()
3. Press Ctrl + D
4. Run 2. once again

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
JShell pauses for additional input like when 2.
ACTUAL -
JShell won't accept input and returns the same result as 3.

The fact that the empty lines between the commands and the results in $2 or later lack shows that JShell didn't pause there.

===== IO.readln() =====

jshell> IO.readln()

$1 ==> null

jshell> IO.readln()
$2 ==> null

jshell> IO.readln()
$3 ==> null

===== System.in.read() =====

jshell> System.in.read()

$1 ==> -1

jshell> System.in.read()
$2 ==> -1

jshell> System.in.read()
$3 ==> -1

jshell> System.in.read()
$4 ==> -1

---------- BEGIN SOURCE ----------
// JShell only
---------- END SOURCE ----------


Comments
Changeset: 40d159d4 Branch: master Author: Jan Lahoda <jlahoda@openjdk.org> Date: 2025-07-15 06:13:45 +0000 URL: https://git.openjdk.org/jdk/commit/40d159d4a9718d8db0aadf66b322583cd5246d0c
15-07-2025

The observations on Windows 11: JDK 25ea+5: Passed. JDK 25ea+6; Failed, can not accept inputs after pressing Ctrl+D. Impact -> H (Regression) Likelihood -> L (Early access release) Workaround -> M (Somewhere in-between the extremes) Priority -> P3
14-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/26292 Date: 2025-07-14 12:48:27 +0000
14-07-2025