Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8351573

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • core-libs
    • None
    • behavioral
    • medium
    • Hide
      The built-in Console implementation in the java.base module may not be available if the underlying host environment does not provide a terminal. This was the behavior prior to JDK 22, but applications developed after that may not expect System.console() to return null when no terminal is attached.
      Show
      The built-in Console implementation in the java.base module may not be available if the underlying host environment does not provide a terminal. This was the behavior prior to JDK 22, but applications developed after that may not expect System.console() to return null when no terminal is attached.
    • Other
    • Implementation

      Summary

      Change the default Console implementation returned by System.console() from the JLine-based implementation to the built-in one in the java.base module.

      Problem

      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. Examples are terminal escape sequence handling (https://bugs.openjdk.org/browse/JDK-8348052) and signal handling (https://bugs.openjdk.org/browse/JDK-8346805)

      Solution

      In light of the on-ramp feature (https://bugs.openjdk.org/browse/JDK-8344699), which proposes switching the 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.

      Specification

      N/A. Behavior change only.

            naoto Naoto Sato
            naoto Naoto Sato
            Stuart Marks
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: