Search in sources :

Example 1 with IInitialResolver

use of soot.javaToJimple.IInitialResolver in project soot by Sable.

the class JavaClassSource method resolve.

public Dependencies resolve(SootClass sc) {
    if (Options.v().verbose())
        logger.debug("resolving [from .java]: " + className);
    IInitialResolver resolver;
    if (Options.v().polyglot())
        resolver = InitialResolver.v();
    else
        resolver = JastAddInitialResolver.v();
    if (fullPath != null) {
        resolver.formAst(fullPath.getPath(), SourceLocator.v().sourcePath(), className);
    }
    // System.out.println("about to call initial resolver in j2j: "+sc.getName());
    Dependencies references = resolver.resolveFromJavaFile(sc);
    /*
         * 1st March 2006
         * Nomair
         * This seems to be a good place to calculate all the
         * AST Metrics needed from Java's AST
         */
    if (Options.v().ast_metrics()) {
        // System.out.println("CALLING COMPUTEASTMETRICS!!!!!!!");
        Node ast = InitialResolver.v().getAst();
        if (ast == null) {
            logger.debug("No compatible AST available for AST metrics. Skipping. Try -polyglot option.");
        } else {
            ComputeASTMetrics metrics = new ComputeASTMetrics(ast);
            metrics.apply();
        }
    }
    return references;
}
Also used : IInitialResolver(soot.javaToJimple.IInitialResolver) ComputeASTMetrics(soot.toolkits.astmetrics.ComputeASTMetrics) Node(polyglot.ast.Node) Dependencies(soot.javaToJimple.IInitialResolver.Dependencies)

Aggregations

Node (polyglot.ast.Node)1 IInitialResolver (soot.javaToJimple.IInitialResolver)1 Dependencies (soot.javaToJimple.IInitialResolver.Dependencies)1 ComputeASTMetrics (soot.toolkits.astmetrics.ComputeASTMetrics)1