RFR: 8246778: Compiler implementation for Sealed Classes (Second Preview)
Remi Forax
forax at univ-mlv.fr
Tue Nov 24 23:18:55 UTC 2020
----- Mail original -----
> De: "Mandy Chung" <mchung at openjdk.java.net>
> À: "compiler-dev" <compiler-dev at openjdk.java.net>, "core-libs-dev" <core-libs-dev at openjdk.java.net>, "hotspot-dev"
> <hotspot-dev at openjdk.java.net>
> Envoyé: Mercredi 25 Novembre 2020 00:02:53
> Objet: Re: RFR: 8246778: Compiler implementation for Sealed Classes (Second Preview)
> On Tue, 17 Nov 2020 00:25:51 GMT, Mandy Chung <mchung at openjdk.org> wrote:
>
>>> src/java.base/share/classes/java/lang/Package.java line 227:
>>>
>>>> 225: * This method reports on a distinct concept of sealing from
>>>> 226: * {@link Class#isSealed() Class::isSealed}.
>>>> 227: *
>>>
>>> This API note will be very confusing to readers. I think the javadoc will need
>>> to be fleshed out and probably will need to link to a section the Package class
>>> description that defines the legacy concept of sealing.
>>
>> I agree. This @apiNote needs more clarification to help the readers to
>> understand the context here. One thing we could do in the Package class
>> description to add a "Package Sealing" section that can also explain that it
>> has no relationship to "sealed classes".
>
> I added an API note in `Package::isSealed` [1] to clarify sealed package vs
> sealed class or interface.
>
> The API note you added in `Class::isSealed` can be clarified in a similar
> fashion like: "Sealed class or interface has no relationship with {@linkplain
> Package#isSealed package sealing}".
Hi Mandy,
given that almost nobody knows about sealed packages, i'm not sure that adding a reference to Package::isSealed in Class::isSealed actually helps, it might be confusing.
>
> [1] https://github.com/openjdk/jdk/commit/3c230b8a
>
> -------------
>
> PR: https://git.openjdk.java.net/jdk/pull/1227
More information about the compiler-dev
mailing list