com.sun.tools.javac.tree.DocCommentTable Java Examples
The following examples show how to use
com.sun.tools.javac.tree.DocCommentTable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DocCommentIntegrator.java From EasyMPermission with MIT License | 6 votes |
static void attach(final JCTree node, String docCommentContent, Object map_) { final String docCommentContent_ = docCommentContent; ((DocCommentTable) map_).putComment(node, new Comment() { @Override public String getText() { return docCommentContent_; } @Override public int getSourcePos(int index) { return -1; } @Override public CommentStyle getStyle() { return CommentStyle.JAVADOC; } @Override public boolean isDeprecated() { return JavacHandlerUtil.nodeHasDeprecatedFlag(node); } }); }
Example #2
Source File: JavacHandlerUtil.java From EasyMPermission with MIT License | 5 votes |
static void copyJavadoc(JavacNode from, JCTree to, CopyJavadoc copyMode, Object dc) { DocCommentTable dct = (DocCommentTable) dc; Comment javadoc = dct.getComment(from.get()); if (javadoc != null) { String[] filtered = copyMode.split(javadoc.getText()); if (copyMode == CopyJavadoc.SETTER && shouldReturnThis(from)) { filtered[0] = addReturnsThisIfNeeded(filtered[0]); } dct.putComment(to, createJavadocComment(filtered[0], from)); dct.putComment(from.get(), createJavadocComment(filtered[1], from)); } }
Example #3
Source File: TreeConverter.java From j2objc with Apache License 2.0 | 5 votes |
private Comment convertAssociatedComment(Tree node, TreePath path) { boolean docCommentsEnabled = newUnit.getEnv().options().docCommentsEnabled(); DocCommentTable docComments = ((JCCompilationUnit) unit).docComments; if (!docCommentsEnabled || docComments == null || !docComments.hasComment((JCTree) node)) { return null; } com.sun.tools.javac.parser.Tokens.Comment javacComment = docComments.getComment((JCTree) node); Comment comment; switch (javacComment.getStyle()) { case BLOCK: comment = new BlockComment(); break; case JAVADOC: comment = convertJavadocComment(path); break; case LINE: comment = new LineComment(); break; default: throw new AssertionError("unknown comment type"); } int startPos = javacComment.getSourcePos(0); int endPos = startPos + javacComment.getText().length(); comment.setSourceRange(startPos, endPos); comment.setLineNumber((int) unit.getLineMap().getLineNumber(startPos)); return comment; }
Example #4
Source File: PrettyCommentsPrinter.java From EasyMPermission with MIT License | 4 votes |
@SuppressWarnings("unchecked") private void loadDocCommentsTable(Object dc) { if (dc instanceof Map<?, ?>) this.docComments = (Map) dc; else if (dc instanceof DocCommentTable) this.docTable = (DocCommentTable) dc; }