The (potential) Return Of The Constant Interface Pattern

Christian Stein sormuras at gmail.com
Thu Dec 19 17:10:57 UTC 2019


Hi.

After reading https://https://openjdk.java.net/jeps/360 I wonder
if an empty set of permits is allowed for an sealed interface.

Something like this:

    sealed interface Constant permits EMPTY_SET {
      Number N = 123;
    }

Looking at resurrecting the "constant interface pattern" --
without the disadvantage of somebody being able to
implement that interface even in the same maintenance
domain as the type itself.

Cheers,
Christian


More information about the amber-dev mailing list