In the following code the error is not precise. The message reads "subclass B must extend sealed class". However, B is a "record" and does not "implement" the sealed "interface" B. The error can be improved by pointing to the accurate program elements by mentioning either "extends sealed class" or "implements sealed interface", alongside the correct kind, one of class/enum/record/interface.
sealed interface A permits B {}
record B() {}
emits the following
error: invalid permits clause
sealed interface A permits B {}
^
(subclass B must extend sealed class)
1 error
error: compilation failed
sealed interface A permits B {}
record B() {}
emits the following
error: invalid permits clause
sealed interface A permits B {}
^
(subclass B must extend sealed class)
1 error
error: compilation failed
- links to
-
Commit(master) openjdk/jdk/50a7755f
-
Review(master) openjdk/jdk/25255