[Soot-list] get value of final fields

Quentin Sabah quentin.sabah at inria.fr
Fri Feb 1 03:28:40 EST 2013


Hi,

> Is it possible in soot to get the value of a final field?
> 
> Example:
> 
> class A {
>   public static final int f = 1;
> }
> 
> Is the fact that `f' is always `1' saved somewhere in soot?

This kind of assignement is syntaxic sugar for:

class A {
 public static final in f;

 static { f = 1; }
}

If you analyze the statements of the <cinit> (static constructor) 
of class A, you should find an AssignStmt with the f field as
the left value and the 1 constant as right value.
You will find the method with SootClass.getMethod() and the 
SootMethod.staticInitializerName name.


-- 
Quentin Sabah, co-funded Ph.D. student
Grenoble University
INRIA-SARDES                   | STMicroelectronics/AST
Montbonnot, France             | Grenoble, France
mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
phone: +33 476 61 52 42        | phone: +33 476 58 44 14 


More information about the Soot-list mailing list