use of org.checkerframework.framework.type.treeannotator.TreeAnnotator 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);
}
Aggregations