Class AnnotationsReader
java.lang.Object
com.ibm.wala.shrike.shrikeCT.AttributeReader
com.ibm.wala.shrike.shrikeCT.AnnotationsReader
- Direct Known Subclasses:
TypeAnnotationsReader
This class reads Annotations attributes, e.g., RuntimeInvisibleAnnotations.
- Author:
- sjfink
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresentation of an annotation attribute.static enumstatic classrepresents an annotation argument that itself is an array of argumentsstatic classRepresents a constant argument to an annotation.static interfaceMarker interface for possible element values in an annotation attribute.static classRepresents enum constant annotation arguments. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intoffset in class file where this attribute beginsFields inherited from class AttributeReader
attr, cr, length -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget all the annotations declared in this attribute.param_annotations { u2 attribute_name_index; u4 attribute_length; u1 num_parameters; { u2 num_annotations; annotation annotations[num_annotations]; } parameter_annotations[num_parameters];intprotected Pair<AnnotationsReader.AnnotationAttribute, Integer> getAttributeAndSize(int begin) annotation { u2 type_index; u2 num_element_value_pairs; { u2 element_name_index; element_value value; } element_value_pairs[num_element_value_pairs]intstatic AnnotationsReaderprotected StringgetUtf8ConstantPoolValue(int offset) get the Utf8 constant pool value, where the constant pool offset is given in the classstatic booleanisKnownAnnotation(String name) protected Pair<AnnotationsReader.ElementValue, Integer> readElementValueAndSize(int offset) element_value { u1 tag; union { u2 const_value_index; { u2 type_name_index; u2 const_name_index; } enum_const_value; u2 class_info_index; annotation annotation_value; { u2 num_values; element_value values[num_values]; } array_value; } value;Methods inherited from class AttributeReader
checkSize, checkSizeEquals, getClassReader, getRawOffset, getRawSize
-
Field Details
-
beginOffset
protected final int beginOffsetoffset in class file where this attribute begins
-
-
Constructor Details
-
AnnotationsReader
public AnnotationsReader(ClassReader.AttrIterator iter, String label) throws InvalidClassFileException - Throws:
InvalidClassFileException
-
-
Method Details
-
getAnnotationCount
- Returns:
- number of annotations in this attribute
- Throws:
InvalidClassFileException
-
getAttributeSize
- Returns:
- total length of this attribute in bytes, including the first 6 bytes
- Throws:
InvalidClassFileException
-
getUtf8ConstantPoolValue
get the Utf8 constant pool value, where the constant pool offset is given in the class- Parameters:
offset- offset in the class file at which the constant pool offset is given- Throws:
InvalidClassFileException
-
getAllAnnotations
get all the annotations declared in this attribute.RuntimeVisibleAnnotations_attribute { u2 attribute_name_index; u4 attribute_length; u2 num_annotations; annotation annotations[num_annotations]; }- Throws:
InvalidClassFileException- See Also:
-
getAllParameterAnnotations
public AnnotationsReader.AnnotationAttribute[][] getAllParameterAnnotations() throws InvalidClassFileExceptionparam_annotations { u2 attribute_name_index; u4 attribute_length; u1 num_parameters; { u2 num_annotations; annotation annotations[num_annotations]; } parameter_annotations[num_parameters];- Throws:
InvalidClassFileException
-
getAttributeAndSize
protected Pair<AnnotationsReader.AnnotationAttribute, Integer> getAttributeAndSize(int begin) throws InvalidClassFileException annotation { u2 type_index; u2 num_element_value_pairs; { u2 element_name_index; element_value value; } element_value_pairs[num_element_value_pairs]- Throws:
InvalidClassFileException
-
readElementValueAndSize
protected Pair<AnnotationsReader.ElementValue, Integer> readElementValueAndSize(int offset) throws IllegalArgumentException, InvalidClassFileException element_value { u1 tag; union { u2 const_value_index; { u2 type_name_index; u2 const_name_index; } enum_const_value; u2 class_info_index; annotation annotation_value; { u2 num_values; element_value values[num_values]; } array_value; } value;A constant value (including class info) is represented by aAnnotationsReader.ConstantElementValue. An enum constant value is represented by anAnnotationsReader.EnumElementValue. An array value is represented by anAnnotationsReader.ArrayElementValue. Finally, a nested annotation is represented by anAnnotationsReader.AnnotationAttribute. -
isKnownAnnotation
-
getReaderForAnnotation
public static AnnotationsReader getReaderForAnnotation(AnnotationsReader.AnnotationType type, ClassReader.AttrIterator iter)
-