[Soot-list] how to get the initial value of sootField

Stefan Willenbrock willenbr at rhrk.uni-kl.de
Wed May 19 17:11:18 EDT 2010


Am 19.05.2010 20:35, schrieb dingsun:
> Class A{
> public int x=999;
>
> public void f1(){
>
> ......
> }
>
>
> }

Java doesn't store initial field assignments in that way at the byte 
code level, so jimple also doesn't do it, since it has nearly the same 
level of abstraction.

Rather all initial (instance) assignments are collected and put into a 
method called "<init>". This is the same as the constructor and then 
assigns these values upon construction of the object to the fields.

The same procedure exists for static fields. Here the assignments are 
stored within the "<clinit>" method, which is called upon class load.

What you could do is check the <init> method for constant assignments to 
field x.

Regards, Stefan


More information about the Soot-list mailing list