RFR: 8298416: Console should be declared `sealed`

Jaikiran Pai jpai at openjdk.org
Tue Dec 13 04:39:13 UTC 2022


On Fri, 9 Dec 2022 20:14:53 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.

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

> 106:     public PrintWriter writer() {
> 107:         throw new UnsupportedOperationException(
> 108:                 "Console class itself does not provide implementation");

Hello Naoto, should we perhaps then mark this method (and thus the class too) as `abstract` and leave the sub-classes to provide this method's implementation? Same with the other methods where we now throw `UnsupportedOperationException`.

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

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


More information about the core-libs-dev mailing list