27 |
27 |
28 import java.lang.reflect.Modifier; |
28 import java.lang.reflect.Modifier; |
29 import java.text.CollationKey; |
29 import java.text.CollationKey; |
30 |
30 |
31 import com.sun.javadoc.*; |
31 import com.sun.javadoc.*; |
|
32 import com.sun.source.util.TreePath; |
32 import com.sun.tools.javac.code.Attribute; |
33 import com.sun.tools.javac.code.Attribute; |
33 import com.sun.tools.javac.code.Symbol; |
34 import com.sun.tools.javac.code.Symbol; |
34 import com.sun.tools.javac.code.Symbol.ClassSymbol; |
35 import com.sun.tools.javac.code.Symbol.ClassSymbol; |
35 import com.sun.tools.javac.tree.JCTree; |
36 import com.sun.tools.javac.tree.JCTree; |
|
37 import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; |
36 import com.sun.tools.javac.util.Position; |
38 import com.sun.tools.javac.util.Position; |
37 |
39 |
38 /** |
40 /** |
39 * Represents a java program element: class, interface, field, |
41 * Represents a java program element: class, interface, field, |
40 * constructor, or method. |
42 * constructor, or method. |
64 |
66 |
65 |
67 |
66 // Cache for getModifiers(). |
68 // Cache for getModifiers(). |
67 private int modifiers = -1; |
69 private int modifiers = -1; |
68 |
70 |
69 protected ProgramElementDocImpl(DocEnv env, Symbol sym, |
71 protected ProgramElementDocImpl(DocEnv env, Symbol sym, TreePath treePath) { |
70 String doc, JCTree tree, Position.LineMap lineMap) { |
72 super(env, treePath); |
71 super(env, doc); |
|
72 this.sym = sym; |
73 this.sym = sym; |
73 this.tree = tree; |
74 if (treePath != null) { |
74 this.lineMap = lineMap; |
75 tree = (JCTree) treePath.getLeaf(); |
75 } |
76 lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap; |
76 |
77 } |
77 void setTree(JCTree tree) { |
78 } |
78 this.tree = tree; |
79 |
|
80 @Override |
|
81 void setTreePath(TreePath treePath) { |
|
82 super.setTreePath(treePath); |
|
83 this.tree = (JCTree) treePath.getLeaf(); |
|
84 this.lineMap = ((JCCompilationUnit) treePath.getCompilationUnit()).lineMap; |
79 } |
85 } |
80 |
86 |
81 /** |
87 /** |
82 * Subclasses override to identify the containing class |
88 * Subclasses override to identify the containing class |
83 */ |
89 */ |