Exemplo n.º 1
0
 @Override
 public void visitVarDef(JCVariableDecl tree) {
   super.visitVarDef(tree);
   if (tree.sym != null && tree.sym.kind == Kinds.VAR && !isParameter(tree.sym)) {
     docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, env.enclClass, tree));
   }
 }
Exemplo n.º 2
0
 @Override
 public void visitTopLevel(JCCompilationUnit tree) {
   super.visitTopLevel(tree);
   if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) {
     docenv.makePackageDoc(tree.packge, docenv.getTreePath(tree));
   }
 }
Exemplo n.º 3
0
 @Override
 public void visitClassDef(JCClassDecl tree) {
   super.visitClassDef(tree);
   if (tree.sym == null) return;
   if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) {
     ClassSymbol c = tree.sym;
     docenv.makeClassDoc(c, docenv.getTreePath(env.toplevel, tree));
   }
 }
Exemplo n.º 4
0
 public void visitMethodDef(MethodDef tree) {
   super.visitMethodDef(tree);
   MethodSymbol meth = (MethodSymbol) tree.sym;
   if (meth == null || meth.kind != Kinds.MTH) return;
   String docComment = env.toplevel.docComments.get(tree);
   if (meth.isConstructor()) docenv.makeConstructorDoc(meth, docComment, tree);
   else if (isAnnotationTypeElement(meth))
     docenv.makeAnnotationTypeElementDoc(meth, docComment, tree);
   else docenv.makeMethodDoc(meth, docComment, tree);
 }
Exemplo n.º 5
0
 public Tag[] firstSentenceTags() {
   if (firstSentence == null) {
     // Parse all sentences first to avoid duplicate warnings.
     inlineTags();
     try {
       env.setSilent(true);
       firstSentence = Comment.firstSentenceTags(this, commentText());
     } finally {
       env.setSilent(false);
     }
   }
   return firstSentence;
 }
Exemplo n.º 6
0
  @Override
  public void visitMethodDef(JCMethodDecl tree) {
    super.visitMethodDef(tree);
    MethodSymbol meth = tree.sym;
    if (meth == null || meth.kind != Kinds.MTH) return;
    TreePath treePath = docenv.getTreePath(env.toplevel, env.enclClass, tree);
    if (meth.isConstructor()) docenv.makeConstructorDoc(meth, treePath);
    else if (isAnnotationTypeElement(meth)) docenv.makeAnnotationTypeElementDoc(meth, treePath);
    else docenv.makeMethodDoc(meth, treePath);

    // release resources
    tree.body = null;
  }
Exemplo n.º 7
0
 /** Utility for subclasses which read HTML documentation files. */
 String readHTMLDocumentation(InputStream input, String filename) throws IOException {
   int filesize = input.available();
   byte[] filecontents = new byte[filesize];
   input.read(filecontents, 0, filesize);
   input.close();
   String encoding = env.getEncoding();
   String rawDoc =
       (encoding != null) ? new String(filecontents, encoding) : new String(filecontents);
   String upper = null;
   int bodyIdx = rawDoc.indexOf("<body");
   if (bodyIdx == -1) {
     bodyIdx = rawDoc.indexOf("<BODY");
     if (bodyIdx == -1) {
       upper = rawDoc.toUpperCase();
       bodyIdx = upper.indexOf("<BODY");
       if (bodyIdx == -1) {
         env.error(
             SourcePositionImpl.make(filename, Position.NOPOS, null),
             "javadoc.Body_missing_from_html_file");
         return "";
       }
     }
   }
   bodyIdx = rawDoc.indexOf('>', bodyIdx);
   if (bodyIdx == -1) {
     env.error(
         SourcePositionImpl.make(filename, Position.NOPOS, null),
         "javadoc.Body_missing_from_html_file");
     return "";
   }
   ++bodyIdx;
   int endIdx = rawDoc.indexOf("</body", bodyIdx);
   if (endIdx == -1) {
     endIdx = rawDoc.indexOf("</BODY", bodyIdx);
     if (endIdx == -1) {
       if (upper == null) {
         upper = rawDoc.toUpperCase();
       }
       endIdx = upper.indexOf("</BODY", bodyIdx);
       if (endIdx == -1) {
         env.error(
             SourcePositionImpl.make(filename, Position.NOPOS, null),
             "javadoc.End_body_missing_from_html_file");
         return "";
       }
     }
   }
   return rawDoc.substring(bodyIdx, endIdx);
 }
Exemplo n.º 8
0
 public void visitVarDef(VarDef tree) {
   super.visitVarDef(tree);
   if (tree.sym != null && tree.sym.kind == Kinds.VAR && !isParameter(tree.sym)) {
     String docComment = env.toplevel.docComments.get(tree);
     docenv.makeFieldDoc((VarSymbol) tree.sym, docComment, tree);
   }
 }
Exemplo n.º 9
0
 protected JavadocEnter(Context context) {
   super(context);
   messager = Messager.instance0(context);
   docenv = DocEnv.instance(context);
 }
Exemplo n.º 10
0
 protected JavadocMemberEnter(Context context) {
   super(context);
   docenv = DocEnv.instance(context);
 }