langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java
changeset 14952 d0022ae20516
parent 14722 aaa39655aa2e
child 15374 fb8f6acf09cc
--- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Dec 17 14:54:42 2012 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Mon Dec 17 07:47:05 2012 -0800
@@ -26,6 +26,7 @@
 package com.sun.tools.javac.tree;
 
 
+
 import com.sun.source.tree.Tree;
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.comp.AttrContext;
@@ -330,6 +331,13 @@
         return (docComments == null) ? null : docComments.getCommentText(tree);
     }
 
+    public static DCTree.DCDocComment getCommentTree(Env<?> env, JCTree tree) {
+        DocCommentTable docComments = (tree.hasTag(JCTree.Tag.TOPLEVEL))
+                ? ((JCCompilationUnit) tree).docComments
+                : env.toplevel.docComments;
+        return (docComments == null) ? null : docComments.getCommentTree(tree);
+    }
+
     /** The position of the first statement in a block, or the position of
      *  the block itself if it is empty.
      */