src/share/vm/classfile/classFileParser.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File
*** old/src/share/vm/classfile/classFileParser.cpp	Thu Apr 16 13:30:40 2015
--- new/src/share/vm/classfile/classFileParser.cpp	Thu Apr 16 13:30:40 2015

*** 588,598 **** --- 588,598 ---- // 4509014: If a class method name begins with '<', it must be "<init>". assert(name != NULL, "method name in constant pool is null"); unsigned int name_len = name->utf8_length(); assert(name_len > 0, "bad method name"); // already verified as legal name if (name->byte_at(0) == '<') { ! if (name != vmSymbols::object_initializer_name()) { ! if (name->not_equals(vmSymbols::object_initializer_name())) { classfile_parse_error( "Bad method name at constant pool index %u in class file %s", name_ref_index, CHECK_(nullHandle)); } }
*** 611,627 **** --- 611,627 ---- { int name_and_type_ref_index = cp->name_and_type_ref_index_at(ref_index); int name_ref_index = cp->name_ref_index_at(name_and_type_ref_index); Symbol* name = cp->symbol_at(name_ref_index); if (ref_kind == JVM_REF_newInvokeSpecial) { ! if (name != vmSymbols::object_initializer_name()) { ! if (name->not_equals(vmSymbols::object_initializer_name())) { classfile_parse_error( "Bad constructor name at constant pool index %u in class file %s", name_ref_index, CHECK_(nullHandle)); } } else { ! if (name == vmSymbols::object_initializer_name()) { ! if (name->equals(vmSymbols::object_initializer_name())) { classfile_parse_error( "Bad method name at constant pool index %u in class file %s", name_ref_index, CHECK_(nullHandle)); } }
*** 741,751 **** --- 741,751 ---- // First lookup for duplicates int index = hash(name, sig); NameSigHash* entry = table[index]; while (entry != NULL) { ! if (entry->_name == name && entry->_sig == sig) { ! if (entry->_name->equals(name) && entry->_sig->equals(sig)) { return false; } entry = entry->_next; }
*** 903,913 **** --- 903,913 ---- check_property(valid_symbol_at(attribute_name_index), "Invalid field attribute index %u in class file %s", attribute_name_index, CHECK); Symbol* attribute_name = _cp->symbol_at(attribute_name_index); ! if (is_static && attribute_name == vmSymbols::tag_constant_value()) { ! if (is_static && attribute_name->equals(vmSymbols::tag_constant_value())) { // ignore if non-static if (constantvalue_index != 0) { classfile_parse_error("Duplicate ConstantValue attribute in class file %s", CHECK); } check_property(
*** 916,947 **** --- 916,947 ---- attribute_length, CHECK); constantvalue_index = cfs->get_u2(CHECK); if (_need_verify) { verify_constantvalue(constantvalue_index, signature_index, CHECK); } ! } else if (attribute_name == vmSymbols::tag_synthetic()) { ! } else if (attribute_name->equals(vmSymbols::tag_synthetic())) { if (attribute_length != 0) { classfile_parse_error( "Invalid Synthetic field attribute length %u in class file %s", attribute_length, CHECK); } is_synthetic = true; ! } else if (attribute_name == vmSymbols::tag_deprecated()) { // 4276120 ! } else if (attribute_name->equals(vmSymbols::tag_deprecated())) { // 4276120 if (attribute_length != 0) { classfile_parse_error( "Invalid Deprecated field attribute length %u in class file %s", attribute_length, CHECK); } } else if (_major_version >= JAVA_1_5_VERSION) { ! if (attribute_name == vmSymbols::tag_signature()) { ! if (attribute_name->equals(vmSymbols::tag_signature())) { if (attribute_length != 2) { classfile_parse_error( "Wrong size %u for field's Signature attribute in class file %s", attribute_length, CHECK); } generic_signature_index = parse_generic_signature_attribute(CHECK); ! } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { ! } else if (attribute_name->equals(vmSymbols::tag_runtime_visible_annotations())) { if (runtime_visible_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleAnnotations attributes for field in class file %s", CHECK); } runtime_visible_annotations_length = attribute_length;
*** 950,960 **** --- 950,960 ---- parse_annotations(runtime_visible_annotations, runtime_visible_annotations_length, parsed_annotations, CHECK); cfs->skip_u1(runtime_visible_annotations_length, CHECK); ! } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { ! } else if (attribute_name->equals(vmSymbols::tag_runtime_invisible_annotations())) { if (runtime_invisible_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleAnnotations attributes for field in class file %s", CHECK); } runtime_invisible_annotations_exists = true;
*** 962,981 **** --- 962,981 ---- runtime_invisible_annotations_length = attribute_length; runtime_invisible_annotations = cfs->get_u1_buffer(); assert(runtime_invisible_annotations != NULL, "null invisible annotations"); } cfs->skip_u1(attribute_length, CHECK); ! } else if (attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { ! } else if (attribute_name->equals(vmSymbols::tag_runtime_visible_type_annotations())) { if (runtime_visible_type_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleTypeAnnotations attributes for field in class file %s", CHECK); } runtime_visible_type_annotations_length = attribute_length; runtime_visible_type_annotations = cfs->get_u1_buffer(); assert(runtime_visible_type_annotations != NULL, "null visible type annotations"); cfs->skip_u1(runtime_visible_type_annotations_length, CHECK); ! } else if (attribute_name == vmSymbols::tag_runtime_invisible_type_annotations()) { ! } else if (attribute_name->equals(vmSymbols::tag_runtime_invisible_type_annotations())) { if (runtime_invisible_type_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleTypeAnnotations attributes for field in class file %s", CHECK); } else { runtime_invisible_type_annotations_exists = true;
*** 1229,1240 **** --- 1229,1240 ---- Symbol* name = injected[n].name(); Symbol* signature = injected[n].signature(); bool duplicate = false; for (int i = 0; i < length; i++) { FieldInfo* f = FieldInfo::from_field_array(fa, i); ! if (name == _cp->symbol_at(f->name_index()) && ! signature == _cp->symbol_at(f->signature_index())) { ! if (name->equals(_cp->symbol_at(f->name_index())) && ! signature->equals(_cp->symbol_at(f->signature_index()))) { // Symbol is desclared in Java so skip this one duplicate = true; break; } }
*** 1486,1497 **** --- 1486,1497 ---- u2 extra_slot = 0; if (!isLVTT) { verify_legal_field_signature(name, sig, CHECK_NULL); // 4894874: check special cases for double and long local variables ! if (sig == vmSymbols::type_signature(T_DOUBLE) || ! sig == vmSymbols::type_signature(T_LONG)) { ! if (sig->equals(vmSymbols::type_signature(T_DOUBLE)) || ! sig->equals(vmSymbols::type_signature(T_LONG))) { extra_slot = 1; } } guarantee_property((index + extra_slot) < max_locals, "Invalid index %u in %s in class file %s",
*** 1708,1718 **** --- 1708,1718 ---- // u2 group_index = 0; // default contended group if (count == 1 && s_size == (index - index0) // match size && s_tag_val == *(abase + tag_off) ! && member == vmSymbols::value_name()) { ! && member->equals(vmSymbols::value_name())) { group_index = Bytes::get_Java_u2(abase + s_con_off); if (_cp->symbol_at(group_index)->utf8_length() == 0) { group_index = 0; // default contended group } }
*** 1971,1981 **** --- 1971,1981 ---- "Illegal constant pool index %u for method signature in class file %s", signature_index, CHECK_(nullHandle)); Symbol* signature = _cp->symbol_at(signature_index); AccessFlags access_flags; ! if (name == vmSymbols::class_initializer_name()) { ! if (name->equals(vmSymbols::class_initializer_name())) { // We ignore the other access flags for a valid class initializer. // (JVM Spec 2nd ed., chapter 4.6) if (_major_version < 51) { // backward compatibility flags = JVM_ACC_STATIC; } else if ((flags & JVM_ACC_STATIC) == JVM_ACC_STATIC) {
*** 2057,2067 **** --- 2057,2067 ---- valid_symbol_at(method_attribute_name_index), "Invalid method attribute name index %u in class file %s", method_attribute_name_index, CHECK_(nullHandle)); Symbol* method_attribute_name = _cp->symbol_at(method_attribute_name_index); ! if (method_attribute_name == vmSymbols::tag_code()) { ! if (method_attribute_name->equals(vmSymbols::tag_code())) { // Parse Code attribute if (_need_verify) { guarantee_property( !access_flags.is_native() && !access_flags.is_abstract(), "Code attribute in native or abstract methods in class file %s",
*** 2138,2154 **** --- 2138,2154 ---- check_property(valid_symbol_at(code_attribute_name_index), "Invalid code attribute name index %u in class file %s", code_attribute_name_index, CHECK_(nullHandle)); if (LoadLineNumberTables && ! _cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_line_number_table()) { ! _cp->symbol_at(code_attribute_name_index)->equals(vmSymbols::tag_line_number_table())) { // Parse and compress line number table parse_linenumber_table(code_attribute_length, code_length, &linenumber_table, CHECK_(nullHandle)); } else if (LoadLocalVariableTables && ! _cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_local_variable_table()) { ! _cp->symbol_at(code_attribute_name_index)->equals(vmSymbols::tag_local_variable_table())) { // Parse local variable table if (!lvt_allocated) { localvariable_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_table_start = NEW_RESOURCE_ARRAY_IN_THREAD(
*** 2173,2183 **** --- 2173,2183 ---- CHECK_(nullHandle)); total_lvt_length += localvariable_table_length[lvt_cnt]; lvt_cnt++; } else if (LoadLocalVariableTypeTables && _major_version >= JAVA_1_5_VERSION && ! _cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_local_variable_type_table()) { ! _cp->symbol_at(code_attribute_name_index)->equals(vmSymbols::tag_local_variable_type_table())) { if (!lvt_allocated) { localvariable_table_length = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2, INITIAL_MAX_LVT_NUMBER); localvariable_table_start = NEW_RESOURCE_ARRAY_IN_THREAD( THREAD, u2*, INITIAL_MAX_LVT_NUMBER);
*** 2200,2210 **** --- 2200,2210 ---- &localvariable_type_table_length[lvtt_cnt], true, // is LVTT CHECK_(nullHandle)); lvtt_cnt++; } else if (_major_version >= Verifier::STACKMAP_ATTRIBUTE_MAJOR_VERSION && ! _cp->symbol_at(code_attribute_name_index) == vmSymbols::tag_stack_map_table()) { ! _cp->symbol_at(code_attribute_name_index)->equals(vmSymbols::tag_stack_map_table())) { // Stack map is only needed by the new verifier in JDK1.5. if (parsed_stackmap_attribute) { classfile_parse_error("Multiple StackMapTable attributes in class file %s", CHECK_(nullHandle)); } stackmap_data = parse_stackmap_table(code_attribute_length, CHECK_(nullHandle));
*** 2218,2238 **** --- 2218,2238 ---- // check method attribute length if (_need_verify) { guarantee_property(method_attribute_length == calculated_attribute_length, "Code segment has wrong length in class file %s", CHECK_(nullHandle)); } ! } else if (method_attribute_name == vmSymbols::tag_exceptions()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_exceptions())) { // Parse Exceptions attribute if (parsed_checked_exceptions_attribute) { classfile_parse_error("Multiple Exceptions attributes in class file %s", CHECK_(nullHandle)); } parsed_checked_exceptions_attribute = true; checked_exceptions_start = parse_checked_exceptions(&checked_exceptions_length, method_attribute_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_method_parameters()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_method_parameters())) { // reject multiple method parameters if (method_parameters_seen) { classfile_parse_error("Multiple MethodParameters attributes in class file %s", CHECK_(nullHandle)); } method_parameters_seen = true;
*** 2247,2279 **** --- 2247,2279 ---- cfs->skip_u2_fast(method_parameters_length); cfs->skip_u2_fast(method_parameters_length); // ignore this attribute if it cannot be reflected if (!SystemDictionary::Parameter_klass_loaded()) method_parameters_length = -1; ! } else if (method_attribute_name == vmSymbols::tag_synthetic()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_synthetic())) { if (method_attribute_length != 0) { classfile_parse_error( "Invalid Synthetic method attribute length %u in class file %s", method_attribute_length, CHECK_(nullHandle)); } // Should we check that there hasn't already been a synthetic attribute? access_flags.set_is_synthetic(); ! } else if (method_attribute_name == vmSymbols::tag_deprecated()) { // 4276120 ! } else if (method_attribute_name->equals(vmSymbols::tag_deprecated())) { // 4276120 if (method_attribute_length != 0) { classfile_parse_error( "Invalid Deprecated method attribute length %u in class file %s", method_attribute_length, CHECK_(nullHandle)); } } else if (_major_version >= JAVA_1_5_VERSION) { ! if (method_attribute_name == vmSymbols::tag_signature()) { ! if (method_attribute_name->equals(vmSymbols::tag_signature())) { if (method_attribute_length != 2) { classfile_parse_error( "Invalid Signature attribute length %u in class file %s", method_attribute_length, CHECK_(nullHandle)); } generic_signature_index = parse_generic_signature_attribute(CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_runtime_visible_annotations())) { if (runtime_visible_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle)); } runtime_visible_annotations_length = method_attribute_length;
*** 2281,2291 **** --- 2281,2291 ---- assert(runtime_visible_annotations != NULL, "null visible annotations"); parse_annotations(runtime_visible_annotations, runtime_visible_annotations_length, &parsed_annotations, CHECK_(nullHandle)); cfs->skip_u1(runtime_visible_annotations_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_runtime_invisible_annotations())) { if (runtime_invisible_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleAnnotations attributes for method in class file %s", CHECK_(nullHandle)); } runtime_invisible_annotations_exists = true;
*** 2293,2312 **** --- 2293,2312 ---- runtime_invisible_annotations_length = method_attribute_length; runtime_invisible_annotations = cfs->get_u1_buffer(); assert(runtime_invisible_annotations != NULL, "null invisible annotations"); } cfs->skip_u1(method_attribute_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_runtime_visible_parameter_annotations()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_runtime_visible_parameter_annotations())) { if (runtime_visible_parameter_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle)); } runtime_visible_parameter_annotations_length = method_attribute_length; runtime_visible_parameter_annotations = cfs->get_u1_buffer(); assert(runtime_visible_parameter_annotations != NULL, "null visible parameter annotations"); cfs->skip_u1(runtime_visible_parameter_annotations_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_parameter_annotations()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_runtime_invisible_parameter_annotations())) { if (runtime_invisible_parameter_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleParameterAnnotations attributes for method in class file %s", CHECK_(nullHandle)); } runtime_invisible_parameter_annotations_exists = true;
*** 2314,2345 **** --- 2314,2345 ---- runtime_invisible_parameter_annotations_length = method_attribute_length; runtime_invisible_parameter_annotations = cfs->get_u1_buffer(); assert(runtime_invisible_parameter_annotations != NULL, "null invisible parameter annotations"); } cfs->skip_u1(method_attribute_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_annotation_default()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_annotation_default())) { if (annotation_default != NULL) { classfile_parse_error( "Multiple AnnotationDefault attributes for method in class file %s", CHECK_(nullHandle)); } annotation_default_length = method_attribute_length; annotation_default = cfs->get_u1_buffer(); assert(annotation_default != NULL, "null annotation default"); cfs->skip_u1(annotation_default_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_runtime_visible_type_annotations()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_runtime_visible_type_annotations())) { if (runtime_visible_type_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleTypeAnnotations attributes for method in class file %s", CHECK_(nullHandle)); } runtime_visible_type_annotations_length = method_attribute_length; runtime_visible_type_annotations = cfs->get_u1_buffer(); assert(runtime_visible_type_annotations != NULL, "null visible type annotations"); // No need for the VM to parse Type annotations cfs->skip_u1(runtime_visible_type_annotations_length, CHECK_(nullHandle)); ! } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_type_annotations()) { ! } else if (method_attribute_name->equals(vmSymbols::tag_runtime_invisible_type_annotations())) { if (runtime_invisible_type_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleTypeAnnotations attributes for method in class file %s", CHECK_(nullHandle)); } else {
*** 2489,2508 **** --- 2489,2508 ---- runtime_invisible_type_annotations_length, annotation_default, annotation_default_length, CHECK_NULL); ! if (name == vmSymbols::finalize_method_name() && ! signature == vmSymbols::void_method_signature()) { ! if (name->equals(vmSymbols::finalize_method_name()) && ! signature->equals(vmSymbols::void_method_signature())) { if (m->is_empty_method()) { _has_empty_finalizer = true; } else { _has_finalizer = true; } } ! if (name == vmSymbols::object_initializer_name() && ! signature == vmSymbols::void_method_signature() && ! if (name->equals(vmSymbols::object_initializer_name()) && ! signature->equals(vmSymbols::void_method_signature()) && m->is_vanilla_constructor()) { _has_vanilla_constructor = true; } NOT_PRODUCT(m->verify());
*** 2880,2943 **** --- 2880,2943 ---- check_property( valid_symbol_at(attribute_name_index), "Attribute name has bad constant pool index %u in class file %s", attribute_name_index, CHECK); Symbol* tag = _cp->symbol_at(attribute_name_index); ! if (tag == vmSymbols::tag_source_file()) { ! if (tag->equals(vmSymbols::tag_source_file())) { // Check for SourceFile tag if (_need_verify) { guarantee_property(attribute_length == 2, "Wrong SourceFile attribute length in class file %s", CHECK); } if (parsed_sourcefile_attribute) { classfile_parse_error("Multiple SourceFile attributes in class file %s", CHECK); } else { parsed_sourcefile_attribute = true; } parse_classfile_sourcefile_attribute(CHECK); ! } else if (tag == vmSymbols::tag_source_debug_extension()) { ! } else if (tag->equals(vmSymbols::tag_source_debug_extension())) { // Check for SourceDebugExtension tag if (parsed_source_debug_ext_annotations_exist) { classfile_parse_error( "Multiple SourceDebugExtension attributes in class file %s", CHECK); } parsed_source_debug_ext_annotations_exist = true; parse_classfile_source_debug_extension_attribute((int)attribute_length, CHECK); ! } else if (tag == vmSymbols::tag_inner_classes()) { ! } else if (tag->equals(vmSymbols::tag_inner_classes())) { // Check for InnerClasses tag if (parsed_innerclasses_attribute) { classfile_parse_error("Multiple InnerClasses attributes in class file %s", CHECK); } else { parsed_innerclasses_attribute = true; } inner_classes_attribute_start = cfs->get_u1_buffer(); inner_classes_attribute_length = attribute_length; cfs->skip_u1(inner_classes_attribute_length, CHECK); ! } else if (tag == vmSymbols::tag_synthetic()) { ! } else if (tag->equals(vmSymbols::tag_synthetic())) { // Check for Synthetic tag // Shouldn't we check that the synthetic flags wasn't already set? - not required in spec if (attribute_length != 0) { classfile_parse_error( "Invalid Synthetic classfile attribute length %u in class file %s", attribute_length, CHECK); } parse_classfile_synthetic_attribute(CHECK); ! } else if (tag == vmSymbols::tag_deprecated()) { ! } else if (tag->equals(vmSymbols::tag_deprecated())) { // Check for Deprecatd tag - 4276120 if (attribute_length != 0) { classfile_parse_error( "Invalid Deprecated classfile attribute length %u in class file %s", attribute_length, CHECK); } } else if (_major_version >= JAVA_1_5_VERSION) { ! if (tag == vmSymbols::tag_signature()) { ! if (tag->equals(vmSymbols::tag_signature())) { if (attribute_length != 2) { classfile_parse_error( "Wrong Signature attribute length %u in class file %s", attribute_length, CHECK); } parse_classfile_signature_attribute(CHECK); ! } else if (tag == vmSymbols::tag_runtime_visible_annotations()) { ! } else if (tag->equals(vmSymbols::tag_runtime_visible_annotations())) { if (runtime_visible_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleAnnotations attributes in class file %s", CHECK); } runtime_visible_annotations_length = attribute_length;
*** 2946,2956 **** --- 2946,2956 ---- parse_annotations(runtime_visible_annotations, runtime_visible_annotations_length, parsed_annotations, CHECK); cfs->skip_u1(runtime_visible_annotations_length, CHECK); ! } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) { ! } else if (tag->equals(vmSymbols::tag_runtime_invisible_annotations())) { if (runtime_invisible_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleAnnotations attributes in class file %s", CHECK); } runtime_invisible_annotations_exists = true;
*** 2958,2968 **** --- 2958,2968 ---- runtime_invisible_annotations_length = attribute_length; runtime_invisible_annotations = cfs->get_u1_buffer(); assert(runtime_invisible_annotations != NULL, "null invisible annotations"); } cfs->skip_u1(attribute_length, CHECK); ! } else if (tag == vmSymbols::tag_enclosing_method()) { ! } else if (tag->equals(vmSymbols::tag_enclosing_method())) { if (parsed_enclosingmethod_attribute) { classfile_parse_error("Multiple EnclosingMethod attributes in class file %s", CHECK); } else { parsed_enclosingmethod_attribute = true; }
*** 2981,3007 **** --- 2981,3007 ---- if (enclosing_method_method_index != 0 && (!_cp->is_within_bounds(enclosing_method_method_index) || !_cp->tag_at(enclosing_method_method_index).is_name_and_type())) { classfile_parse_error("Invalid or out-of-bounds method index in EnclosingMethod attribute in class file %s", CHECK); } ! } else if (tag == vmSymbols::tag_bootstrap_methods() && ! } else if (tag->equals(vmSymbols::tag_bootstrap_methods()) && _major_version >= Verifier::INVOKEDYNAMIC_MAJOR_VERSION) { if (parsed_bootstrap_methods_attribute) classfile_parse_error("Multiple BootstrapMethods attributes in class file %s", CHECK); parsed_bootstrap_methods_attribute = true; parse_classfile_bootstrap_methods_attribute(attribute_length, CHECK); ! } else if (tag == vmSymbols::tag_runtime_visible_type_annotations()) { ! } else if (tag->equals(vmSymbols::tag_runtime_visible_type_annotations())) { if (runtime_visible_type_annotations != NULL) { classfile_parse_error( "Multiple RuntimeVisibleTypeAnnotations attributes in class file %s", CHECK); } runtime_visible_type_annotations_length = attribute_length; runtime_visible_type_annotations = cfs->get_u1_buffer(); assert(runtime_visible_type_annotations != NULL, "null visible type annotations"); // No need for the VM to parse Type annotations cfs->skip_u1(runtime_visible_type_annotations_length, CHECK); ! } else if (tag == vmSymbols::tag_runtime_invisible_type_annotations()) { ! } else if (tag->equals(vmSymbols::tag_runtime_invisible_type_annotations())) { if (runtime_invisible_type_annotations_exists) { classfile_parse_error( "Multiple RuntimeInvisibleTypeAnnotations attributes in class file %s", CHECK); } else { runtime_invisible_type_annotations_exists = true;
*** 3140,3150 **** --- 3140,3150 ---- instanceKlassHandle ClassFileParser::parse_super_class(int super_class_index, TRAPS) { instanceKlassHandle super_klass; if (super_class_index == 0) { ! check_property(_class_name == vmSymbols::java_lang_Object(), ! check_property(_class_name->equals(vmSymbols::java_lang_Object()), "Invalid superclass index %u in class file %s", super_class_index, CHECK_NULL); } else { check_property(valid_klass_reference_at(super_class_index),
*** 3303,3328 **** --- 3303,3328 ---- // The next classes have predefined hard-coded fields offsets // (see in JavaClasses::compute_hard_coded_offsets()). // Use default fields allocation order for them. if( (allocation_style != 0 || compact_fields ) && class_loader.is_null() && ! (_class_name == vmSymbols::java_lang_AssertionStatusDirectives() || ! _class_name == vmSymbols::java_lang_Class() || ! _class_name == vmSymbols::java_lang_ClassLoader() || ! _class_name == vmSymbols::java_lang_ref_Reference() || ! _class_name == vmSymbols::java_lang_ref_SoftReference() || ! _class_name == vmSymbols::java_lang_StackTraceElement() || ! _class_name == vmSymbols::java_lang_String() || ! _class_name == vmSymbols::java_lang_Throwable() || ! _class_name == vmSymbols::java_lang_Boolean() || ! _class_name == vmSymbols::java_lang_Character() || ! _class_name == vmSymbols::java_lang_Float() || ! _class_name == vmSymbols::java_lang_Double() || ! _class_name == vmSymbols::java_lang_Byte() || ! _class_name == vmSymbols::java_lang_Short() || ! _class_name == vmSymbols::java_lang_Integer() || ! _class_name == vmSymbols::java_lang_Long())) { ! (_class_name->equals(vmSymbols::java_lang_AssertionStatusDirectives()) || ! _class_name->equals(vmSymbols::java_lang_Class()) || ! _class_name->equals(vmSymbols::java_lang_ClassLoader()) || ! _class_name->equals(vmSymbols::java_lang_ref_Reference()) || ! _class_name->equals(vmSymbols::java_lang_ref_SoftReference()) || ! _class_name->equals(vmSymbols::java_lang_StackTraceElement()) || ! _class_name->equals(vmSymbols::java_lang_String()) || ! _class_name->equals(vmSymbols::java_lang_Throwable()) || ! _class_name->equals(vmSymbols::java_lang_Boolean()) || ! _class_name->equals(vmSymbols::java_lang_Character()) || ! _class_name->equals(vmSymbols::java_lang_Float()) || ! _class_name->equals(vmSymbols::java_lang_Double()) || ! _class_name->equals(vmSymbols::java_lang_Byte()) || ! _class_name->equals(vmSymbols::java_lang_Short()) || ! _class_name->equals(vmSymbols::java_lang_Integer()) || ! _class_name->equals(vmSymbols::java_lang_Long()))) { allocation_style = 0; // Allocate oops first compact_fields = false; // Don't compact fields } // Rearrange fields for a given allocation style
*** 3912,3922 **** --- 3912,3922 ---- // release all handles when parsing is done { HandleMark hm(THREAD); // Checks if name in class file matches requested name ! if (name != NULL && class_name != name) { ! if (name != NULL && class_name->not_equals(name)) { ResourceMark rm(THREAD); Exceptions::fthrow( THREAD_AND_LOCATION, vmSymbols::java_lang_NoClassDefFoundError(), "%s (wrong name: %s)",
*** 3990,4000 **** --- 3990,4000 ---- if (super_class_index > 0 && super_klass.is_null()) { Symbol* sk = cp->klass_name_at(super_class_index); if (access_flags.is_interface()) { // Before attempting to resolve the superclass, check for class format // errors not checked yet. ! guarantee_property(sk == vmSymbols::java_lang_Object(), ! guarantee_property(sk->equals(vmSymbols::java_lang_Object()), "Interfaces must have java.lang.Object as superclass in class file %s", CHECK_(nullHandle)); } Klass* k = SystemDictionary::resolve_super_or_fail(class_name, sk, class_loader,
*** 4479,4489 **** --- 4479,4489 ---- // If it cannot be fast-path allocated, set a bit in the layout helper. // See documentation of InstanceKlass::can_be_fastpath_allocated(). assert(k->size_helper() > 0, "layout_helper is initialized"); if ((!RegisterFinalizersAtInit && k->has_finalizer()) || k->is_abstract() || k->is_interface() ! || (k->name() == vmSymbols::java_lang_Class() && k->class_loader() == NULL) ! || (k->name()->equals(vmSymbols::java_lang_Class()) && k->class_loader() == NULL) || k->size_helper() >= FastAllocateSizeLimit) { // Forbid fast-path allocation. jint lh = Klass::instance_layout_helper(k->size_helper(), true); k->set_layout_helper(lh); }
*** 4630,4640 **** --- 4630,4640 ---- for (int index = 0; index < num_methods; index++) { Method* m = methods->at(index); // skip private, static, and <init> methods if ((!m->is_private() && !m->is_static()) && ! (m->name() != vmSymbols::object_initializer_name())) { ! (m->name()->not_equals(vmSymbols::object_initializer_name()))) { Symbol* name = m->name(); Symbol* signature = m->signature(); Klass* k = this_klass->super(); Method* super_m = NULL;
*** 4687,4697 **** --- 4687,4697 ---- int num_methods = methods->length(); for (int index = 0; index < num_methods; index++) { Method* m = methods->at(index); // if m is static and not the init method, throw a verify error ! if ((m->is_static()) && (m->name() != vmSymbols::class_initializer_name())) { ! if ((m->is_static()) && (m->name()->not_equals(vmSymbols::class_initializer_name()))) { ResourceMark rm(THREAD); Exceptions::fthrow( THREAD_AND_LOCATION, vmSymbols::java_lang_VerifyError(), "Illegal static method %s in interface %s",
*** 4802,4812 **** --- 4802,4812 ---- const bool is_strict = (flags & JVM_ACC_STRICT) != 0; const bool is_synchronized = (flags & JVM_ACC_SYNCHRONIZED) != 0; const bool is_protected = (flags & JVM_ACC_PROTECTED) != 0; const bool major_gte_15 = _major_version >= JAVA_1_5_VERSION; const bool major_gte_8 = _major_version >= JAVA_8_VERSION; ! const bool is_initializer = (name == vmSymbols::object_initializer_name()); ! const bool is_initializer = (name->equals(vmSymbols::object_initializer_name())); bool is_illegal = false; if (is_interface) { if (major_gte_8) {
*** 5013,5023 **** --- 5013,5023 ---- unsigned int length = name->utf8_length(); bool legal = false; if (length > 0) { if (bytes[0] == '<') { ! if (name == vmSymbols::object_initializer_name() || name == vmSymbols::class_initializer_name()) { ! if (name->equals(vmSymbols::object_initializer_name()) || name->equals(vmSymbols::class_initializer_name())) { legal = true; } } else if (_major_version < JAVA_1_5_VERSION) { char* p; p = skip_over_field_name(bytes, false, length);

src/share/vm/classfile/classFileParser.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File