8174974: Annotation type pages generated by javadoc is missing module information
authorbpatel
Mon, 13 Mar 2017 10:59:56 -0700
changeset 44196 f88c0e9cb102
parent 44195 5860769fe2f4
child 44197 380e1f22e460
8174974: Annotation type pages generated by javadoc is missing module information Reviewed-by: jjg, ksrini
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
langtools/test/jdk/javadoc/doclet/testModules/TestModules.java
langtools/test/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java	Mon Mar 13 10:59:56 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 
 import java.util.List;
 
+import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.PackageElement;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.type.TypeMirror;
@@ -191,10 +192,21 @@
         bodyTree.addContent(HtmlConstants.START_OF_CLASS_DATA);
         HtmlTree div = new HtmlTree(HtmlTag.DIV);
         div.addStyle(HtmlStyle.header);
+        if (configuration.showModules) {
+            ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(annotationType);
+            Content typeModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInType, contents.moduleLabel);
+            Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, typeModuleLabel);
+            moduleNameDiv.addContent(Contents.SPACE);
+            moduleNameDiv.addContent(getModuleLink(mdle, new StringContent(mdle.getQualifiedName())));
+            div.addContent(moduleNameDiv);
+        }
         PackageElement pkg = utils.containingPackage(annotationType);
         if (!pkg.isUnnamed()) {
-            Content pkgNameContent = new StringContent(utils.getPackageName(pkg));
-            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            Content typePackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInType, contents.packageLabel);
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, typePackageLabel);
+            pkgNameDiv.addContent(Contents.SPACE);
+            Content pkgNameContent = getPackageLink(pkg, new StringContent(utils.getPackageName(pkg)));
+            pkgNameDiv.addContent(pkgNameContent);
             div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java	Mon Mar 13 10:59:56 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -205,7 +205,7 @@
         div.addStyle(HtmlStyle.header);
         if (configuration.showModules) {
             ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(typeElement);
-            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
+            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInType, contents.moduleLabel);
             Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
             moduleNameDiv.addContent(Contents.SPACE);
             moduleNameDiv.addContent(getModuleLink(mdle,
@@ -214,7 +214,7 @@
         }
         PackageElement pkg = utils.containingPackage(typeElement);
         if (!pkg.isUnnamed()) {
-            Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInClass, contents.packageLabel);
+            Content classPackageLabel = HtmlTree.SPAN(HtmlStyle.packageLabelInType, contents.packageLabel);
             Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classPackageLabel);
             pkgNameDiv.addContent(Contents.SPACE);
             Content pkgNameContent = getPackageLink(pkg,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java	Mon Mar 13 10:59:56 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,7 +127,7 @@
         div.addStyle(HtmlStyle.header);
         if (configuration.showModules) {
             ModuleElement mdle = configuration.docEnv.getElementUtils().getModuleOf(packageElement);
-            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInClass, contents.moduleLabel);
+            Content classModuleLabel = HtmlTree.SPAN(HtmlStyle.moduleLabelInPackage, contents.moduleLabel);
             Content moduleNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, classModuleLabel);
             moduleNameDiv.addContent(Contents.SPACE);
             moduleNameDiv.addContent(getModuleLink(mdle,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlStyle.java	Mon Mar 13 10:59:56 2017 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,8 @@
     memberNameLabel,
     memberNameLink,
     memberSummary,
-    moduleLabelInClass,
+    moduleLabelInPackage,
+    moduleLabelInType,
     nameValue,
     navBarCell1Rev,
     navList,
@@ -87,7 +88,7 @@
     overrideSpecifyLabel,
     overviewSummary,
     packageHierarchyLabel,
-    packageLabelInClass,
+    packageLabelInType,
     packagesSummary,
     paramLabel,
     providesSummary,
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Mon Mar 13 10:59:56 2017 -0700
@@ -647,7 +647,7 @@
     color:#474747;
 }
 .deprecatedLabel, .descfrmTypeLabel, .implementationLabel, .memberNameLabel, .memberNameLink,
-.moduleLabelInClass, .overrideSpecifyLabel, .packageLabelInClass,
+.moduleLabelInPackage, .moduleLabelInType, .overrideSpecifyLabel, .packageLabelInType,
 .packageHierarchyLabel, .paramLabel, .returnLabel, .seeLabel, .simpleTagLabel,
 .throwsLabel, .typeNameLabel, .typeNameLink, .searchTagLink {
     font-weight:bold;
--- a/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testModules/TestModules.java	Mon Mar 13 10:59:56 2017 -0700
@@ -23,7 +23,8 @@
 
 /*
  * @test
- * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 8168766 8168688 8162674 8160196 8175799
+ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
+ *      8168766 8168688 8162674 8160196 8175799 8174974
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -187,11 +188,11 @@
     void testModuleFilesAndLinks() {
         javadoc("-d", "out-modulelinks",
                 "--module-source-path", testSrc,
-                "--module", "moduleA",
-                "testpkgmdlA");
+                "--module", "moduleA,moduleB",
+                "testpkgmdlA", "testpkgmdlB");
         checkExit(Exit.OK);
         checkModuleFilesAndLinks(true);
-        checkNegatedOverviewFrame();
+        checkOverviewFrame(true);
     }
 
     /**
@@ -631,12 +632,17 @@
     void checkModuleFilesAndLinks(boolean found) {
         checkFileAndOutput("testpkgmdlA/package-summary.html", found,
                 "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
-                "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
+                "<div class=\"subTitle\"><span class=\"moduleLabelInPackage\">Module</span>&nbsp;"
                 + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
         checkFileAndOutput("testpkgmdlA/TestClassInModuleA.html", found,
                 "<li><a href=\"../moduleA-summary.html\">Module</a></li>",
-                "<div class=\"subTitle\"><span class=\"moduleLabelInClass\">Module</span>&nbsp;"
+                "<div class=\"subTitle\"><span class=\"moduleLabelInType\">Module</span>&nbsp;"
                 + "<a href=\"../moduleA-summary.html\">moduleA</a></div>");
+        checkFileAndOutput("testpkgmdlB/AnnotationType.html", found,
+                "<div class=\"subTitle\"><span class=\"moduleLabelInType\">Module</span>&nbsp;"
+                + "<a href=\"../moduleB-summary.html\">moduleB</a></div>",
+                "<div class=\"subTitle\"><span class=\"packageLabelInType\">"
+                + "Package</span>&nbsp;<a href=\"../testpkgmdlB/package-summary.html\">testpkgmdlB</a></div>");
         checkFiles(found,
                 "moduleA-frame.html",
                 "moduleA-summary.html",
@@ -663,7 +669,7 @@
                 + "search_word</a></span> - Search tag in moduleB</dt>\n"
                 + "<dd>&nbsp;</dd>\n"
                 + "</dl>");
-}
+    }
 
     void checkModuleModeCommon() {
         checkOutput("overview-summary.html", true,
@@ -857,19 +863,12 @@
                 + "</p>");
         checkOutput("moduleB-summary.html", false,
                 "@AnnotationTypeUndocumented");
-}
+    }
 
     void checkOverviewFrame(boolean found) {
         checkOutput("index.html", !found,
                 "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" title=\"All Packages\"></iframe>");
         checkOutput("index.html", found,
                 "<iframe src=\"module-overview-frame.html\" name=\"packageListFrame\" title=\"All Modules\"></iframe>");
-}
-
-    void checkNegatedOverviewFrame() {
-        checkOutput("index.html", false,
-                "<iframe src=\"overview-frame.html\" name=\"packageListFrame\" title=\"All Packages\"></iframe>");
-        checkOutput("index.html", false,
-                "<iframe src=\"module-overview-frame.html\" name=\"packageListFrame\" title=\"All Modules\"></iframe>");
     }
 }
--- a/langtools/test/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java	Mon Mar 13 09:55:31 2017 -0700
+++ b/langtools/test/jdk/javadoc/doclet/testSubTitle/TestSubTitle.java	Mon Mar 13 10:59:56 2017 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7010342 8150000
+ * @bug 7010342 8150000 8174974
  * @summary Test for correct sub title generation.
  * @author Bhavesh Patel
  * @library ../lib
@@ -50,7 +50,7 @@
             "<div class=\"block\">This is the description of package pkg.</div>");
 
         checkOutput("pkg/C.html", true,
-                "<div class=\"subTitle\"><span class=\"packageLabelInClass\">" +
+                "<div class=\"subTitle\"><span class=\"packageLabelInType\">" +
                 "Package</span>&nbsp;<a href=\"../pkg/package-summary.html\">pkg</a></div>");
 
         checkOutput("pkg/package-summary.html", false,