RFR: 8305457: Implement java.io.IO

Naoto Sato naoto at openjdk.org
Tue May 7 16:37:55 UTC 2024


On Mon, 6 May 2024 21:45:12 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> Please review this PR which introduces the `java.io.IO` top-level class and three methods to `java.io.Console` for [Implicitly Declared Classes and Instance Main Methods (Third Preview)].
> 
> This PR has been obtained as `git merge --squash` of a now obsolete [draft PR].
> 
> [Implicitly Declared Classes and Instance Main Methods (Third Preview)]: https://bugs.openjdk.org/browse/JDK-8323335
> [draft PR]: https://github.com/openjdk/jdk/pull/18921

Looks good overall. Left some minor comments.

src/java.base/share/classes/java/io/Console.java line 189:

> 187:     /**
> 188:      * Writes a prompt as if by calling {@code print}, then reads a single line
> 189:      * of text from this system console.

Nit: I would not add `system` here as `this console` is consistent with other locations.

src/java.base/share/classes/java/io/ProxyingConsole.java line 107:

> 105:      * {@inheritDoc}
> 106:      *
> 107:      * @throws IOError {@inheritDoc}

Probably I am missing something, but I see `Console` declares this throws clause. Do we need this inheritDoc here?

test/jdk/java/io/IO/IO.java line 99:

> 97:                 System.getProperty("test.jdk") + "/bin/java",
> 98:                 "--enable-preview",
> 99:                 "-Djdk.console=gibberish",

The test comment suggests this test is testing the default console implementation, but the invocation specifies `-Djdk.console=gibberish` which defaults to java.base. Is this what you intended?

test/jdk/java/io/IO/Input.java line 33:

> 31:         System.out.print(readln("?"));
> 32:     }
> 33: }

Needs a newline

-------------

PR Review: https://git.openjdk.org/jdk/pull/19112#pullrequestreview-2041904750
PR Review Comment: https://git.openjdk.org/jdk/pull/19112#discussion_r1591704961
PR Review Comment: https://git.openjdk.org/jdk/pull/19112#discussion_r1592764263
PR Review Comment: https://git.openjdk.org/jdk/pull/19112#discussion_r1592773917
PR Review Comment: https://git.openjdk.org/jdk/pull/19112#discussion_r1592776068


More information about the core-libs-dev mailing list