Files

8 lines
338 B
Java

/** Fails to compile on purpose: a class that is not in the permits list cannot extend a sealed type. */
public class SealedViolation {
sealed interface Shape permits Circle {}
record Circle(double r) implements Shape {}
record Triangle(double b, double h) implements Shape {}
public static void main(String[] args) { }
}