On Mon, 7 Dec 2020 19:51:38 GMT, Harold Seigel <hsei...@openjdk.org> wrote:

> Please review this fix for JDK-8256867.  This change no longer throws a 
> ClassFormatError exception when loading a class whose PermittedSubclasses 
> attribute is empty (contains no classes).  Instead, the class is treated as a 
> sealed class which cannot be extended nor implemented.  This new behavior 
> conforms to the JVM Spec.
> 
> This change required changing Class.permittedSubclasses() to return an empty 
> array for classes with empty PermittedSubclasses attributes, and to return 
> null for non-sealed classes.
> 
> This fix was tested with Mach5 tiers 1-2 on Linux, MacOS, and Windows, and 
> tiers 3-5 on Linux x64.
> 
> Thanks, Harold

Changes looks good Harold.
Lois

src/hotspot/share/prims/jvm.cpp line 2130:

> 2128:     JvmtiVMObjectAllocEventCollector oam;
> 2129:     Array<u2>* subclasses = ik->permitted_subclasses();
> 2130:     int length = subclasses == NULL ? 0 : subclasses->length();

Minor comment - you don't really need the check of subclasses == NULL here 
since subclasses will never be NULL.  You could just assign length to 
subclasses->length();

-------------

Marked as reviewed by lfoltan (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/1675

Reply via email to