soot icon indicating copy to clipboard operation
soot copied to clipboard

How to setType for a SootField?

Open Jarhow opened this issue 1 year ago • 1 comments

I have modified the Type of some SootField,e.g I set Runnable type to it's implements (A), Code be like: SootField f = assignStmt.getFieldRef().getField(); SootClass fclz = f.getDeclaringClass(); f.setType(RightType); // logger.warn("Test:{}:",RightType instanceof RefLikeType); // f.setDeclaringClass(fclz); assignStmt.getFieldRef().setFieldRef(f.makeRef());

when I logger this modified field's signature immediately,it looks good,however when I get it in other Unit,it can't keep type A,it remains Runnable,and it's Signature also changed from <xx.xx.mainActivity:A xxx> to <androidx.appcompat.app.AppCompatActivity: java.lang.Runnable xxx>

So How Can I modify a field correctly?

Jarhow avatar Apr 25 '23 08:04 Jarhow

it's implements A looks like mainActivity$1

Jarhow avatar Apr 25 '23 08:04 Jarhow