RFR: JDK-8247849: permits clause of sealed interfaces should not allow parameterized types

Jan Lahoda jan.lahoda at oracle.com
Thu Jun 18 20:04:28 UTC 2020

Hi Vicente,

Overall looks good to me. My only comment for JavacParser is that maybe 
we could pass the string "class"/"interface" to the permitsClause 
method, instead of the boolean, although I do not feel strongly about that.

In tests, in the second part that should verify that primitive types are 
not allowed, should there be the '#' markers instead of "Sub[]" in e.g.:
sealed class C<T> permits Sub[] {}
sealed class C<T> permits # {}

(Tests for arrays of primitive types might also be included, for good 


On 18. 06. 20 19:33, Vicente Romero wrote:
> Please review fix for [1] at [2]. I forgot to check that the `permits` 
> clause of interfaces can't list any parameterized type, which is already 
> done for classes. Now I have extracted the common code for classes and 
> interfaces, the one that takes care of the `permits` clause, to avoid 
> this kind of issues in the future,
> Thanks,
> Vicente
> [1] https://bugs.openjdk.java.net/browse/JDK-8247849
> [2] http://cr.openjdk.java.net/~vromero/8247849/webrev.00/

More information about the compiler-dev mailing list