Console should be declared `sealed`

XMLWordPrintable

    • Type: CSR
    • Resolution: Approved
    • Priority: P4
    • 21
    • Component/s: 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

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

              Created:
              Updated:
              Resolved: