[Soot-list] Soot and Java Annotations
Eric Bodden
eric.bodden at ec-spride.de
Wed Feb 1 04:37:59 EST 2012
Hello Florian.
Yes, indeed you can retrieve annotations through tags.
You cannot directly use test1Go.getJavaAnnotation(“MyAnnotation”) but
instead you need to use test1Go.getTag(ID) with a special ID that I
have forgotten. But you can instead just use getTags() to retrieve all
tags to find out...
Soot does not currently support annotations on local variables because
such annotations cannot be persisted in Java bytecode; they are
source-code only.
Eric
On 31 January 2012 17:52, Florian Strauß <f_straus at cs.uni-kl.de> wrote:
> Hi all,
>
>
>
> thanks for working on soot. It’s a very helpful framework.
>
> I am wondering if it is possible to get the Java Annotations, which are used
> in the analyzed (source) code.
>
>
>
> For example
>
> Input:
>
> public class Test1 {
>
>
>
> @MyAnnotation
>
> public void go() {
>
>
>
> @TestAnnotation
>
> Container c1 = new Container();
>
> [..]
>
> }
>
> }
>
>
>
>
>
> Output:
>
> SootMethod test1Go = ….
>
> test1Go.getJavaAnnotation(“MyAnnotation”) ?
>
> Local c1 = …
>
> c1.getJavaAnnotation(“TestAnnotation”) ?
>
>
>
> I know soot provides a type “Tag” and each subtype of “Host” has a method
> “getTag”. Is it possible to use this method to get information about the
> Java Annotations? Unfortunately Local (or JimpleLocal) does not implement
> “Host”. Any ideas?
>
>
>
> Best regards,
>
> Florian
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
--
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422 Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
More information about the Soot-list
mailing list