Commit a2513240 authored by Skylot's avatar Skylot

core: fix method parameters annotation parsing (fix #57)

parent 0d509f94
......@@ -5,12 +5,15 @@ import jadx.core.dex.attributes.IAttribute;
import jadx.core.utils.Utils;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AnnotationsList implements IAttribute {
public static final AnnotationsList EMPTY = new AnnotationsList(Collections.<Annotation>emptyList());
private final Map<String, Annotation> map;
public AnnotationsList(List<Annotation> anList) {
......
......@@ -71,8 +71,14 @@ public class AnnotationsParser {
}
private AnnotationsList readAnnotationSet(int offset) throws DecodeException {
if (offset == 0) {
return AnnotationsList.EMPTY;
}
Section section = dex.openSection(offset);
int size = section.readInt();
if (size == 0) {
return AnnotationsList.EMPTY;
}
List<Annotation> list = new ArrayList<Annotation>(size);
for (int i = 0; i < size; i++) {
Section anSection = dex.openSection(section.readInt());
......@@ -86,7 +92,8 @@ public class AnnotationsParser {
EncValueParser parser = new EncValueParser(dex, s);
Visibility visibility = null;
if (readVisibility) {
visibility = VISIBILITIES[s.readByte()];
byte v = s.readByte();
visibility = VISIBILITIES[v];
}
int typeIndex = s.readUleb128();
int size = s.readUleb128();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment