Integrated: 8246778: Compiler implementation for Sealed Classes (Second Preview)

Jan Lahoda jlahoda at
Mon Dec 7 11:14:14 UTC 2020

On Fri, 27 Nov 2020 16:57:54 GMT, Jan Lahoda <jlahoda at> wrote:

> This pull request replaces
> From the original PR:
>> Please review the code for the second iteration of sealed classes. In this iteration we are:
>>     * Enhancing narrowing reference conversion to allow for stricter checking of cast conversions with respect to sealed type hierarchies
>>     * Also local classes are not considered when determining implicitly declared permitted direct subclasses of a sealed class or sealed interface
>>     * renaming Class::permittedSubclasses to Class::getPermittedSubclasses, still in the same method, the return type has been changed to Class<?>[] instead of the previous ClassDesc[]
>>     * adding code to make sure that annotations can't be sealed
>>     * improving some tests
>> TIA
>> Related specs:
>> [Sealed Classes JSL](
>> [Sealed Classes JVMS](
>> [Additional: Contextual Keywords](
> This PR strives to reflect the review comments from 1227:
>  * adjustments to javadoc of j.l.Class methods
>  * package access checks in Class.getPermittedSubclasses()
>  * fixed to the narrowing conversion/castability as pointed out by Maurizio

This pull request has now been integrated.

Changeset: 637b0c64
Author:    Jan Lahoda <jlahoda at>
Stats:     1138 lines in 16 files changed: 1055 ins; 11 del; 72 mod

8246778: Compiler implementation for Sealed Classes (Second Preview)

Co-authored-by: Vicente Romero <vromero at>
Co-authored-by: Harold Seigel <hseigel at>
Reviewed-by: lfoltan, mchung, alanb, mcimadamore, chegar



More information about the compiler-dev mailing list