JDK-8246379 : Sealed Classes: Prohibit member classes of local/anonymous classes
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-06-02
  • Updated: 2020-11-26
  • Resolved: 2020-11-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16Fixed
Related Reports
Relates :  
Relates :  
Description
Per this design discussion:

https://mail.openjdk.java.net/pipermail/amber-spec-experts/2020-May/002161.html

The consensus is that, at least until we revisit the topic, member classes of local/anonymous classes should not be allowed to use the 'sealed' modifier or to extend/implement a sealed class or interface.

The sealed-classes-jls spec change document should be updated accordingly.
Comments
Fixed in the latest version of the spec. See: https://bugs.openjdk.java.net/browse/JDK-8246776
26-11-2020

[~dholmes] Correct. This has been fixed in the latest spec. https://bugs.openjdk.java.net/browse/JDK-8246776
26-11-2020

Just to be clear, this is a language-level constraint only, with no impact on the VM's processing of such classes?
03-06-2020