Sealed interfaces in qualified anonymous class instances - minor spec addition?

Manoj Palat manoj.palat at
Sat Jun 20 11:30:01 UTC 2020

>From jep 360 Section 15.9.1 [] second bullet, ie:
“If the class instance creation expression is qualified, then:
The Identifier in ClassOrInterfaceTypeToInstantiate must unambiguously denote an inner class that is accessible, non-final, non-sealed, not an enum type, and a member of the compile-time type of the Primary expression or the ExpressionName. Otherwise, a compile-time error occurs”,

I think we should add “or an interface that is non-sealed “ after enum type similar to the earlier bullet for completeness’ sake as illustrated in the code below

public class X {
public static void main(String[] args) {
new A.IY() {}; // Error since IY is sealed
class A {
sealed interface I permits IY{}
sealed interface IY extends I permits Z {}
final class Z implements IY{}


More information about the amber-spec-experts mailing list