8210244: {@value} should be permitted in module documentation
authorpmuthuswamy
Wed, 31 Oct 2018 10:29:59 +0530
changeset 52339 cda2f582500e
parent 52338 ac4ea1fe09b9
child 52340 adb107c71a12
8210244: {@value} should be permitted in module documentation Reviewed-by: jjg, sundar
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java
test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out
test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTagInModule.java
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java	Tue Oct 30 20:44:48 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/ValueTaglet.java	Wed Oct 31 10:29:59 2018 +0530
@@ -61,9 +61,7 @@
      * Construct a new ValueTaglet.
      */
     public ValueTaglet() {
-        super(VALUE.tagName, true,
-                EnumSet.of(Site.OVERVIEW, Site.PACKAGE, Site.TYPE, Site.CONSTRUCTOR,
-                    Site.METHOD, Site.FIELD)); // not Site.MODULE at this time!
+        super(VALUE.tagName, true, EnumSet.allOf(Site.class));
     }
 
     /**
--- a/test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out	Tue Oct 30 20:44:48 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testTaglets/TestTaglets.out	Wed Oct 31 10:29:59 2018 +0530
@@ -26,5 +26,5 @@
              @throws: ........ ...... ....... .... constructor method ..... ...... ........
      @treatAsPrivate: ........ ...... ....... type ........... method field ...... ........
                @uses: ........ module ....... .... ........... ...... ..... ...... ........
-            {@value}: overview ...... package type constructor method field inline ........
+            {@value}: overview module package type constructor method field inline ........
             @version: overview module package type ........... ...... ..... ...... disabled
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testValueTag/TestValueTagInModule.java	Wed Oct 31 10:29:59 2018 +0530
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8210244
+ * @summary {@value} should be permitted in module documentation
+ * @library /tools/lib ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestValueTagInModule
+ */
+
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+public class TestValueTagInModule extends JavadocTester {
+
+    final ToolBox tb;
+
+    public static void main(String... args) throws Exception {
+        TestValueTagInModule tester = new TestValueTagInModule();
+        tester.runTests(m -> new Object[]{Paths.get(m.getName())});
+    }
+
+    TestValueTagInModule() {
+        tb = new ToolBox();
+    }
+
+    @Test
+    void test(Path base) throws Exception {
+        Path srcDir = base.resolve("src");
+        createTestClass(srcDir);
+
+        Path outDir = base.resolve("out");
+        javadoc("-d", outDir.toString(),
+                "--module-source-path", srcDir.toString(),
+                "--module", "m1");
+
+        checkExit(Exit.OK);
+
+        checkOutput("m1/module-summary.html", true,
+                "<a id=\"module.description\">\n"
+                + "<!--   -->\n"
+                + "</a>\n"
+                + "<div class=\"block\">value of field CONS : <a href=\"pkg/A.html#CONS\">100</a></div>");
+    }
+
+    void createTestClass(Path srcDir) throws Exception {
+        new ModuleBuilder(tb, "m1")
+                .comment("value of field CONS : {@value pkg.A#CONS}")
+                .exports("pkg")
+                .classes("package pkg; public class A{ public static final int CONS = 100;}")
+                .write(srcDir);
+    }
+}