< prev index next >

src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/CommentUtils.java

Print this page




 206 
 207     public DocCommentTree parse(URI uri, String text) {
 208         return trees.getDocCommentTree(new SimpleJavaFileObject(
 209                 uri, JavaFileObject.Kind.SOURCE) {
 210             @Override @DefinedBy(Api.COMPILER)
 211             public CharSequence getCharContent(boolean ignoreEncoding) {
 212                 return text;
 213             }
 214         });
 215     }
 216 
 217     public void setDocCommentTree(Element element, List<? extends DocTree> fullBody,
 218                                   List<? extends DocTree> blockTags, Utils utils) {
 219         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, blockTags);
 220         dcTreesMap.put(element, new DocCommentDuo(null, docTree));
 221         // A method having null comment (no comment) that might need to be replaced
 222         // with a synthetic comment, remove such a comment from the cache.
 223         utils.removeCommentHelper(element);
 224     }
 225 











 226     /**
 227      * A simplistic container to transport a TreePath, DocCommentTree pair.
 228      * Here is why we need this:
 229      * a. not desirable to add javac's pair.
 230      * b. DocTreePath is not a viable  option either, as a null TreePath is required
 231      * to represent synthetic comments for Enum.values, valuesOf, javafx properties.
 232      */
 233     public static class DocCommentDuo {
 234         public final TreePath treePath;
 235         public final DocCommentTree dcTree;
 236 
 237         public DocCommentDuo(TreePath treePath, DocCommentTree dcTree) {
 238             this.treePath = treePath;
 239             this.dcTree = dcTree;
 240         }
 241     }
 242 }


 206 
 207     public DocCommentTree parse(URI uri, String text) {
 208         return trees.getDocCommentTree(new SimpleJavaFileObject(
 209                 uri, JavaFileObject.Kind.SOURCE) {
 210             @Override @DefinedBy(Api.COMPILER)
 211             public CharSequence getCharContent(boolean ignoreEncoding) {
 212                 return text;
 213             }
 214         });
 215     }
 216 
 217     public void setDocCommentTree(Element element, List<? extends DocTree> fullBody,
 218                                   List<? extends DocTree> blockTags, Utils utils) {
 219         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, blockTags);
 220         dcTreesMap.put(element, new DocCommentDuo(null, docTree));
 221         // A method having null comment (no comment) that might need to be replaced
 222         // with a synthetic comment, remove such a comment from the cache.
 223         utils.removeCommentHelper(element);
 224     }
 225 
 226     public void setAccessorCommentTree(Element element, List<DocTree> fullBody,
 227                                   List<DocTree> blockTags, Utils utils) {
 228         DocCommentTree docTree = treeFactory.newDocCommentTree(fullBody, blockTags);
 229         TreePath pathToEncl = utils.docTrees.getPath(element.getEnclosingElement());
 230         dcTreesMap.put(element, new DocCommentDuo(pathToEncl, docTree));
 231         // There maybe an entry with the original comments usually null,
 232         // therefore remove that entry if it exists, and allow a new one
 233         // to be reestablished.
 234         utils.removeCommentHelper(element);
 235     }
 236 
 237     /**
 238      * A simplistic container to transport a TreePath, DocCommentTree pair.
 239      * Here is why we need this:
 240      * a. not desirable to add javac's pair.
 241      * b. DocTreePath is not a viable  option either, as a null TreePath is required
 242      * to represent synthetic comments for Enum.values, valuesOf, javafx properties.
 243      */
 244     public static class DocCommentDuo {
 245         public final TreePath treePath;
 246         public final DocCommentTree dcTree;
 247 
 248         public DocCommentDuo(TreePath treePath, DocCommentTree dcTree) {
 249             this.treePath = treePath;
 250             this.dcTree = dcTree;
 251         }
 252     }
 253 }
< prev index next >