I am trying to use soot to analyze the kotlin project. I have written a HelloWorld.kt script and compiled it. I bring the snippet of code bellow:
fun main(args: Array<String>) {
println("Hello World!")
}
However, when I use soot to generate the CFG of its .class file, I get this errors:
soot.SootResolver$SootClassNotFoundException: couldn't find class: kotlin.Metadata (is your soot-class-path set properly?)
at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:246)
at soot.SootResolver.bringToHierarchy(SootResolver.java:222)
at soot.SootResolver.bringToSignatures(SootResolver.java:293)
at soot.SootResolver.processResolveWorklist(SootResolver.java:180)
at soot.SootResolver.resolveClass(SootResolver.java:142)
at soot.Scene.loadClass(Scene.java:1001)
at soot.Scene.loadClassAndSupport(Scene.java:988)
at soot.Scene.loadNecessaryClass(Scene.java:1790)
at soot.Scene.loadNecessaryClasses(Scene.java:1802)
at soot.Main.run(Main.java:241)
at soot.Main.main(Main.java:141)
at soot.tools.CFGViewer.main(CFGViewer.java:101)
I just executed the following commands:
java -cp sootclasses-trunk-jar-with-dependencies.jar soot.tools.CFGViewer -cp . -pp Helloworld
I can not find what is my mistake. Could you please help me?
you would have to add kotlin jars into the soot's classpath to make it work
PS annotations could be downloaded from https://mvnrepository.com/artifact/org.jetbrains/annotations