RFR: JDK-8227046: compiler implementation for sealed classes, JDK-8227047: Javadoc for sealed types and JDK-8227044: javax.lang.model for sealed classes
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu May 21 12:20:34 UTC 2020
On 21/05/2020 06:31, Joe Darcy wrote:
> Hi Jan,
>
> On 5/19/2020 5:44 AM, Jan Lahoda wrote:
>> Hi Vicente,
>>
>> javac changes look overall OK to me.
>>
>>
> [snip]
>
>
>> -regarding TypeElement#getPermittedSubclasses: it currently returns
>> List<? extends TypeMirror>; I wonder if returning List<? extends
>> TypeElement> would be better?
>>
> I did discuss this design point with Vicente ahead of time. While we
> could probably get away with List<TypeElement> here with the current
> design, I think List<TypeMirror> is more in keeping with
> TypeElement.getSuperclass returning a TypeMirror.
What do you think, in general of the 'getPermittedSubclasses' name? This
term doesn't seem to apply to interfaces, as per section 8.1.4:
" The optional extends clause in a normal class declaration specifies
the direct superclass of the current class. "
...
"A class is said to be a direct subclass of its direct superclass. The
direct superclass is the class from whose implementation the
implementation of the current class is derived. "
"The subclass relationship is the transitive closure of the direct
subclass relationship. A class A is a subclass of class C if either of
the following is true:
A is the direct subclass of C
There exists a class B such that A is a subclass of B, and B is a
subclass of C, applying this definition recursively.
"
So, if I have:
sealed interface A permits I1, I2 { ... }
sealed interface I1 { ... }
sealed interface I2 { ... }
Having a method called 'getPermittedSubclasses' give me the mirrors for
I1 and I2 seems odd.
Maurizio
>
> Thanks,
>
> -Joe
>
More information about the compiler-dev
mailing list