RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v12]
Jan Lahoda
jlahoda at openjdk.java.net
Fri Jun 4 20:20:29 UTC 2021
On Fri, 4 Jun 2021 18:23:28 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fixing typo.
>
> test/langtools/tools/javac/patterns/SealedTypeChanges.java line 71:
>
>> 69: }
>> 70:
>> 71: sealed interface SealedTypeChangesIntf permits SealedTypeChanges.A {}
>
> just for completeness shouldn't we have a test with sealed, non-abstract classes?
Note that for sealed non-abstract classes, the permits is not checked (as an instance of the non-abstract class may be created and passed to the switch, the switch needs to contain a case that will cover the class anyway). I've added tests that check the behavior for abstract class, and non-abstract classes (error is produced in the latter case).
-------------
PR: https://git.openjdk.java.net/jdk/pull/3863
More information about the compiler-dev
mailing list