RFR: JDK-8322878: Including sealing information Class.toGenericString()
Pavel Rappo
prappo at openjdk.org
Wed Jan 3 16:43:47 UTC 2024
On Wed, 3 Jan 2024 14:59:33 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> As recently discussed on core libs, sealed-ness information could be included in the Class.toGenericString() output, analagous to how "modifiers" that also correspond to JVM access flags are handled.
>>
>> This is the initial spec, implementation, and test updated needed for that change. If there is consensus this is a reasonable direction, I'll create the CSR, etc.
>
> src/java.base/share/classes/java/lang/Class.java line 264:
>
>> 262: /**
>> 263: * Returns a string describing this {@code Class}, including
>> 264: * information about modifiers, {@linkplain #isSealed() sealing}, and type parameters.
>
> If Class.toGenericString is a useful API point for describing the blessed order of modifiers in the JDK
> perhaps the existing classes that describe modifiers could/should cross reference this method.
Given potential lossiness of source modifiers presentation by java.lang.reflect, I don't think this method is a good host for describing the canonical modifier order. Mentioning? Probably. Describing? No.
Separately, but also related: while it does not seem impossible, this PR does not implement `non-sealed`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17239#discussion_r1440663061
More information about the core-libs-dev
mailing list