RFR: JDK-8225056 VM support for sealed classes

Harold Seigel harold.seigel at oracle.com
Thu May 28 22:31:46 UTC 2020


Hi Mandy,

The entries in the PermittedSubclasses attribute are constant pool 
ConstantClass_info entries.  These names get validated by the VM in this 
code in ClassFileParser::parse_constant_pool():

       for (index = 1; index < length; index++) {
         const jbyte tag = cp->tag_at(index).value();
         switch (tag) {
           case JVM_CONSTANT_UnresolvedClass: {
             const Symbol* const class_name = cp->klass_name_at(index);
             // check the name, even if _cp_patches will overwrite it
    *verify_legal_class_name(class_name, CHECK);*
             break;
           }

Thanks, Harold


On 5/28/2020 5:12 PM, Mandy Chung wrote:
> I read the JVMS but it isn't clear to me that the VM will validate the 
> names in `PermittedSubclasses`attribute are valid class descriptors.   
> I see ConstantPool::is_klass_or_reference check but can't find where 
> it validates the name is a valid class descriptor - can you point me 
> there?   (otherwise, maybe define it to be unspecified?)
>


More information about the core-libs-dev mailing list