RFR: 8298416: Console should be declared `sealed` [v3]

Alan Bateman alanb at openjdk.org
Thu Dec 15 12:28:09 UTC 2022


On Wed, 14 Dec 2022 17:35:46 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> `Console` class now has a couple of internal subclasses within `java.io` package. It should be `sealed` and subclasses be declared in the `permits` clause. The implementation resided in `Console` class is separated into `ConsoleImpl` class.
>
> Naoto Sato has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Moved echo() to ConsoleImpl, clean-ups

Good.

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

> 109:     public PrintWriter writer() {
> 110:         throw new UnsupportedOperationException(
> 111:                 "Console class itself does not provide implementation");

Minor comment is the same "throw new UOE(message)" is repeated in every method. You could add a static method to return it, then it would reduce to "throw newUnsupportedOperationException();".

Also looks like the method descriptions on all these methods starts at position 3. Pre-dates your change but since every method is changed then maybe we should fix that too, up to you.

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

Marked as reviewed by alanb (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11615


More information about the core-libs-dev mailing list