langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
changeset 22159 682da512ec17
parent 16319 e586bfeb39c5
child 22163 3651128c74eb
equal deleted inserted replaced
22158:dca1b80ed62c 22159:682da512ec17
   121      *
   121      *
   122      * @param classes all the classes in this run.
   122      * @param classes all the classes in this run.
   123      * @param configuration the current configuration of the doclet.
   123      * @param configuration the current configuration of the doclet.
   124      */
   124      */
   125     private void buildTree(ClassDoc[] classes, Configuration configuration) {
   125     private void buildTree(ClassDoc[] classes, Configuration configuration) {
   126         for (int i = 0; i < classes.length; i++) {
   126         for (ClassDoc aClass : classes) {
   127             // In the tree page (e.g overview-tree.html) do not include
   127             // In the tree page (e.g overview-tree.html) do not include
   128             // information of classes which are deprecated or are a part of a
   128             // information of classes which are deprecated or are a part of a
   129             // deprecated package.
   129             // deprecated package.
   130             if (configuration.nodeprecated &&
   130             if (configuration.nodeprecated &&
   131                     (Util.isDeprecated(classes[i]) ||
   131                     (Util.isDeprecated(aClass) ||
   132                     Util.isDeprecated(classes[i].containingPackage()))) {
   132                     Util.isDeprecated(aClass.containingPackage()))) {
   133                 continue;
   133                 continue;
   134             }
   134             }
   135 
   135 
   136             if (configuration.javafx
   136             if (configuration.javafx
   137                     && classes[i].tags("treatAsPrivate").length > 0) {
   137                     && aClass.tags("treatAsPrivate").length > 0) {
   138                 continue;
   138                 continue;
   139             }
   139             }
   140 
   140 
   141             if (classes[i].isEnum()) {
   141             if (aClass.isEnum()) {
   142                 processType(classes[i], configuration, baseEnums, subEnums);
   142                 processType(aClass, configuration, baseEnums, subEnums);
   143             } else if (classes[i].isClass()) {
   143             } else if (aClass.isClass()) {
   144                 processType(classes[i], configuration, baseclasses, subclasses);
   144                 processType(aClass, configuration, baseclasses, subclasses);
   145             } else if (classes[i].isInterface()) {
   145             } else if (aClass.isInterface()) {
   146                 processInterface(classes[i]);
   146                 processInterface(aClass);
   147                 List<ClassDoc> list = implementingclasses.get(classes[i]);
   147                 List<ClassDoc> list = implementingclasses.get(aClass);
   148                 if (list != null) {
   148                 if (list != null) {
   149                     Collections.sort(list);
   149                     Collections.sort(list);
   150                 }
   150                 }
   151             } else if (classes[i].isAnnotationType()) {
   151             } else if (aClass.isAnnotationType()) {
   152                 processType(classes[i], configuration, baseAnnotationTypes,
   152                 processType(aClass, configuration, baseAnnotationTypes,
   153                     subAnnotationTypes);
   153                     subAnnotationTypes);
   154             }
   154             }
   155         }
   155         }
   156 
   156 
   157         Collections.sort(baseinterfaces);
   157         Collections.sort(baseinterfaces);
   158         for (Iterator<List<ClassDoc>> it = subinterfaces.values().iterator(); it.hasNext(); ) {
   158         for (List<ClassDoc> docs : subinterfaces.values()) {
   159             Collections.sort(it.next());
   159             Collections.sort(docs);
   160         }
   160         }
   161         for (Iterator<List<ClassDoc>> it = subclasses.values().iterator(); it.hasNext(); ) {
   161         for (List<ClassDoc> docs : subclasses.values()) {
   162             Collections.sort(it.next());
   162             Collections.sort(docs);
   163         }
   163         }
   164     }
   164     }
   165 
   165 
   166     /**
   166     /**
   167      * For the class passed map it to it's own sub-class listing.
   167      * For the class passed map it to it's own sub-class listing.
   188             if (!bases.contains(cd)) {
   188             if (!bases.contains(cd)) {
   189                 bases.add(cd);
   189                 bases.add(cd);
   190             }
   190             }
   191         }
   191         }
   192         List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
   192         List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
   193         for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext();) {
   193         for (Type intfac : intfacs) {
   194             add(implementingclasses, iter.next().asClassDoc(), cd);
   194             add(implementingclasses, intfac.asClassDoc(), cd);
   195         }
   195         }
   196     }
   196     }
   197 
   197 
   198     /**
   198     /**
   199      * For the interface passed get the interfaces which it extends, and then
   199      * For the interface passed get the interfaces which it extends, and then
   204      * @param cd Interface under consideration.
   204      * @param cd Interface under consideration.
   205      */
   205      */
   206     private void processInterface(ClassDoc cd) {
   206     private void processInterface(ClassDoc cd) {
   207         ClassDoc[] intfacs = cd.interfaces();
   207         ClassDoc[] intfacs = cd.interfaces();
   208         if (intfacs.length > 0) {
   208         if (intfacs.length > 0) {
   209             for (int i = 0; i < intfacs.length; i++) {
   209             for (ClassDoc intfac : intfacs) {
   210                 if (!add(subinterfaces, intfacs[i], cd)) {
   210                 if (!add(subinterfaces, intfac, cd)) {
   211                     return;
   211                     return;
   212                 } else {
   212                 } else {
   213                     processInterface(intfacs[i]);   // Recurse
   213                     processInterface(intfac);   // Recurse
   214                 }
   214                 }
   215             }
   215             }
   216         } else {
   216         } else {
   217             // we need to add all the interfaces who do not have
   217             // we need to add all the interfaces who do not have
   218             // super-interfaces to baseinterfaces list to traverse them
   218             // super-interfaces to baseinterfaces list to traverse them
   339     public List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum) {
   339     public List<ClassDoc> allSubs(ClassDoc cd, boolean isEnum) {
   340         List<ClassDoc> list = subs(cd, isEnum);
   340         List<ClassDoc> list = subs(cd, isEnum);
   341         for (int i = 0; i < list.size(); i++) {
   341         for (int i = 0; i < list.size(); i++) {
   342             cd = list.get(i);
   342             cd = list.get(i);
   343             List<ClassDoc> tlist = subs(cd, isEnum);
   343             List<ClassDoc> tlist = subs(cd, isEnum);
   344             for (int j = 0; j < tlist.size(); j++) {
   344             for (ClassDoc tcd : tlist) {
   345                 ClassDoc tcd = tlist.get(j);
       
   346                 if (!list.contains(tcd)) {
   345                 if (!list.contains(tcd)) {
   347                     list.add(tcd);
   346                     list.add(tcd);
   348                 }
   347                 }
   349             }
   348             }
   350         }
   349         }