mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8255342
: Remove non-specified JVM checks on Classes with Record attributes
Reviewed-by: dholmes, coleenp
This commit is contained in:
parent
767965046e
commit
18d9905c40
6 changed files with 353 additions and 43 deletions
|
@ -3900,19 +3900,11 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
|
|||
_nest_host = class_info_index;
|
||||
} else if (_major_version >= JAVA_14_VERSION) {
|
||||
if (tag == vmSymbols::tag_record()) {
|
||||
// Skip over Record attribute if not supported or if super class is
|
||||
// not java.lang.Record.
|
||||
if (supports_records() &&
|
||||
cp->klass_name_at(_super_class_index) == vmSymbols::java_lang_Record()) {
|
||||
if (supports_records()) { // Skip over Record attribute if not supported.
|
||||
if (parsed_record_attribute) {
|
||||
classfile_parse_error("Multiple Record attributes in class file %s", THREAD);
|
||||
return;
|
||||
}
|
||||
// Check that class is final and not abstract.
|
||||
if (!_access_flags.is_final() || _access_flags.is_abstract()) {
|
||||
classfile_parse_error("Record attribute in non-final or abstract class file %s", THREAD);
|
||||
return;
|
||||
}
|
||||
parsed_record_attribute = true;
|
||||
record_attribute_start = cfs->current();
|
||||
record_attribute_length = attribute_length;
|
||||
|
@ -3922,15 +3914,9 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
|
|||
// --enable-preview wasn't specified then a java.lang.UnsupportedClassVersionError
|
||||
// exception would have been thrown.
|
||||
ResourceMark rm(THREAD);
|
||||
if (supports_records()) {
|
||||
log_info(class, record)(
|
||||
"Ignoring Record attribute in class %s because super type is not java.lang.Record",
|
||||
_class_name->as_C_string());
|
||||
} else {
|
||||
log_info(class, record)(
|
||||
"Ignoring Record attribute in class %s because class file version is not %d.65535",
|
||||
_class_name->as_C_string(), JVM_CLASSFILE_MAJOR_VERSION);
|
||||
}
|
||||
log_info(class, record)(
|
||||
"Ignoring Record attribute in class %s because class file version is not %d.65535",
|
||||
_class_name->as_C_string(), JVM_CLASSFILE_MAJOR_VERSION);
|
||||
}
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
} else if (_major_version >= JAVA_15_VERSION) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue