Stale annotations getting in classes
This seems to be happening because defaultAnnotations hashmap which is
part of ApplicationReader class is not cleared when visiting classes.
Download the apk and extract the classes.dex from
http://www.androiddrawer.com/7694/download-facebook-2-0-app-apk/
After runing through asmdex, decompile the output dex
out\com\facebook\common\json\jsonmirror\JMAutogen.smali will contain additional
annotations
patch is here:-
Index: src/org/ow2/asmdex/ApplicationReader.java
===================================================================
--- src/org/ow2/asmdex/ApplicationReader.java (revision 1656)
+++ src/org/ow2/asmdex/ApplicationReader.java (working copy)
@@ -542,7 +542,6 @@
classVisitor.visitSource(sourceFile, null);
}
-
// Reads the annotations. The Class annotations are parsed and
visited directly.
// The field, method and parameter annotations are stored into
three maps, to
// to speed up the search when parsing these elements later.
@@ -563,10 +562,13 @@
// wants them in the Methods they are
linked to, so we have to store them and
// use them later.
dexFile.seek(classAnnotationsOffset);
// Get to the annotation_set_item.
+
readDefaultAnnotations();
dexFile.seek(annotationsOffset + 4); //
Get to the annotations_directory_item, fields_size field.
}
+ else
+ defaultAnnotations.clear();
// Now pointing on the
annotations_directory_item, fields_size field.
// We build the annotations maps for use later.
@@ -1252,7 +1254,6 @@
{
continue;
}
-
AnnotationVisitor annotationVisitor = null;
if (visitorType == VisitorType.classVisitor) {
annotationVisitor =
((ClassVisitor)visitor).visitAnnotation(annotationType, isAnnotationVisible);