RFR: JDK-8225056 VM support for sealed classes

David Holmes david.holmes at oracle.com
Wed May 20 23:44:39 UTC 2020


Hi Vicente,

On 21/05/2020 1:40 am, Vicente Romero wrote:
> Hi David,
> 
>> src/java.base/share/classes/java/lang/Class.java
>>
>> There needs to be a CSR request for these changes.
> 
> yes there is one already: https://bugs.openjdk.java.net/browse/JDK-8244556
>>
>> +      * Returns an array containing {@code ClassDesc} objects 
>> representing all the
>> +      * permitted subclasses of this {@linkplain Class} if it is 
>> sealed. Returns an empty array if this
>> +      * {@linkplain Class} is not sealed.
>>
>> should add "or this class represents an array or primitive type" 
>> (using the standard wording for such cases).
> 
> well given that array and primitive classes are not sealed classes I 
> think we are already covered by the method's spec.

Yes, now I've seen the JLS updates, this is more clear to me.

Thanks,
David
-----

>>
>> +      * @throws IllegalArgumentException if a class descriptor is not 
>> in the correct format
>>
>> IllegalArgumentException is not an appropriate exception to use as 
>> this method takes no arguments. If the class descriptor is not valid 
>> and it comes from the VM then I think we have a problem with how the 
>> VM validates class descriptors. Any IAE from ClassDesc.of should be 
>> caught and converted to a more suitable exception type - preferably 
>> InternalError if the VM should always return valid strings.
> 
> we agree with you here, this will be fixed in the next review iteration.
> 
>>
>> +     public ClassDesc[] getPermittedSubclasses() {
>>
>> As mentioned for jvm.cpp this Java code should do the isArray() and 
>> isPrimitive() check before calling the VM.
> 
> agreed.
> 
>>
> Thanks,
> Vicente


More information about the core-libs-dev mailing list