[Soot-list] Problem with analysing lamba function in Soot

Pengo.Edit at stud.u-szeged.hu Pengo.Edit at stud.u-szeged.hu
Mon Mar 26 06:18:07 EDT 2018


Dear All,

I recently started using Soot for my thesis. However I came across a  
problem with code containing Lambda-s. Soot always throws an  
exception, but the GitHub page of the project states it supports even  
Java 9 so I'm gussing I mess something up.  I'm not extendig soot just  
using the jar from the nightly build.

Here is how I run soot and the exception:

java -cp sootclasses-trunk-jar-with-dependencies.jar soot.Main -w  -cp  
.:/opt/jdk1.8.0_31/jre/lib/rt.jar:/opt/jdk1.8.0_31/jre/lib/jce.jar  
LambdaWithParams
Soot started on Sat Mar 24 15:37:31 CET 2018
java.lang.RuntimeException: Failed to convert <LambdaWithParams: void  
main(java.lang.String[])>
         at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:1886)
         at soot.SootMethod.getBodyFromMethodSource(SootMethod.java:126)
         at soot.SootMethod.retrieveActiveBody(SootMethod.java:385)
         at  
soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMethod(OnFlyCallGraphBuilder.java:710)
         at  
soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFlyCallGraphBuilder.java:262)
         at  
soot.jimple.toolkits.callgraph.CallGraphBuilder.build(CallGraphBuilder.java:106)
         at  
soot.jimple.toolkits.callgraph.CHATransformer.internalTransform(CHATransformer.java:49)
         at soot.SceneTransformer.transform(SceneTransformer.java:39)
         at soot.Transform.apply(Transform.java:93)
         at soot.RadioScenePack.internalApply(RadioScenePack.java:60)
         at  
soot.jimple.toolkits.callgraph.CallGraphPack.internalApply(CallGraphPack.java:49)
         at soot.Pack.apply(Pack.java:118)
         at soot.PackManager.runWholeProgramPacks(PackManager.java:595)
         at soot.PackManager.runPacksNormally(PackManager.java:487)
         at soot.PackManager.runPacks(PackManager.java:416)
         at soot.Main.run(Main.java:276)
         at soot.Main.main(Main.java:144)
Caused by: java.lang.RuntimeException: This operation requires  
resolving level HIERARCHY but StringConcat is at resolving level  
DANGLING
If you are extending Soot, try to add the following call before  
calling soot.Main.main(..):
Scene.v().addBasicClass(StringConcat,HIERARCHY);
Otherwise, try whole-program mode (-w).
         at soot.SootClass.checkLevelIgnoreResolving(SootClass.java:186)
         at  
soot.jimple.internal.JInterfaceInvokeExpr.<init>(JInterfaceInvokeExpr.java:47)
         at soot.jimple.Jimple.newInterfaceInvokeExpr(Jimple.java:446)
         at  
soot.asm.AsmMethodSource.convertMethodInsn(AsmMethodSource.java:1190)
         at soot.asm.AsmMethodSource.convert(AsmMethodSource.java:1640)
         at soot.asm.AsmMethodSource.getBody(AsmMethodSource.java:1884)
         ... 16 more



This is the source of the LambdaWithParams.java:

interface StringConcat {

     public String sconcat(String a, String b);
}
public class LambdaWithParams {

    public static void main(String args[]) {
         // lambda expression with multiple arguments
             StringConcat s = (str1, str2) -> str1 + str2;
         System.out.println("Result: "+s.sconcat("Hello ", "World"));
     }
}

I compiled LambdaWithParams with the same 1.8.0_31 java.

Your help/suggestions would be really appreciated!!

Thanks,
Edit


More information about the Soot-list mailing list