[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
JAssignStmt with reference to a class field as right-hand-side
Hi,
I want to know how can I generate a JAssignStmt that contains a
reference to a class field as the right-hand-side.
I have a class:
class MyType{
public double value;
public double stress;
public MyType(){
super();
return;
}
}
and I want to generate in Jimple something like
$d0 = r0.<MyType: double value>
$d1 = r0.<MyType: double stress>
where $d0 and $d1 are locals (doubles) and r0 is of type MyType. I have
all the locals in hand, that is $d0, $d1 and r0 but how do I get from r0
the reference to his fields?
I have something like this in my Body Transformer:
derivUnits.insertAfter(Jimple.v().newAssignStmt(local_for_$d0,local_for_r0.???,stmt);
derivUnits.insertAfter(Jimple.v().newAssignStmt(local_for_$d1,local_for_r0.???,stmt);
and the problems are obvious the ??? ;-)
Any ideeas? And yes, where in the docs should I look in the future to
find these kind of infos?
Thanks,
Emil