23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.javadoc; |
26 package com.sun.tools.javadoc; |
27 |
27 |
|
28 |
28 import javax.tools.JavaFileObject; |
29 import javax.tools.JavaFileObject; |
29 |
30 |
|
31 import com.sun.source.util.TreePath; |
30 import com.sun.tools.javac.code.Kinds; |
32 import com.sun.tools.javac.code.Kinds; |
31 import com.sun.tools.javac.code.Symbol.*; |
33 import com.sun.tools.javac.code.Symbol.*; |
32 import com.sun.tools.javac.comp.Enter; |
34 import com.sun.tools.javac.comp.Enter; |
33 import com.sun.tools.javac.tree.JCTree.*; |
35 import com.sun.tools.javac.tree.JCTree.*; |
34 import com.sun.tools.javac.tree.TreeInfo; |
|
35 import com.sun.tools.javac.util.Context; |
36 import com.sun.tools.javac.util.Context; |
36 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
37 import com.sun.tools.javac.util.List; |
38 import com.sun.tools.javac.util.List; |
38 |
39 |
39 /** |
40 /** |
83 |
84 |
84 @Override |
85 @Override |
85 public void visitTopLevel(JCCompilationUnit tree) { |
86 public void visitTopLevel(JCCompilationUnit tree) { |
86 super.visitTopLevel(tree); |
87 super.visitTopLevel(tree); |
87 if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) { |
88 if (tree.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE)) { |
88 String comment = TreeInfo.getCommentText(env, tree); |
89 docenv.makePackageDoc(tree.packge, docenv.getTreePath(tree)); |
89 docenv.makePackageDoc(tree.packge, comment, tree); |
|
90 } |
90 } |
91 } |
91 } |
92 |
92 |
93 @Override |
93 @Override |
94 public void visitClassDef(JCClassDecl tree) { |
94 public void visitClassDef(JCClassDecl tree) { |
95 super.visitClassDef(tree); |
95 super.visitClassDef(tree); |
96 if (tree.sym == null) return; |
96 if (tree.sym == null) return; |
97 if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) { |
97 if (tree.sym.kind == Kinds.TYP || tree.sym.kind == Kinds.ERR) { |
98 String comment = TreeInfo.getCommentText(env, tree); |
|
99 ClassSymbol c = tree.sym; |
98 ClassSymbol c = tree.sym; |
100 docenv.makeClassDoc(c, comment, tree, env.toplevel.lineMap); |
99 docenv.makeClassDoc(c, docenv.getTreePath(env.toplevel, tree)); |
101 } |
100 } |
102 } |
101 } |
103 |
102 |
104 /** Don't complain about a duplicate class. */ |
103 /** Don't complain about a duplicate class. */ |
105 @Override |
104 @Override |