@@ -3893,9 +3893,16 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
3893
3893
class_info_index, CHECK);
3894
3894
_nest_host = class_info_index;
3895
3895
3896
- } else if (_major_version >= JAVA_15_VERSION) {
3897
- // Check for PermittedSubclasses tag
3898
- if (tag == vmSymbols::tag_permitted_subclasses ()) {
3896
+ } else if (_major_version >= JAVA_16_VERSION) {
3897
+ if (tag == vmSymbols::tag_record ()) {
3898
+ if (parsed_record_attribute) {
3899
+ classfile_parse_error (" Multiple Record attributes in class file %s" , THREAD);
3900
+ return ;
3901
+ }
3902
+ parsed_record_attribute = true ;
3903
+ record_attribute_start = cfs->current ();
3904
+ record_attribute_length = attribute_length;
3905
+ } else if (tag == vmSymbols::tag_permitted_subclasses ()) {
3899
3906
if (supports_sealed_types ()) {
3900
3907
if (parsed_permitted_subclasses_attribute) {
3901
3908
classfile_parse_error (" Multiple PermittedSubclasses attributes in class file %s" , CHECK);
@@ -3910,23 +3917,9 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
3910
3917
permitted_subclasses_attribute_start = cfs->current ();
3911
3918
permitted_subclasses_attribute_length = attribute_length;
3912
3919
}
3913
- cfs->skip_u1 (attribute_length, CHECK);
3914
-
3915
- } else if (_major_version >= JAVA_16_VERSION) {
3916
- if (tag == vmSymbols::tag_record ()) {
3917
- if (parsed_record_attribute) {
3918
- classfile_parse_error (" Multiple Record attributes in class file %s" , THREAD);
3919
- return ;
3920
- }
3921
- parsed_record_attribute = true ;
3922
- record_attribute_start = cfs->current ();
3923
- record_attribute_length = attribute_length;
3924
- }
3925
- cfs->skip_u1 (attribute_length, CHECK);
3926
- } else {
3927
- // Unknown attribute
3928
- cfs->skip_u1 (attribute_length, CHECK);
3929
3920
}
3921
+ // Skip attribute_length for any attribute where major_verson >= JAVA_16_VERSION
3922
+ cfs->skip_u1 (attribute_length, CHECK);
3930
3923
} else {
3931
3924
// Unknown attribute
3932
3925
cfs->skip_u1 (attribute_length, CHECK);
0 commit comments