[Soot-list] Use Soot to parse annotations stored in bytecodes

Bernhard Berger berber at tzi.de
Wed Oct 5 13:48:36 EDT 2016


Hi Xinxin,

as far as I remember Jimple has no equivalent of annotations. They can be stored using the -xml-attributes or the -print-tags command line parameters. Within Soot you have to query the tags [1] to find the annotations you are interested in.

Regards, Bernhard

[1] https://ssebuild.cased.de/nightly/soot/javadoc/soot/tagkit/Host.html
> Am 05.10.2016 um 18:22 schrieb Xinxin Jin <xinxinjin89 at gmail.com>:
> 
> Hi !
> 
> I need to parse the java annotation from Android application and generate bytecode according to the parsed annotation.
> 
> In the android source code, the annotation is defined like this. RetentionPolicy.RUNTIME means the annotation will be preserved in bytecode. 
> 
> @Retention(RetentionPolicy.RUNTIME)
> public @interface MyAnnotation {
> 
> }
> 
> Then I use Soot to transform the android APK to Jimple using this command: 
> java -classpath ${JAVA_CLASSPATH} soot.Main -android-jars $ANDROID_JARS_PATH -allow-phantom-refs -src-prec apk -ire -f J MyTest.apk
> 
> I checked the generated Jimple files, but found no code annotated with @MyAnnotation
> 
> Can anyone tell me if Soot can't read the annotation in the bytecode or I applied incorrect command?
> 
> Thank you very much !!!
> 
> ​​
> 
> -- 
> Xinxin
> 
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20161005/8fa2239e/attachment.html 


More information about the Soot-list mailing list