RFR: 8246778: Compiler implementation for Sealed Classes (Second Preview)

Mandy Chung mchung at openjdk.java.net
Tue Nov 24 23:02:53 UTC 2020

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}".

[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