Skip to main content

extract_annotations_from_attribute

Function extract_annotations_from_attribute 

Source
pub fn extract_annotations_from_attribute(
    attr: &AttributeData<'_>,
) -> Result<Option<Vec<AnnotationStub>>, ClasspathError>
Expand description

Extract all annotations from a cafebabe AttributeData value.

Returns Ok(Some(stubs)) if the attribute is an annotation attribute, Ok(None) if it is a different attribute type. Returns Err only on internal conversion failures (currently infallible, but the signature allows for future extension).

This handles:

  • RuntimeVisibleAnnotationsis_runtime_visible = true
  • RuntimeInvisibleAnnotationsis_runtime_visible = false