Search in sources :

Example 1 with AnnotationVisibility

use of jadx.api.plugins.input.data.annotations.AnnotationVisibility in project jadx by skylot.

the class Smali method writeAnnotation.

private void writeAnnotation(SmaliWriter smali, IAnnotation anno) {
    smali.add(".annotation").add(" ");
    AnnotationVisibility vby = anno.getVisibility();
    if (vby != null) {
        smali.add(vby.toString().toLowerCase()).add(" ");
    }
    smali.add(anno.getAnnotationClass());
    anno.getValues().forEach((k, v) -> {
        smali.incIndent();
        smali.startLine(k).add(" = ");
        writeEncodedValue(smali, v, true);
        smali.decIndent();
    });
    smali.startLine(".end annotation");
}
Also used : AnnotationVisibility(jadx.api.plugins.input.data.annotations.AnnotationVisibility)

Example 2 with AnnotationVisibility

use of jadx.api.plugins.input.data.annotations.AnnotationVisibility in project jadx by skylot.

the class AnnotationsParser method readAnnotation.

public static IAnnotation readAnnotation(SectionReader in, SectionReader ext, boolean readVisibility) {
    AnnotationVisibility visibility = null;
    if (readVisibility) {
        int v = in.readUByte();
        visibility = getVisibilityValue(v);
    }
    int typeIndex = in.readUleb128();
    int size = in.readUleb128();
    Map<String, EncodedValue> values = new LinkedHashMap<>(size);
    for (int i = 0; i < size; i++) {
        String name = ext.getString(in.readUleb128());
        values.put(name, EncodedValueParser.parseValue(in, ext));
    }
    String type = ext.getType(typeIndex);
    return new JadxAnnotation(visibility, type, values);
}
Also used : AnnotationVisibility(jadx.api.plugins.input.data.annotations.AnnotationVisibility) EncodedValue(jadx.api.plugins.input.data.annotations.EncodedValue) JadxAnnotation(jadx.api.plugins.input.data.annotations.JadxAnnotation) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

AnnotationVisibility (jadx.api.plugins.input.data.annotations.AnnotationVisibility)2 EncodedValue (jadx.api.plugins.input.data.annotations.EncodedValue)1 JadxAnnotation (jadx.api.plugins.input.data.annotations.JadxAnnotation)1 LinkedHashMap (java.util.LinkedHashMap)1