Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8298502

Console should be declared `sealed`

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • core-libs
    • None
    • minimal
    • Java API
    • SE

      Summary

      Add sealed to the class signature of java.io.Console class declaration

      Problem

      With the change to JDK-8295803, java.io.Console class removed final classifier, thus it is possible to have an arbitrary subclass in the java.io package. Limiting this to known internal implementations improves platform integrity.

      Specification

      Change the declaration of java.io.Console class from

      public class Console implements Flushable

      to

      public sealed class Console implements Flushable permits ClassA, ClassB, ...

      ClassA, ClassB, ...: package private classes in java.io. Names to be defined

            naoto Naoto Sato
            naoto Naoto Sato
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: