Snippets

Michael Eichberg [OPAL - 1.0.0] Running an analysis (here PurityAnalysis) using the PropertyStore (the FixpointComputationsFramework)

You are viewing an old version of this snippet. View the current version.
Revised by Michael Eichberg 9194600
import org.opalj.collection.immutable._; import org.opalj.br._ ; import org.opalj.br.analyses._; import org.opalj.br.instructions._; import org.opalj.collection.immutable.ConstArray.find; import org.opalj.util.PerformanceEvaluation.time
// create a project
implicit val p = Project(new java.io.File("/Users/Michael/Code/OPAL/OPAL/bi/target/scala-2.11/resource_managed/test/pureness.jar"))
// get the central property store
implicit val ps = p.get(SourceElementsPropertyStoreKey)
ps.debug = true

// run the analysis (asynchronously)
org.opalj.fpcf.analysis.PurityAnalysis.start(p,ps); Thread.sleep(500)

// make sure that all computations have finished (this is a blocking operation)
ps.waitOnPropertyComputationCompletion(true)

// query the property store
ps.collect{
    case (method : Method, purity : org.opalj.fpcf.properties.Purity) => method.toJava(p.classFile(method),purity.toString)
}.toList.sorted.foreach(println)
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.