8037167: Better method signature resolution

Reviewed-by: mschoene, hseigel, lfoltan
This commit is contained in:
Karen Kinnear 2014-07-14 13:15:06 +04:00
parent 53685b407a
commit 55dc1a6965
2 changed files with 14 additions and 3 deletions

View File

@ -919,7 +919,7 @@ void ClassFileParser::parse_field_attributes(u2 attributes_count,
"Wrong size %u for field's Signature attribute in class file %s", "Wrong size %u for field's Signature attribute in class file %s",
attribute_length, CHECK); attribute_length, CHECK);
} }
generic_signature_index = cfs->get_u2(CHECK); generic_signature_index = parse_generic_signature_attribute(CHECK);
} else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) { } else if (attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
if (runtime_visible_annotations != NULL) { if (runtime_visible_annotations != NULL) {
classfile_parse_error( classfile_parse_error(
@ -2306,8 +2306,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
"Invalid Signature attribute length %u in class file %s", "Invalid Signature attribute length %u in class file %s",
method_attribute_length, CHECK_(nullHandle)); method_attribute_length, CHECK_(nullHandle));
} }
cfs->guarantee_more(2, CHECK_(nullHandle)); // generic_signature_index generic_signature_index = parse_generic_signature_attribute(CHECK_(nullHandle));
generic_signature_index = cfs->get_u2_fast();
} else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) { } else if (method_attribute_name == vmSymbols::tag_runtime_visible_annotations()) {
if (runtime_visible_annotations != NULL) { if (runtime_visible_annotations != NULL) {
classfile_parse_error( classfile_parse_error(
@ -2644,6 +2643,17 @@ intArray* ClassFileParser::sort_methods(Array<Method*>* methods) {
return method_ordering; return method_ordering;
} }
// Parse generic_signature attribute for methods and fields
u2 ClassFileParser::parse_generic_signature_attribute(TRAPS) {
ClassFileStream* cfs = stream();
cfs->guarantee_more(2, CHECK_0); // generic_signature_index
u2 generic_signature_index = cfs->get_u2_fast();
check_property(
valid_symbol_at(generic_signature_index),
"Invalid Signature attribute at constant pool index %u in class file %s",
generic_signature_index, CHECK_0);
return generic_signature_index;
}
void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) { void ClassFileParser::parse_classfile_sourcefile_attribute(TRAPS) {
ClassFileStream* cfs = stream(); ClassFileStream* cfs = stream();

View File

@ -266,6 +266,7 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
u1* parse_stackmap_table(u4 code_attribute_length, TRAPS); u1* parse_stackmap_table(u4 code_attribute_length, TRAPS);
// Classfile attribute parsing // Classfile attribute parsing
u2 parse_generic_signature_attribute(TRAPS);
void parse_classfile_sourcefile_attribute(TRAPS); void parse_classfile_sourcefile_attribute(TRAPS);
void parse_classfile_source_debug_extension_attribute(int length, TRAPS); void parse_classfile_source_debug_extension_attribute(int length, TRAPS);
u2 parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start, u2 parse_classfile_inner_classes_attribute(u1* inner_classes_attribute_start,