RFR: 8361613: System.console() should only be available for interactive terminal [v3]
Naoto Sato
naoto at openjdk.org
Tue Jul 15 16:28:48 UTC 2025
On Tue, 15 Jul 2025 14:31:45 GMT, Xueming Shen <sherman at openjdk.org> wrote:
>> Maybe I missed it, but do we have anything to make it clear that it returns null if either stdin or stdout are redirected?
>
> we do have wordings like " If the virtual machine is started from an interactive command line without redirecting the standard input AND output streams then its console will exist ..." and "If no console device is
> available then an invocation of that method will return <tt>null</tt>" from the very beginning. not very "straightforward" but i think it's clear enough?
I think adding `@see` tag would be more helpful.
As to the spec wording wrt stdin/out, there is another issue filed to make it clearer: JDK-8361972. This PR addresses the implementation part only so that it can be backported to prior LTSes without spec change.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26273#discussion_r2207973733
More information about the compiler-dev
mailing list