tac
. Depending on your usage scenario you may have to update your project dependency.
@majestocx Regarding the Call Graph:
Call Graphs in Opal are represented as two distinct properties, handling either the callers of a certain method (org.opalj.br.fpcf.cg.properties.CallersProperty
), or for a given call site (method and program counter) the set of potential targets (org.opalj.br.fpcf.cf.properties.Callees
).
In order two retrieve these properties for a given Method you have to do the follwing three steps:
1: Build the call graph.
val ps = project.get(PropertyStoreKey)
val manager = project.get(FPCFAnalysesManagerKey)
implicit val declaredMethods = project.get(DeclaredMethodsKey)
manager.runAll(
RTACallGraphAnalysisScheduler,
TriggeredStaticInitializerAnalysis,
TriggeredLoadedClassesAnalysis,
TriggeredFinalizerAnalysisScheduler,
TriggeredThreadRelatedCallsAnalysis,
TriggeredSerializationRelatedCallsAnalysis,
TriggeredReflectionRelatedCallsAnalysis,
TriggeredInstantiatedTypesAnalysis,
TriggeredConfiguredNativeMethodsAnalysis,
TriggeredSystemPropertiesAnalysis,
LazyCalleesAnalysis(
Set(
StandardInvokeCallees,
SerializationRelatedCallees,
ReflectionRelatedCallees,
ThreadRelatedIncompleteCallSites
)
),
LazyL0BaseAIAnalysis,
TACAITransformer
)
“Convert” a method to declared method
val dm = declaredMethods(method)
Retrieve the callers/callees for that declared method:
ps(dm, CallersProperty.key /*Callees.key*/)
I have to admit, that this is rather complicated.
Unfortunately, a more elegant way to retrieve the call graph is under development right now, and only available at the feature/CallGraphKey
branch.
val aiResult = BaseAI(m, d)
val tac @ TACode(params, code, _, cfg, ehs, _) =
TACAI(m, project.classHierarchy, aiResult)(Nil)
if (toString) Console.out.println(m.toJava(tac.toString))
(
ToTxt(params, code, cfg, skipParams = false, true, true).mkString("\n”),
String.java
String.class
it looks like this:
"
is escaped, so until another "
appears everything will be seen as a string.