Source: openjdk-7
Version: 7u79-2.5.5-1
Severity: wishlist
Tags: patch
User: reproducible-builds@lists.alioth.debian.org
Usertags: toolchain randomness

The package-tree.html files generated by the javadoc tool display class
trees for interfaces, classes, annotations and enums. The interfaces and
classes trees are sorted alphabetically, but not the annotation and the
enum trees. This can be seen on the API documentation for the java.lang
package [1].

The actual order used is not deterministic and varies with the build
environment, this prevents several packages from being reproducible (for
example easymock [2] and mockito [3]).

This issue is caused by the buildTree method in the
com.sun.tools.doclets.internal.toolkit.util.ClassTree class [4], it
sorts the interfaces and the classes but forgets the other types. I'm
attaching a patch fixing this issue.

Emmanuel Bourg

[1] http://docs.oracle.com/javase/7/docs/api/java/lang/package-tree.html
[2] https://reproducible.debian.net/rb-pkg/unstable/amd64/easymock.html
[3] https://reproducible.debian.net/rb-pkg/unstable/amd64/mockito.html
[4]
http://hg.openjdk.java.net/jdk7u/jdk7u/langtools/file/jdk7u80-b32/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java#l114
Description: Sort the enums and the annotations in the package-tree.html files
Author: Emmanuel Bourg <ebo...@apache.org>
Forwarded: no
--- 
openjdk/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
+++ 
openjdk/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
@@ -163,6 +163,15 @@
         for (Iterator<List<ClassDoc>> it = subclasses.values().iterator(); 
it.hasNext(); ) {
             Collections.sort(it.next());
         }
+
+        Collections.sort(baseEnums);
+        for (Iterator<List<ClassDoc>> it = subEnums.values().iterator(); 
it.hasNext(); ) {
+            Collections.sort(it.next());
+        }
+        Collections.sort(baseAnnotationTypes);
+        for (Iterator<List<ClassDoc>> it = 
subAnnotationTypes.values().iterator(); it.hasNext(); ) {
+            Collections.sort(it.next());
+        }
     }

     /**
_______________________________________________
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Reply via email to