RFR [9]: Consistent order of 'Annotation Type Hierarchy' & 'Enum Hierarchy’ sections.

Chris Hegarty chris.hegarty at oracle.com
Fri Jul 18 17:16:12 UTC 2014


This is a small code review request for an issue I encountered when trying to compare the result of the output of a docs build from two JDK repos. I’ll file a bug on it soon.

The issue is that the 'Annotation Type Hierarchy' & 'Enum Hierarchy’ sections of ‘Use' and ‘Tree’ view for a package are not always in the same order ( the issue may appear in other views too, but these are the only ones I observed). The implementation uses a List, whose elements may be added in a different order, depending on encounter order. These elements should be ordered, as others are. It just appears to be an oversight in the original implementation.

diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
@@ -155,12 +155,21 @@
         }
 
         Collections.sort(baseinterfaces);
+        Collections.sort(baseAnnotationTypes);
+        Collections.sort(baseEnums);
         for (List<ClassDoc> docs : subinterfaces.values()) {
             Collections.sort(docs);
         }
         for (List<ClassDoc> docs : subclasses.values()) {
             Collections.sort(docs);
         }
+        for (List<ClassDoc> docs : subAnnotationTypes.values()) {
+            Collections.sort(docs);
+        }
+        for (List<ClassDoc> docs : subEnums.values()) {
+            Collections.sort(docs);
+        }
+
     }
 
-Chris.



More information about the javadoc-dev mailing list