src/share/classes/com/sun/tools/javac/tree/TreeInfo.java

changeset 1455
75ab654b5cd5
parent 1433
4f9853659bf1
child 1510
7873d37f5b37
equal deleted inserted replaced
1454:02a18f209ab3 1455:75ab654b5cd5
22 * or visit www.oracle.com if you need additional information or have any 22 * or visit www.oracle.com if you need additional information or have any
23 * questions. 23 * questions.
24 */ 24 */
25 25
26 package com.sun.tools.javac.tree; 26 package com.sun.tools.javac.tree;
27
27 28
28 29
29 import com.sun.source.tree.Tree; 30 import com.sun.source.tree.Tree;
30 import com.sun.tools.javac.code.*; 31 import com.sun.tools.javac.code.*;
31 import com.sun.tools.javac.comp.AttrContext; 32 import com.sun.tools.javac.comp.AttrContext;
326 public static String getCommentText(Env<?> env, JCTree tree) { 327 public static String getCommentText(Env<?> env, JCTree tree) {
327 DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL)) 328 DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL))
328 ? ((JCCompilationUnit) tree).docComments 329 ? ((JCCompilationUnit) tree).docComments
329 : env.toplevel.docComments; 330 : env.toplevel.docComments;
330 return (docComments == null) ? null : docComments.getCommentText(tree); 331 return (docComments == null) ? null : docComments.getCommentText(tree);
332 }
333
334 public static DCTree.DCDocComment getCommentTree(Env<?> env, JCTree tree) {
335 DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL))
336 ? ((JCCompilationUnit) tree).docComments
337 : env.toplevel.docComments;
338 return (docComments == null) ? null : docComments.getCommentTree(tree);
331 } 339 }
332 340
333 /** The position of the first statement in a block, or the position of 341 /** The position of the first statement in a block, or the position of
334 * the block itself if it is empty. 342 * the block itself if it is empty.
335 */ 343 */

mercurial