21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 6985205 |
26 * @bug 6985205 6986246 |
27 * @summary access to tree positions and doc comments may be lost across annotation processing rounds |
27 * @summary access to tree positions and doc comments may be lost across annotation processing rounds |
28 * @build TreePosRoundsTest |
28 * @build TreePosRoundsTest |
29 * @compile -proc:only -processor TreePosRoundsTest TreePosRoundsTest.java |
29 * @compile -proc:only -processor TreePosRoundsTest TreePosRoundsTest.java |
30 * @run main TreePosRoundsTest |
30 * @run main TreePosRoundsTest |
31 */ |
31 */ |
90 round++; |
92 round++; |
91 |
93 |
92 // Scan trees for elements, verifying source tree positions |
94 // Scan trees for elements, verifying source tree positions |
93 for (Element e: roundEnv.getRootElements()) { |
95 for (Element e: roundEnv.getRootElements()) { |
94 try { |
96 try { |
95 Trees trees = Trees.instance(processingEnv); // cannot cache this across rounds |
|
96 TreePath p = trees.getPath(e); |
97 TreePath p = trees.getPath(e); |
97 new TestTreeScanner(p.getCompilationUnit(), trees).scan(trees.getPath(e), null); |
98 new TestTreeScanner(p.getCompilationUnit(), trees).scan(trees.getPath(e), null); |
98 } catch (IOException ex) { |
99 } catch (IOException ex) { |
99 messager.printMessage(Diagnostic.Kind.ERROR, |
100 messager.printMessage(Diagnostic.Kind.ERROR, |
100 "Cannot get source: " + ex, e); |
101 "Cannot get source: " + ex, e); |