Search code examples
code-analysiseclipse-jdtstatic-code-analysissootcontrol-flow-graph

Can I use JDT to generate control flow graph?


Does JDT provide any APIs to generate control flow graph? I used soot to generate control flow graph,but can I use JDT to generate control flow graph?


Solution

  • JDT sure provides all necessary information, but you may have to invest some code of your own, to get exactly that data structure you are seeking.

    Much depends on the level of detail you are interested in: A call graph between methods? Detailed flow of basic blocks within a method? A combination of both?

    If your interest is related in spirit to refactoring, you may get some inspiration from the internal code in JDT/UI that is used for flow analysis on behalf of refactorings. Have a look at the following sections of source code: