Search in sources :

Example 1 with AnnotationProvider

use of org.checkerframework.javacutil.AnnotationProvider in project checker-framework by typetools.

the class SignaturePrinter method init.

// /////// Initialization /////////////
private void init(ProcessingEnvironment env, String checkerName) {
    if (checkerName != null) {
        try {
            Class<?> checkerClass = Class.forName(checkerName);
            Constructor<?> cons = checkerClass.getConstructor();
            checker = (SourceChecker) cons.newInstance();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    } else {
        checker = new SourceChecker() {

            @Override
            protected SourceVisitor<?, ?> createSourceVisitor() {
                return null;
            }

            @Override
            public AnnotationProvider getAnnotationProvider() {
                throw new UnsupportedOperationException("getAnnotationProvider is not implemented for this class.");
            }
        };
    }
    checker.init(env);
}
Also used : SourceVisitor(org.checkerframework.framework.source.SourceVisitor) AnnotationProvider(org.checkerframework.javacutil.AnnotationProvider) SourceChecker(org.checkerframework.framework.source.SourceChecker)

Example 2 with AnnotationProvider

use of org.checkerframework.javacutil.AnnotationProvider in project checker-framework by typetools.

the class CFGBuilder method run.

/**
 * Build the control flow graph of some code (method, initializer block, ...). bodyPath is the
 * TreePath to the body of that code.
 */
public ControlFlowGraph run(TreePath bodyPath, ProcessingEnvironment env, UnderlyingAST underlyingAST) {
    declaredClasses.clear();
    TreeBuilder builder = new TreeBuilder(env);
    AnnotationProvider annotationProvider = new BasicAnnotationProvider();
    PhaseOneResult phase1result = new CFGTranslationPhaseOne().process(bodyPath, env, underlyingAST, exceptionalExitLabel, builder, annotationProvider);
    ControlFlowGraph phase2result = new CFGTranslationPhaseTwo().process(phase1result);
    ControlFlowGraph phase3result = CFGTranslationPhaseThree.process(phase2result);
    return phase3result;
}
Also used : BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) AnnotationProvider(org.checkerframework.javacutil.AnnotationProvider) BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) TreeBuilder(org.checkerframework.javacutil.trees.TreeBuilder)

Example 3 with AnnotationProvider

use of org.checkerframework.javacutil.AnnotationProvider in project bazel by bazelbuild.

the class CFGBuilder method run.

/**
     * Build the control flow graph of some code.
     */
public ControlFlowGraph run(CompilationUnitTree root, ProcessingEnvironment env, UnderlyingAST underlyingAST) {
    declaredClasses = new LinkedList<>();
    declaredLambdas = new LinkedList<>();
    TreeBuilder builder = new TreeBuilder(env);
    AnnotationProvider annotationProvider = new BasicAnnotationProvider();
    PhaseOneResult phase1result = new CFGTranslationPhaseOne().process(root, env, underlyingAST, exceptionalExitLabel, builder, annotationProvider);
    ControlFlowGraph phase2result = new CFGTranslationPhaseTwo().process(phase1result);
    ControlFlowGraph phase3result = CFGTranslationPhaseThree.process(phase2result);
    return phase3result;
}
Also used : BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) AnnotationProvider(org.checkerframework.javacutil.AnnotationProvider) BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) TreeBuilder(org.checkerframework.javacutil.trees.TreeBuilder)

Example 4 with AnnotationProvider

use of org.checkerframework.javacutil.AnnotationProvider in project bazel by bazelbuild.

the class CFGBuilder method run.

/**
     * Build the control flow graph of some code (method, initializer block, ...).
     * bodyPath is the TreePath to the body of that code.
     */
public ControlFlowGraph run(TreePath bodyPath, ProcessingEnvironment env, UnderlyingAST underlyingAST) {
    declaredClasses = new LinkedList<>();
    TreeBuilder builder = new TreeBuilder(env);
    AnnotationProvider annotationProvider = new BasicAnnotationProvider();
    PhaseOneResult phase1result = new CFGTranslationPhaseOne().process(bodyPath, env, underlyingAST, exceptionalExitLabel, builder, annotationProvider);
    ControlFlowGraph phase2result = new CFGTranslationPhaseTwo().process(phase1result);
    ControlFlowGraph phase3result = CFGTranslationPhaseThree.process(phase2result);
    return phase3result;
}
Also used : BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) AnnotationProvider(org.checkerframework.javacutil.AnnotationProvider) BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) TreeBuilder(org.checkerframework.javacutil.trees.TreeBuilder)

Example 5 with AnnotationProvider

use of org.checkerframework.javacutil.AnnotationProvider in project checker-framework by typetools.

the class CFGBuilder method run.

/**
 * Build the control flow graph of some code.
 */
public ControlFlowGraph run(CompilationUnitTree root, ProcessingEnvironment env, UnderlyingAST underlyingAST) {
    declaredClasses.clear();
    declaredLambdas.clear();
    TreeBuilder builder = new TreeBuilder(env);
    AnnotationProvider annotationProvider = new BasicAnnotationProvider();
    PhaseOneResult phase1result = new CFGTranslationPhaseOne().process(root, env, underlyingAST, exceptionalExitLabel, builder, annotationProvider);
    ControlFlowGraph phase2result = new CFGTranslationPhaseTwo().process(phase1result);
    ControlFlowGraph phase3result = CFGTranslationPhaseThree.process(phase2result);
    return phase3result;
}
Also used : BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) AnnotationProvider(org.checkerframework.javacutil.AnnotationProvider) BasicAnnotationProvider(org.checkerframework.javacutil.BasicAnnotationProvider) TreeBuilder(org.checkerframework.javacutil.trees.TreeBuilder)

Aggregations

AnnotationProvider (org.checkerframework.javacutil.AnnotationProvider)5 BasicAnnotationProvider (org.checkerframework.javacutil.BasicAnnotationProvider)4 TreeBuilder (org.checkerframework.javacutil.trees.TreeBuilder)4 SourceChecker (org.checkerframework.framework.source.SourceChecker)1 SourceVisitor (org.checkerframework.framework.source.SourceVisitor)1