--- old/src/hotspot/share/classfile/classFileParser.cpp 2019-10-24 17:42:41.015565507 +0000 +++ new/src/hotspot/share/classfile/classFileParser.cpp 2019-10-24 17:42:40.170775565 +0000 @@ -3715,23 +3715,28 @@ "Nest-host class_info_index %u has bad constant type in class file %s", class_info_index, CHECK); _nest_host = class_info_index; - } else 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 (parsed_record_attribute) { - classfile_parse_error("Multiple Record attributes in class file %s", CHECK); + } 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 (parsed_record_attribute) { + classfile_parse_error("Multiple Record attributes in class file %s", CHECK); + } + // 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", CHECK); + } + parsed_record_attribute = true; + record_attribute_start = cfs->current(); + record_attribute_length = attribute_length; } - // 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", CHECK); - } - parsed_record_attribute = true; - record_attribute_start = cfs->current(); - record_attribute_length = attribute_length; + cfs->skip_u1(attribute_length, CHECK); + } else { + // Unknown attribute + cfs->skip_u1(attribute_length, CHECK); } - cfs->skip_u1(attribute_length, CHECK); } else { // Unknown attribute cfs->skip_u1(attribute_length, CHECK); --- old/src/hotspot/share/classfile/javaClasses.cpp 2019-10-24 17:42:44.033788737 +0000 +++ new/src/hotspot/share/classfile/javaClasses.cpp 2019-10-24 17:42:43.194689732 +0000 @@ -3084,9 +3084,7 @@ HandleMark hm(THREAD); InstanceKlass* ik = SystemDictionary::RecordComponent_klass(); assert(ik != NULL, "must be loaded"); - if (ik->should_be_initialized()) { - ik->initialize(CHECK_0); - } + ik->initialize(CHECK_0); Handle element = ik->allocate_instance_handle(CHECK_0); @@ -3108,7 +3106,7 @@ ResourceMark rm(THREAD); int sig_len = type->utf8_length() + 3; // "()" and null char char* sig = NEW_RESOURCE_ARRAY(char, sig_len); - jio_snprintf(sig, sig_len, "()%s", type->as_C_string()); + jio_snprintf(sig, sig_len, "%c%c%s", JVM_SIGNATURE_FUNC, JVM_SIGNATURE_ENDFUNC, type->as_C_string()); TempNewSymbol full_sig = SymbolTable::new_symbol(sig); accessor_method = holder->find_instance_method(name, full_sig); } --- old/src/hotspot/share/oops/instanceKlass.cpp 2019-10-24 17:42:46.991666122 +0000 +++ new/src/hotspot/share/oops/instanceKlass.cpp 2019-10-24 17:42:46.160322477 +0000 @@ -3545,7 +3545,7 @@ if (components != NULL) { for (int i = 0; i < components->length(); i++) { RecordComponent* component = components->at(i); - if (component) { + if (component != NULL) { component->collect_statistics(sz); } } --- old/test/jdk/java/lang/instrument/RedefineRecordAttr/HostBA/redef/Host.java 2019-10-24 17:42:50.207787713 +0000 +++ new/test/jdk/java/lang/instrument/RedefineRecordAttr/HostBA/redef/Host.java 2019-10-24 17:42:49.393460203 +0000 @@ -27,7 +27,7 @@ return 2; // redefined class } public Host(int A, long B, char C) { - this.A = A; this.B = B; + this.A = A; } }