[Soot-list] Dependency Injection - from annotation to static field reference

Marc-Andre Laverdiere-Papineau marc-andre.laverdiere-papineau at polymtl.ca
Thu Feb 14 19:37:16 EST 2013


Hello,

I am working on a code transformation that is currently not working. My 
code is supposed to transform a reference to a Web Service endpoint to a 
static reference generated a priori.

However, Spark (with default options) is not connecting the dots 
properly, so I have a missing edge in the call graph. I also 
double-checked the points-to-sets and there is no intersection between 
the static field's and the local variable's.

There is the small chunk of code that shows the transformation:

AssignStmt newStmt = Jimple.v().newAssignStmt(assigned,
Jimple.v().newStaticFieldRef(targetField.makeRef()));
substitutions.add(new Pair<Unit, Unit>(u, newStmt));
...
for (Pair<Unit, Unit> p : substitutions) {
   units.swapWith(p.getO1(), p.getO2());
}

The generated Jimple looks like this (I simplified the types for 
readability):
public void <init>()
     {
         SimpleServletEchoCases r0;
         EchoServiceImplService $r1;
         IEchoService $r2;

         r0 := @this: SimpleServletEchoCases;
         specialinvoke r0.<java.lang.Object: void <init>()>();
         $r1 = <SimpleServletEchoCases: EchoServiceImplService 
serviceEndpoint>;
         $r2 = <WSCaller: EchoServiceImpl wsEchoServiceImpl>;
         <SimpleServletEchoCases: IEchoService service> = $r2;
         return;
     }

I probably did something silly - can anyone spot the mistake?

-- 
Marc-André Laverdière-Papineau
Doctorant - PhD Candidate


More information about the Soot-list mailing list