+ case 'e':
+ {
+ int type_name_index = read2u();
+ int const_name_index = read2u ();
+ check_tag (type_name_index, JV_CONSTANT_Utf8);
+ prepare_pool_entry (type_name_index, JV_CONSTANT_Utf8);
+ check_tag (const_name_index, JV_CONSTANT_Utf8);
+ prepare_pool_entry (const_name_index, JV_CONSTANT_Utf8, false);
+ }
+ break;
+ case 'c':
+ {
+ int index = read2u();
+ check_tag (index, JV_CONSTANT_Utf8);
+ prepare_pool_entry (index, JV_CONSTANT_Utf8);
+ }
+ break;
+ case '@':
+ handleAnnotation();
+ break;
+ case '[':
+ {
+ int n_array_elts = read2u ();
+ for (int i = 0; i < n_array_elts; ++i)
+ handleAnnotationElement();
+ }
+ break;
+ default:
+ throw_class_format_error ("invalid annotation element");
+ }
+}
+
+void
+_Jv_ClassReader::handleAnnotation()
+{
+ int type_index = read2u();
+ check_tag (type_index, JV_CONSTANT_Utf8);
+ prepare_pool_entry (type_index, JV_CONSTANT_Utf8);
+
+ int npairs = read2u();
+ for (int i = 0; i < npairs; ++i)
+ {
+ int name_index = read2u();
+ check_tag (name_index, JV_CONSTANT_Utf8);
+ prepare_pool_entry (name_index, JV_CONSTANT_Utf8, false);
+ handleAnnotationElement();
+ }
+}
+
+void
+_Jv_ClassReader::handleAnnotations()
+{
+ int num = read2u();
+ while (num--)
+ handleAnnotation();
+}
+
+void
+_Jv_ClassReader::handleMemberAnnotations(jv_attr_type member_type,
+ int member_index,
+ int len)
+{
+ // We're going to copy the bytes in verbatim. But first we want to
+ // make sure the attribute is well-formed, and we want to prepare
+ // the constant pool. So, we save our starting point.
+ int orig_pos = pos;
+
+ handleAnnotations();
+ // FIXME: check that we read all LEN bytes?
+
+ ::java::io::DataOutputStream *stream = get_reflection_stream ();
+ stream->writeByte(member_type);
+ int newLen = len + 1;
+ if (member_type != JV_CLASS_ATTR)
+ newLen += 2;
+ stream->writeInt(newLen);
+ stream->writeByte(JV_ANNOTATIONS_KIND);
+ if (member_type != JV_CLASS_ATTR)
+ stream->writeShort(member_index);
+ // Write the data as-is.
+ stream->write(input_data, input_offset + orig_pos, len);
+}
+
+void
+_Jv_ClassReader::handleAnnotationDefault(int member_index, int len)
+{
+ int orig_pos = pos;
+ handleAnnotationElement();
+
+ ::java::io::DataOutputStream *stream = get_reflection_stream ();
+ stream->writeByte(JV_METHOD_ATTR);
+ stream->writeInt(len + 3);
+ stream->writeByte(JV_ANNOTATION_DEFAULT_KIND);
+ stream->writeShort(member_index);
+ stream->write(input_data, input_offset + orig_pos, len);
+}
+
+void
+_Jv_ClassReader::handleParameterAnnotations(int member_index, int len)
+{
+ int orig_pos = pos;
+
+ int n_params = read1u();
+ for (int i = 0; i < n_params; ++i)
+ handleAnnotations();
+
+ ::java::io::DataOutputStream *stream = get_reflection_stream ();
+ stream->writeByte(JV_METHOD_ATTR);
+ stream->writeInt(len + 3);
+ stream->writeByte(JV_PARAMETER_ANNOTATIONS_KIND);
+ stream->writeShort(member_index);
+ stream->write(input_data, input_offset + orig_pos, len);