1 /** 2 * Provides interfaces and classes for finding where in the existing 3 * source to insert annotations etc. {@link annotator.find.TreeFinder} manages the 4 * control flow and discovers the positions for insertion, relying on 5 * implementations of {@link annotator.find.Criterion} for determining whether an 6 * insertion should be made at a given location and on extensions of 7 * {@link annotator.find.Insertion} for the concrete text to be inserted. 8 * <p> 9 * The current flow, given a collection of insertions and an abstract 10 * syntax tree (AST) representing a Java source file, consists of a 11 * pre-order traversal of the AST to find insertion positions, followed 12 * by the insertion of text for each positioned {@link annotator.find.Insertion} into 13 * the source code, in reverse order by position. At each annotatable 14 * node encountered during the traversal, the program checks the 15 * {@link annotator.find.Criteria} for each yet-unmatched {@link annotator.find.Insertion} against 16 * the current node; when there is a match, the program finds and 17 * records the appropriate source position. 18 * 19 * @see annotator.find.TreeFinder#getInsertionsByPosition(com.sun.tools.javac.tree.JCTree.JCCompilationUnit, java.util.List) 20 */ 21 package annotator.find; 22