< prev index next >

src/hotspot/share/classfile/classFileParser.cpp

Print this page

        

*** 1081,1091 **** : _location(location), _annotations_present(0) { assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); } // If this annotation name has an ID, report it (or _none). ! ID annotation_index(const ClassLoaderData* loader_data, const Symbol* name); // Set the annotation name: void set_annotation(ID id) { assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); _annotations_present |= nth_bit((int)id); } --- 1081,1091 ---- : _location(location), _annotations_present(0) { assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); } // If this annotation name has an ID, report it (or _none). ! ID annotation_index(const ClassLoaderData* loader_data, const Symbol* name, const bool can_access_vm_annotations); // Set the annotation name: void set_annotation(ID id) { assert((int)id >= 0 && (int)id < (int)_annotation_LIMIT, "oob"); _annotations_present |= nth_bit((int)id); }
*** 1214,1223 **** --- 1214,1224 ---- // Sift through annotations, looking for those significant to the VM: static void parse_annotations(const ConstantPool* const cp, const u1* buffer, int limit, AnnotationCollector* coll, ClassLoaderData* loader_data, + const bool can_access_vm_annotations, TRAPS) { assert(cp != NULL, "invariant"); assert(buffer != NULL, "invariant"); assert(coll != NULL, "invariant");
*** 1259,1269 **** member = check_symbol_at(cp, member_index); if (member == NULL) break; // invalid member name } // Here is where parsing particular annotations will take place. ! AnnotationCollector::ID id = coll->annotation_index(loader_data, aname); if (AnnotationCollector::_unknown == id) continue; coll->set_annotation(id); if (AnnotationCollector::_jdk_internal_vm_annotation_Contended == id) { // @Contended can optionally specify the contention group. --- 1260,1270 ---- member = check_symbol_at(cp, member_index); if (member == NULL) break; // invalid member name } // Here is where parsing particular annotations will take place. ! AnnotationCollector::ID id = coll->annotation_index(loader_data, aname, can_access_vm_annotations); if (AnnotationCollector::_unknown == id) continue; coll->set_annotation(id); if (AnnotationCollector::_jdk_internal_vm_annotation_Contended == id) { // @Contended can optionally specify the contention group.
*** 1385,1394 **** --- 1386,1396 ---- parse_annotations(cp, runtime_visible_annotations, runtime_visible_annotations_length, parsed_annotations, _loader_data, + _can_access_vm_annotations, CHECK); cfs->skip_u1_fast(runtime_visible_annotations_length); } else if (attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { if (runtime_invisible_annotations_exists) { classfile_parse_error(
*** 2084,2099 **** name->as_C_string(), _class_name->as_C_string(), sig->as_C_string()); } AnnotationCollector::ID AnnotationCollector::annotation_index(const ClassLoaderData* loader_data, ! const Symbol* name) { const vmSymbols::SID sid = vmSymbols::find_sid(name); // Privileged code can use all annotations. Other code silently drops some. const bool privileged = loader_data->is_the_null_class_loader_data() || loader_data->is_platform_class_loader_data() || ! loader_data->is_shortlived(); switch (sid) { case vmSymbols::VM_SYMBOL_ENUM_NAME(reflect_CallerSensitive_signature): { if (_location != _in_method) break; // only allow for methods if (!privileged) break; // only allow in privileged code return _method_CallerSensitive; --- 2086,2103 ---- name->as_C_string(), _class_name->as_C_string(), sig->as_C_string()); } AnnotationCollector::ID AnnotationCollector::annotation_index(const ClassLoaderData* loader_data, ! const Symbol* name, ! const bool can_access_vm_annotations) { const vmSymbols::SID sid = vmSymbols::find_sid(name); // Privileged code can use all annotations. Other code silently drops some. const bool privileged = loader_data->is_the_null_class_loader_data() || loader_data->is_platform_class_loader_data() || ! loader_data->is_shortlived() || ! can_access_vm_annotations; switch (sid) { case vmSymbols::VM_SYMBOL_ENUM_NAME(reflect_CallerSensitive_signature): { if (_location != _in_method) break; // only allow for methods if (!privileged) break; // only allow in privileged code return _method_CallerSensitive;
*** 2708,2717 **** --- 2712,2722 ---- parse_annotations(cp, runtime_visible_annotations, runtime_visible_annotations_length, &parsed_annotations, _loader_data, + _can_access_vm_annotations, CHECK_NULL); cfs->skip_u1_fast(runtime_visible_annotations_length); } else if (method_attribute_name == vmSymbols::tag_runtime_invisible_annotations()) { if (runtime_invisible_annotations_exists) { classfile_parse_error(
*** 3470,3479 **** --- 3475,3485 ---- parse_annotations(cp, runtime_visible_annotations, runtime_visible_annotations_length, parsed_annotations, _loader_data, + _can_access_vm_annotations, CHECK); cfs->skip_u1_fast(runtime_visible_annotations_length); } else if (tag == vmSymbols::tag_runtime_invisible_annotations()) { if (runtime_invisible_annotations_exists) { classfile_parse_error(
*** 5825,5843 **** Symbol* name, ClassLoaderData* loader_data, Handle protection_domain, const InstanceKlass* unsafe_anonymous_host, GrowableArray<Handle>* cp_patches, ! bool is_nonfindable, Publicity pub_level, TRAPS) : _stream(stream), _requested_name(name), _loader_data(loader_data), _unsafe_anonymous_host(unsafe_anonymous_host), _cp_patches(cp_patches), _is_nonfindable(is_nonfindable), _num_patched_klasses(0), _max_num_patched_klasses(0), _orig_cp_size(0), _first_patched_klass_resolved_index(0), _super_klass(), --- 5831,5851 ---- Symbol* name, ClassLoaderData* loader_data, Handle protection_domain, const InstanceKlass* unsafe_anonymous_host, GrowableArray<Handle>* cp_patches, ! const bool is_nonfindable, ! const bool can_access_vm_annotations, Publicity pub_level, TRAPS) : _stream(stream), _requested_name(name), _loader_data(loader_data), _unsafe_anonymous_host(unsafe_anonymous_host), _cp_patches(cp_patches), _is_nonfindable(is_nonfindable), + _can_access_vm_annotations(can_access_vm_annotations), _num_patched_klasses(0), _max_num_patched_klasses(0), _orig_cp_size(0), _first_patched_klass_resolved_index(0), _super_klass(),
< prev index next >