src/share/classes/com/sun/tools/javadoc/JavadocMemberEnter.java

changeset 1443
cfde9737131e
parent 1391
ef3ad754f5c7
child 1490
fc4cb1577ad6
equal deleted inserted replaced
1442:fcf89720ae71 1443:cfde9737131e
23 * questions. 23 * questions.
24 */ 24 */
25 25
26 package com.sun.tools.javadoc; 26 package com.sun.tools.javadoc;
27 27
28 import com.sun.source.util.TreePath;
28 import com.sun.tools.javac.code.Flags; 29 import com.sun.tools.javac.code.Flags;
29 import com.sun.tools.javac.code.Kinds; 30 import com.sun.tools.javac.code.Kinds;
30 import com.sun.tools.javac.code.Symbol.*; 31 import com.sun.tools.javac.code.Symbol.*;
31 import com.sun.tools.javac.comp.MemberEnter; 32 import com.sun.tools.javac.comp.MemberEnter;
32 import com.sun.tools.javac.tree.JCTree.*; 33 import com.sun.tools.javac.tree.JCTree.*;
33 import com.sun.tools.javac.tree.TreeInfo;
34 import com.sun.tools.javac.util.Context; 34 import com.sun.tools.javac.util.Context;
35 import com.sun.tools.javac.util.Position;
36 35
37 /** 36 /**
38 * Javadoc's own memberEnter phase does a few things above and beyond that 37 * Javadoc's own memberEnter phase does a few things above and beyond that
39 * done by javac. 38 * done by javac.
40 * 39 *
71 @Override 70 @Override
72 public void visitMethodDef(JCMethodDecl tree) { 71 public void visitMethodDef(JCMethodDecl tree) {
73 super.visitMethodDef(tree); 72 super.visitMethodDef(tree);
74 MethodSymbol meth = tree.sym; 73 MethodSymbol meth = tree.sym;
75 if (meth == null || meth.kind != Kinds.MTH) return; 74 if (meth == null || meth.kind != Kinds.MTH) return;
76 String docComment = TreeInfo.getCommentText(env, tree); 75 TreePath treePath = docenv.getTreePath(env.toplevel, tree);
77 Position.LineMap lineMap = env.toplevel.lineMap;
78 if (meth.isConstructor()) 76 if (meth.isConstructor())
79 docenv.makeConstructorDoc(meth, docComment, tree, lineMap); 77 docenv.makeConstructorDoc(meth, treePath);
80 else if (isAnnotationTypeElement(meth)) 78 else if (isAnnotationTypeElement(meth))
81 docenv.makeAnnotationTypeElementDoc(meth, docComment, tree, lineMap); 79 docenv.makeAnnotationTypeElementDoc(meth, treePath);
82 else 80 else
83 docenv.makeMethodDoc(meth, docComment, tree, lineMap); 81 docenv.makeMethodDoc(meth, treePath);
84 82
85 // release resources 83 // release resources
86 tree.body = null; 84 tree.body = null;
87 } 85 }
88 86
90 public void visitVarDef(JCVariableDecl tree) { 88 public void visitVarDef(JCVariableDecl tree) {
91 super.visitVarDef(tree); 89 super.visitVarDef(tree);
92 if (tree.sym != null && 90 if (tree.sym != null &&
93 tree.sym.kind == Kinds.VAR && 91 tree.sym.kind == Kinds.VAR &&
94 !isParameter(tree.sym)) { 92 !isParameter(tree.sym)) {
95 String docComment = TreeInfo.getCommentText(env, tree); 93 docenv.makeFieldDoc(tree.sym, docenv.getTreePath(env.toplevel, tree));
96 Position.LineMap lineMap = env.toplevel.lineMap;
97 docenv.makeFieldDoc(tree.sym, docComment, tree, lineMap);
98 } 94 }
99 } 95 }
100 96
101 private static boolean isAnnotationTypeElement(MethodSymbol meth) { 97 private static boolean isAnnotationTypeElement(MethodSymbol meth) {
102 return ClassDocImpl.isAnnotationType(meth.enclClass()); 98 return ClassDocImpl.isAnnotationType(meth.enclClass());

mercurial