}
public static void main(String[] args) throws IOException {
// init xact
XMLAnalysis analysis = new XMLAnalysis(null,
Collections.singletonList(HotspotTest1.class.getName()));
analysis.loadClasses();
Set<ValueBox> hotspots = new HashSet<ValueBox>();
Map<ValueBox, SootMethod> hotspot2method = new HashMap<ValueBox, SootMethod>();
for (SootClass cl : Scene.v().getApplicationClasses()) {
for (SootMethod m : cl.getMethods()) {
if (!m.isConcrete())
continue; // ignore abstract methods etc.
if (!m.isPublic())
continue; // only public
if (!m.getReturnType().equals(RefType.v("dk.brics.xact.XML")))
continue; // only methods that return XML (FIXME: Will
// exclude more specific types like Element)
Body body = m.retrieveActiveBody();
for (Unit unit : body.getUnits()) {
if (unit instanceof ReturnStmt) {
ReturnStmt stmt = (ReturnStmt) unit;
hotspots.add(stmt.getOpBox());
hotspot2method.put(stmt.getOpBox(), m);
}
}
}
}
analysis.setConfiguration(new JWIGConfiguration(hotspots));
// run xact
TranslationResult result = analysis.buildFlowGraph();
analysis.transformFlowGraph(result.getGraph());
final FlowGraph graph = result.getGraph();
XMLGraphBuilder xmlGraphs = analysis.buildXMLGraphs(graph);
int counter = 0;
for (Map.Entry<ValueBox, AnalyzeStm> en : result.getHotspots()
.entrySet()) {
ValueBox value = en.getKey();