8164747: allclasses-frame broken after JDK-8162353
authorjjg
Wed, 24 Aug 2016 15:40:35 -0700
changeset 40592 83e85c302cfc
parent 40591 8843f886a89f
child 40593 d2edf0695b7e
8164747: allclasses-frame broken after JDK-8162353 Reviewed-by: bpatel
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java
langtools/test/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Wed Aug 24 12:23:10 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java	Wed Aug 24 15:40:35 2016 -0700
@@ -105,7 +105,6 @@
         allclassgen.buildAllClassesFile(wantFrames);
         allclassgen = new AllClassesFrameWriter(configuration,
                                                 fileName, indexBuilder);
-        allclassgen.buildAllClassesFile(false);
     }
 
     /**
--- a/langtools/test/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java	Wed Aug 24 12:23:10 2016 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java	Wed Aug 24 15:40:35 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8162353
+ * @bug 8162353 8164747
  * @summary javadoc should provide a way to disable use of frames
  * @library /tools/lib ../lib
  * @modules
@@ -283,6 +283,19 @@
             // this file is only generated when not in frames mode
             checkFiles(!frames,
                     "allclasses.html");
+
+            if (frames) {
+                checkOutput("allclasses-frame.html", true,
+                        classes.stream()
+                            .map(c -> "title=\"class in " + packagePart(c) + "\" target=\"classFrame\">" + classPart(c) + "</a>")
+                            .toArray(String[]::new));
+                checkOutput("allclasses-noframe.html", false,
+                            "target=\"classFrame\">");
+            } else {
+                checkOutput("allclasses.html", false,
+                            "target=\"classFrame\">");
+
+            }
         }
 
         private void checkFrameFiles() {
@@ -367,6 +380,11 @@
                 .count();
         }
 
+        private String classPart(String className) {
+            int lastDot = className.lastIndexOf(".");
+            return className.substring(lastDot + 1);
+        }
+
         private String packagePart(String className) {
             int slash = className.indexOf("/");
             int lastDot = className.lastIndexOf(".");