SOFe
SOFe

Reputation: 8224

Retrieving annotation information in soot

I would like to search all occurrences of a certain annotation to select analysis regions.

Take nullck analysis for example; I would want to find all @NotNull annotations and start running the nullck analysis from methods containing a variable declared @NotNull.

Is it possible to do this with soot? It appears that Jimple does not preserve annotation information.

Alternatively, would it be a good idea to write an annotation preprocessor that generates special markers around local variables annotated with @NotNull and match these markers when Soot is running?

Upvotes: 0

Views: 228

Answers (1)

SOFe
SOFe

Reputation: 8224

It appears that variable information is not exposed to anyone other than the compiler; not even in the .class, not even annotation processors, not even with SOURCE-level retention.

So the answer is that there is no way we could pass it to soot in current java.

For annotations not on local variables, such as methods and parameters, they are under soot.tagkit.Host.getTags(). However it is necessary to use jap instead of jtp.

Upvotes: 0

Related Questions