28
28
import java .util .ArrayList ;
29
29
import java .util .List ;
30
30
import java .util .Set ;
31
+ import java .util .TreeSet ;
31
32
32
33
import javax .lang .model .element .TypeElement ;
33
34
39
40
import jdk .javadoc .internal .doclets .formats .html .Navigation .PageMode ;
40
41
import jdk .javadoc .internal .doclets .toolkit .util .DocFileIOException ;
41
42
import jdk .javadoc .internal .doclets .toolkit .util .DocPaths ;
42
- import jdk .javadoc .internal .doclets .toolkit .util .IndexBuilder ;
43
- import jdk .javadoc .internal .doclets .toolkit .util .IndexItem ;
44
43
import jdk .javadoc .internal .doclets .toolkit .util .Utils .ElementFlag ;
45
44
46
45
/**
47
46
* Generate the file with list of all the classes in this run.
48
47
*/
49
48
public class AllClassesIndexWriter extends HtmlDocletWriter {
50
49
51
- /**
52
- * Index of all the classes.
53
- */
54
- protected IndexBuilder indexBuilder ;
55
-
56
50
/**
57
51
* Construct AllClassesIndexWriter object. Also initializes the indexBuilder variable in this
58
52
* class.
59
53
*
60
54
* @param configuration The current configuration
61
- * @param indexBuilder Unicode based Index from {@link IndexBuilder}
62
55
*/
63
- public AllClassesIndexWriter (HtmlConfiguration configuration , IndexBuilder indexBuilder ) {
56
+ public AllClassesIndexWriter (HtmlConfiguration configuration ) {
64
57
super (configuration , DocPaths .ALLCLASSES_INDEX );
65
- this .indexBuilder = indexBuilder ;
66
58
}
67
59
68
60
@ Override
69
61
public void buildPage () throws DocFileIOException {
62
+ messages .notice ("doclet.Building_Index_For_All_Classes" );
70
63
String label = resources .getText ("doclet.All_Classes_And_Interfaces" );
71
64
Content allClassesContent = new ContentBuilder ();
72
65
addContents (allClassesContent );
@@ -97,13 +90,9 @@ protected void addContents(Content target) {
97
90
.addTab (contents .records , utils ::isRecord )
98
91
.addTab (contents .exceptionClasses , utils ::isThrowable )
99
92
.addTab (contents .annotationTypes , utils ::isAnnotationInterface );
100
- for (Character unicode : indexBuilder .getFirstCharacters ()) {
101
- for (IndexItem indexItem : indexBuilder .getItems (unicode )) {
102
- TypeElement typeElement = (TypeElement ) indexItem .getElement ();
103
- if (typeElement != null && utils .isCoreClass (typeElement )) {
104
- addTableRow (table , typeElement );
105
- }
106
- }
93
+ Set <TypeElement > typeElements = getTypeElements ();
94
+ for (TypeElement typeElement : typeElements ) {
95
+ addTableRow (table , typeElement );
107
96
}
108
97
Content titleContent = contents .allClassesAndInterfacesLabel ;
109
98
var pHeading = HtmlTree .HEADING_TITLE (Headings .PAGE_TITLE_HEADING ,
@@ -115,6 +104,24 @@ protected void addContents(Content target) {
115
104
}
116
105
}
117
106
107
+ private Set <TypeElement > getTypeElements () {
108
+ Set <TypeElement > classes = new TreeSet <>(utils .comparators .allClassesComparator ());
109
+ boolean noDeprecated = options .noDeprecated ();
110
+ Set <TypeElement > includedTypes = configuration .getIncludedTypeElements ();
111
+ for (TypeElement typeElement : includedTypes ) {
112
+ if (utils .hasHiddenTag (typeElement ) || !utils .isCoreClass (typeElement )) {
113
+ continue ;
114
+ }
115
+ if (noDeprecated
116
+ && (utils .isDeprecated (typeElement )
117
+ || utils .isDeprecated (utils .containingPackage (typeElement )))) {
118
+ continue ;
119
+ }
120
+ classes .add (typeElement );
121
+ }
122
+ return classes ;
123
+ }
124
+
118
125
/**
119
126
* Add table row.
120
127
*
0 commit comments