RFR: 8298416: Console should be declared `sealed`

Jaikiran Pai jpai at openjdk.org
Tue Dec 13 04:50:01 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/ConsoleImpl.java line 198:

> 196:     private Writer out;
> 197:     private PrintWriter pw;
> 198:     private Formatter formatter;

It looks like we can mark `readLock`, `writeLock`, `reader`, `out`, `pw` and `formatter` as `final`.

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

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


More information about the core-libs-dev mailing list