author | jjg |
Mon, 09 May 2016 16:52:15 -0700 | |
changeset 37938 | 42baa89d2156 |
parent 27224 | langtools/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/AnnotationTypeDocImpl.java@228abfa87080 |
child 38617 | d93a7f64e231 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
25443
9187d77f2c64
8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents:
17578
diff
changeset
|
2 |
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
37938
42baa89d2156
8075703: jdk.javadoc module exports com.sun.tools.javadoc package which contains a lot of internal API.
jjg
parents:
27224
diff
changeset
|
26 |
package com.sun.tools.javadoc.main; |
10 | 27 |
|
28 |
import com.sun.javadoc.*; |
|
29 |
||
14802 | 30 |
import com.sun.source.util.TreePath; |
25443
9187d77f2c64
8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents:
17578
diff
changeset
|
31 |
import com.sun.tools.javac.code.Symbol; |
10 | 32 |
import com.sun.tools.javac.code.Symbol.*; |
33 |
import com.sun.tools.javac.util.List; |
|
34 |
||
25443
9187d77f2c64
8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents:
17578
diff
changeset
|
35 |
import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE; |
9187d77f2c64
8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents:
17578
diff
changeset
|
36 |
|
27224
228abfa87080
8054457: Refactor Symbol kinds from small ints to an enum
emc
parents:
25874
diff
changeset
|
37 |
import static com.sun.tools.javac.code.Kinds.Kind.*; |
228abfa87080
8054457: Refactor Symbol kinds from small ints to an enum
emc
parents:
25874
diff
changeset
|
38 |
|
10 | 39 |
/** |
40 |
* Represents an annotation type. |
|
41 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
42 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
43 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
44 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
45 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
46 |
* |
10 | 47 |
* @author Scott Seligman |
48 |
* @since 1.5 |
|
49 |
*/ |
|
50 |
||
51 |
public class AnnotationTypeDocImpl |
|
52 |
extends ClassDocImpl implements AnnotationTypeDoc { |
|
53 |
||
10189
57268b86d4da
7059905: (javadoc) promote method visibility for netbeans usage
ksrini
parents:
5520
diff
changeset
|
54 |
public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym) { |
14802 | 55 |
this(env, sym, null); |
10 | 56 |
} |
57 |
||
14802 | 58 |
public AnnotationTypeDocImpl(DocEnv env, ClassSymbol sym, TreePath treePath) { |
59 |
super(env, sym, treePath); |
|
10 | 60 |
} |
61 |
||
62 |
/** |
|
63 |
* Returns true, as this is an annotation type. |
|
64 |
* (For legacy doclets, return false.) |
|
65 |
*/ |
|
66 |
public boolean isAnnotationType() { |
|
67 |
return !isInterface(); |
|
68 |
} |
|
69 |
||
70 |
/** |
|
71 |
* Returns false. Though technically an interface, an annotation |
|
72 |
* type is not considered an interface for this purpose. |
|
73 |
* (For legacy doclets, returns true.) |
|
74 |
*/ |
|
75 |
public boolean isInterface() { |
|
76 |
return env.legacyDoclet; |
|
77 |
} |
|
78 |
||
79 |
/** |
|
80 |
* Returns an empty array, as all methods are annotation type elements. |
|
81 |
* (For legacy doclets, returns the elements.) |
|
82 |
* @see #elements() |
|
83 |
*/ |
|
84 |
public MethodDoc[] methods(boolean filter) { |
|
85 |
return env.legacyDoclet |
|
86 |
? (MethodDoc[])elements() |
|
87 |
: new MethodDoc[0]; |
|
88 |
} |
|
89 |
||
90 |
/** |
|
91 |
* Returns the elements of this annotation type. |
|
92 |
* Returns an empty array if there are none. |
|
93 |
* Elements are always public, so no need to filter them. |
|
94 |
*/ |
|
95 |
public AnnotationTypeElementDoc[] elements() { |
|
96 |
List<AnnotationTypeElementDoc> elements = List.nil(); |
|
25443
9187d77f2c64
8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents:
17578
diff
changeset
|
97 |
for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) { |
27224
228abfa87080
8054457: Refactor Symbol kinds from small ints to an enum
emc
parents:
25874
diff
changeset
|
98 |
if (sym != null && sym.kind == MTH) { |
25443
9187d77f2c64
8031569: Refactor javac scope implementation to enable lazy imports
jlahoda
parents:
17578
diff
changeset
|
99 |
MethodSymbol s = (MethodSymbol)sym; |
10 | 100 |
elements = elements.prepend(env.getAnnotationTypeElementDoc(s)); |
101 |
} |
|
102 |
} |
|
103 |
return |
|
104 |
elements.toArray(new AnnotationTypeElementDoc[elements.length()]); |
|
105 |
} |
|
106 |
} |