Java language

non-sealed

Reopens a branch whose direct superclass or superinterface is sealed. Future indirect descendants are not individually listed by the sealed root. Java 17+.

Formal Syntax & Structure

java syntaxjava
non-sealed class CustomNotice extends Notice { ... }

Working Example

Example Snippetjava
public class Main {    static sealed abstract class Notice permits Receipt, CustomNotice {        abstract String label();    }    static final class Receipt extends Notice {        String label() { return "receipt"; }    }    static non-sealed class CustomNotice extends Notice {        String label() { return "custom"; }    }    static final class Reminder extends CustomNotice {        @Override String label() { return "reminder"; }    }    public static void main(String[] args) {        Notice a = new Receipt();        Notice b = new Reminder();        System.out.println(a.label());        System.out.println(b.label());    }}
Java Reference