本文整理汇总了C++中methodHandle::annotation_default方法的典型用法代码示例。如果您正苦于以下问题:C++ methodHandle::annotation_default方法的具体用法?C++ methodHandle::annotation_default怎么用?C++ methodHandle::annotation_default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类methodHandle
的用法示例。
在下文中一共展示了methodHandle::annotation_default方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_method_info
// Write one method_info structure
// JVMSpec| method_info {
// JVMSpec| u2 access_flags;
// JVMSpec| u2 name_index;
// JVMSpec| u2 descriptor_index;
// JVMSpec| u2 attributes_count;
// JVMSpec| attribute_info attributes[attributes_count];
// JVMSpec| }
void JvmtiClassFileReconstituter::write_method_info(methodHandle method) {
AccessFlags access_flags = method->access_flags();
ConstMethod* const_method = method->constMethod();
u2 generic_signature_index = const_method->generic_signature_index();
AnnotationArray* anno = method->annotations();
AnnotationArray* param_anno = method->parameter_annotations();
AnnotationArray* default_anno = method->annotation_default();
AnnotationArray* type_anno = method->type_annotations();
// skip generated default interface methods
if (method->is_overpass()) {
return;
}
write_u2(access_flags.get_flags() & JVM_RECOGNIZED_METHOD_MODIFIERS);
write_u2(const_method->name_index());
write_u2(const_method->signature_index());
// write attributes in the same order javac does, so we can test with byte for
// byte comparison
int attr_count = 0;
if (const_method->code_size() != 0) {
++attr_count; // has Code attribute
}
if (const_method->has_checked_exceptions()) {
++attr_count; // has Exceptions attribute
}
if (default_anno != NULL) {
++attr_count; // has AnnotationDefault attribute
}
// Deprecated attribute would go here
if (access_flags.is_synthetic()) { // FIXME
// ++attr_count;
}
if (generic_signature_index != 0) {
++attr_count;
}
if (anno != NULL) {
++attr_count; // has RuntimeVisibleAnnotations attribute
}
if (param_anno != NULL) {
++attr_count; // has RuntimeVisibleParameterAnnotations attribute
}
if (type_anno != NULL) {
++attr_count; // has RuntimeVisibleTypeAnnotations attribute
}
write_u2(attr_count);
if (const_method->code_size() > 0) {
write_code_attribute(method);
}
if (const_method->has_checked_exceptions()) {
write_exceptions_attribute(const_method);
}
if (default_anno != NULL) {
write_annotations_attribute("AnnotationDefault", default_anno);
}
// Deprecated attribute would go here
if (access_flags.is_synthetic()) {
// write_synthetic_attribute();
}
if (generic_signature_index != 0) {
write_signature_attribute(generic_signature_index);
}
if (anno != NULL) {
write_annotations_attribute("RuntimeVisibleAnnotations", anno);
}
if (param_anno != NULL) {
write_annotations_attribute("RuntimeVisibleParameterAnnotations", param_anno);
}
if (type_anno != NULL) {
write_annotations_attribute("RuntimeVisibleTypeAnnotations", type_anno);
}
}