Java

JAVA Sealed Classes were proposed by JEP 360 and delivered in JDK 15 as a preview feature.  They were proposed again, with refinements, by JEP 397 and delivered  in JDK 16 as a preview feature. This JEP proposes to finalize Sealed  Classes in JDK 17, with no changes from JDK 16.

- Techshitanshu

java

Goals Sealed classes will allow the author of a class  or interface to control which code is responsible for implementing it.

– Techshitanshu

java

Goals Provides a more declarative way than access modifiers to restrict the use of a superclass.

– Techshitanshu

java

Goals Support future directions in pattern matching by providing a foundation for the exhaustive analysis of patterns

– Techshitanshu

java

Non-Goals It is not a goal to provide new forms of access control such as “friends”

– Techshitanshu

java

Non-Goals It is not a goal to change final in any way, so no need to get confused.

– Techshitanshu