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

changeset 1280
5c0b3faeb0b0
parent 1051
b0909f992710
child 1359
25e14ad23cef
equal deleted inserted replaced
1279:34e254ffd0e7 1280:5c0b3faeb0b0
1 /* 1 /*
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this 7 * published by the Free Software Foundation. Oracle designates this
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.tools.javac.util.Context;
29 import com.sun.tools.javac.util.Position;
30 import com.sun.tools.javac.code.Flags; 28 import com.sun.tools.javac.code.Flags;
31 import com.sun.tools.javac.code.Kinds; 29 import com.sun.tools.javac.code.Kinds;
32 import com.sun.tools.javac.code.Symbol.*; 30 import com.sun.tools.javac.code.Symbol.*;
33 import com.sun.tools.javac.comp.MemberEnter; 31 import com.sun.tools.javac.comp.MemberEnter;
34 import com.sun.tools.javac.tree.JCTree.*; 32 import com.sun.tools.javac.tree.JCTree.*;
33 import com.sun.tools.javac.tree.TreeInfo;
34 import com.sun.tools.javac.util.Context;
35 import com.sun.tools.javac.util.Position;
35 36
36 /** 37 /**
37 * Javadoc's own memberEnter phase does a few things above and beyond that 38 * Javadoc's own memberEnter phase does a few things above and beyond that
38 * done by javac. 39 * done by javac.
39 * @author Neal Gafter 40 * @author Neal Gafter
59 protected JavadocMemberEnter(Context context) { 60 protected JavadocMemberEnter(Context context) {
60 super(context); 61 super(context);
61 docenv = DocEnv.instance(context); 62 docenv = DocEnv.instance(context);
62 } 63 }
63 64
65 @Override
64 public void visitMethodDef(JCMethodDecl tree) { 66 public void visitMethodDef(JCMethodDecl tree) {
65 super.visitMethodDef(tree); 67 super.visitMethodDef(tree);
66 MethodSymbol meth = tree.sym; 68 MethodSymbol meth = tree.sym;
67 if (meth == null || meth.kind != Kinds.MTH) return; 69 if (meth == null || meth.kind != Kinds.MTH) return;
68 String docComment = env.toplevel.docComments.get(tree); 70 String docComment = TreeInfo.getCommentText(env, tree);
69 Position.LineMap lineMap = env.toplevel.lineMap; 71 Position.LineMap lineMap = env.toplevel.lineMap;
70 if (meth.isConstructor()) 72 if (meth.isConstructor())
71 docenv.makeConstructorDoc(meth, docComment, tree, lineMap); 73 docenv.makeConstructorDoc(meth, docComment, tree, lineMap);
72 else if (isAnnotationTypeElement(meth)) 74 else if (isAnnotationTypeElement(meth))
73 docenv.makeAnnotationTypeElementDoc(meth, docComment, tree, lineMap); 75 docenv.makeAnnotationTypeElementDoc(meth, docComment, tree, lineMap);
74 else 76 else
75 docenv.makeMethodDoc(meth, docComment, tree, lineMap); 77 docenv.makeMethodDoc(meth, docComment, tree, lineMap);
76 } 78 }
77 79
80 @Override
78 public void visitVarDef(JCVariableDecl tree) { 81 public void visitVarDef(JCVariableDecl tree) {
79 super.visitVarDef(tree); 82 super.visitVarDef(tree);
80 if (tree.sym != null && 83 if (tree.sym != null &&
81 tree.sym.kind == Kinds.VAR && 84 tree.sym.kind == Kinds.VAR &&
82 !isParameter(tree.sym)) { 85 !isParameter(tree.sym)) {
83 String docComment = env.toplevel.docComments.get(tree); 86 String docComment = TreeInfo.getCommentText(env, tree);
84 Position.LineMap lineMap = env.toplevel.lineMap; 87 Position.LineMap lineMap = env.toplevel.lineMap;
85 docenv.makeFieldDoc(tree.sym, docComment, tree, lineMap); 88 docenv.makeFieldDoc(tree.sym, docComment, tree, lineMap);
86 } 89 }
87 } 90 }
88 91

mercurial