use of jadx.core.dex.attributes.annotations.Annotation in project jadx by skylot.
the class AnnotationsParser method readAnnotation.
public static Annotation readAnnotation(DexNode dex, Section s, boolean readVisibility) throws DecodeException {
EncValueParser parser = new EncValueParser(dex, s);
Visibility visibility = null;
if (readVisibility) {
byte v = s.readByte();
visibility = VISIBILITIES[v];
}
int typeIndex = s.readUleb128();
int size = s.readUleb128();
Map<String, Object> values = new LinkedHashMap<String, Object>(size);
for (int i = 0; i < size; i++) {
String name = dex.getString(s.readUleb128());
values.put(name, parser.parseValue());
}
ArgType type = dex.getType(typeIndex);
Annotation annotation = new Annotation(visibility, type, values);
if (!type.isObject()) {
throw new DecodeException("Incorrect type for annotation: " + annotation);
}
return annotation;
}
Aggregations