Search in sources :

Example 1 with PropagationTreeAnnotator

use of org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator in project checker-framework by typetools.

the class ReflectionTestAnnotatedTypeFactory method createTreeAnnotator.

@Override
public TreeAnnotator createTreeAnnotator() {
    ImplicitsTreeAnnotator implicitsTreeAnnotator = new ImplicitsTreeAnnotator(this);
    AnnotationMirror bottom = AnnotationBuilder.fromClass(elements, ReflectBottom.class);
    implicitsTreeAnnotator.addTreeKind(com.sun.source.tree.Tree.Kind.NULL_LITERAL, bottom);
    implicitsTreeAnnotator.addTreeKind(com.sun.source.tree.Tree.Kind.INT_LITERAL, bottom);
    return new ListTreeAnnotator(new PropagationTreeAnnotator(this), implicitsTreeAnnotator);
}
Also used : ImplicitsTreeAnnotator(org.checkerframework.framework.type.treeannotator.ImplicitsTreeAnnotator) AnnotationMirror(javax.lang.model.element.AnnotationMirror) PropagationTreeAnnotator(org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator) ListTreeAnnotator(org.checkerframework.framework.type.treeannotator.ListTreeAnnotator)

Example 2 with PropagationTreeAnnotator

use of org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator in project checker-framework by typetools.

the class FlowTestAnnotatedTypeFactory method createTreeAnnotator.

@Override
public TreeAnnotator createTreeAnnotator() {
    ImplicitsTreeAnnotator implicitsTreeAnnotator = new ImplicitsTreeAnnotator(this);
    implicitsTreeAnnotator.addTreeKind(com.sun.source.tree.Tree.Kind.NULL_LITERAL, BOTTOM);
    return new ListTreeAnnotator(new PropagationTreeAnnotator(this), implicitsTreeAnnotator);
}
Also used : ImplicitsTreeAnnotator(org.checkerframework.framework.type.treeannotator.ImplicitsTreeAnnotator) PropagationTreeAnnotator(org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator) ListTreeAnnotator(org.checkerframework.framework.type.treeannotator.ListTreeAnnotator)

Example 3 with PropagationTreeAnnotator

use of org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator in project checker-framework by typetools.

the class WholeProgramInferenceTestAnnotatedTypeFactory method createTreeAnnotator.

@Override
public TreeAnnotator createTreeAnnotator() {
    ImplicitsTreeAnnotator implicitsTreeAnnotator = new ImplicitsTreeAnnotator(this);
    implicitsTreeAnnotator.addTreeKind(com.sun.source.tree.Tree.Kind.NULL_LITERAL, BOTTOM);
    implicitsTreeAnnotator.addTreeKind(com.sun.source.tree.Tree.Kind.INT_LITERAL, BOTTOM);
    return new ListTreeAnnotator(new PropagationTreeAnnotator(this), implicitsTreeAnnotator);
}
Also used : ImplicitsTreeAnnotator(org.checkerframework.framework.type.treeannotator.ImplicitsTreeAnnotator) PropagationTreeAnnotator(org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator) ListTreeAnnotator(org.checkerframework.framework.type.treeannotator.ListTreeAnnotator)

Example 4 with PropagationTreeAnnotator

use of org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator in project checker-framework by typetools.

the class GenericAnnotatedTypeFactory method createTreeAnnotator.

/**
 * Returns a {@link TreeAnnotator} that adds annotations to a type based on the contents of a
 * tree.
 *
 * <p>The default tree annotator is a {@link ListTreeAnnotator} of the following:
 *
 * <ol>
 *   <li>{@link PropagationTreeAnnotator}: Propagates annotations from subtrees
 *   <li>{@link LiteralTreeAnnotator}: Adds annotations based on {@link QualifierForLiterals}
 *       meta-annotations
 *   <li>{@link DependentTypesTreeAnnotator}: Adapts dependent annotations based on context
 * </ol>
 *
 * <p>Subclasses may override this method to specify additional tree annotators, for example:
 *
 * <pre>
 * new ListTreeAnnotator(super.createTreeAnnotator(), new KeyLookupTreeAnnotator(this));
 * </pre>
 *
 * @return a tree annotator
 */
protected TreeAnnotator createTreeAnnotator() {
    List<TreeAnnotator> treeAnnotators = new ArrayList<>(2);
    treeAnnotators.add(new PropagationTreeAnnotator(this));
    treeAnnotators.add(new LiteralTreeAnnotator(this).addStandardLiteralQualifiers());
    if (dependentTypesHelper.hasDependentAnnotations()) {
        treeAnnotators.add(dependentTypesHelper.createDependentTypesTreeAnnotator());
    }
    return new ListTreeAnnotator(treeAnnotators);
}
Also used : LiteralTreeAnnotator(org.checkerframework.framework.type.treeannotator.LiteralTreeAnnotator) PropagationTreeAnnotator(org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator) ArrayList(java.util.ArrayList) LiteralTreeAnnotator(org.checkerframework.framework.type.treeannotator.LiteralTreeAnnotator) PropagationTreeAnnotator(org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator) TreeAnnotator(org.checkerframework.framework.type.treeannotator.TreeAnnotator) ListTreeAnnotator(org.checkerframework.framework.type.treeannotator.ListTreeAnnotator) DependentTypesTreeAnnotator(org.checkerframework.framework.util.dependenttypes.DependentTypesTreeAnnotator) ListTreeAnnotator(org.checkerframework.framework.type.treeannotator.ListTreeAnnotator)

Example 5 with PropagationTreeAnnotator

use of org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator in project checker-framework by typetools.

the class TestAnnotatedTypeFactory method createTreeAnnotator.

@Override
public TreeAnnotator createTreeAnnotator() {
    ImplicitsTreeAnnotator implicitsTreeAnnotator = new ImplicitsTreeAnnotator(this);
    implicitsTreeAnnotator.addTreeKind(com.sun.source.tree.Tree.Kind.NULL_LITERAL, BOTTOM);
    return new ListTreeAnnotator(new PropagationTreeAnnotator(this), implicitsTreeAnnotator);
}
Also used : ImplicitsTreeAnnotator(org.checkerframework.framework.type.treeannotator.ImplicitsTreeAnnotator) PropagationTreeAnnotator(org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator) ListTreeAnnotator(org.checkerframework.framework.type.treeannotator.ListTreeAnnotator)

Aggregations

ListTreeAnnotator (org.checkerframework.framework.type.treeannotator.ListTreeAnnotator)7 PropagationTreeAnnotator (org.checkerframework.framework.type.treeannotator.PropagationTreeAnnotator)7 ImplicitsTreeAnnotator (org.checkerframework.framework.type.treeannotator.ImplicitsTreeAnnotator)4 LiteralTreeAnnotator (org.checkerframework.framework.type.treeannotator.LiteralTreeAnnotator)3 AnnotationMirror (javax.lang.model.element.AnnotationMirror)2 ArrayList (java.util.ArrayList)1 TreeAnnotator (org.checkerframework.framework.type.treeannotator.TreeAnnotator)1 DependentTypesTreeAnnotator (org.checkerframework.framework.util.dependenttypes.DependentTypesTreeAnnotator)1