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.


+      * @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

Reply via email to