diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java index 59bc029ba79..520921524f7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java @@ -29,6 +29,9 @@ import java.util.List; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.ModuleElement; +import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.TypeMirror; @@ -107,14 +110,14 @@ public class TagletWriterImpl extends TagletWriter { CommentHelper ch = utils.getCommentHelper(element); IndexTree itt = (IndexTree)tag; - String tagText = ch.getText(itt.getSearchTerm()); + String tagText = ch.getText(itt.getSearchTerm()); if (tagText.charAt(0) == '"' && tagText.charAt(tagText.length() - 1) == '"') { tagText = tagText.substring(1, tagText.length() - 1) .replaceAll("\\s+", " "); } String desc = ch.getText(itt.getDescription()); - return createAnchorAndSearchIndex(element, tagText,desc); + return createAnchorAndSearchIndex(element, tagText, desc); } /** @@ -413,14 +416,14 @@ public class TagletWriterImpl extends TagletWriter { } @SuppressWarnings("preview") - private Content createAnchorAndSearchIndex(Element element, String tagText, String desc){ + private Content createAnchorAndSearchIndex(Element element, String tagText, String desc) { Content result = null; if (isFirstSentence && inSummary) { result = new StringContent(tagText); } else { String anchorName = htmlWriter.links.getName(tagText); - int count = htmlWriter.indexAnchorTable.computeIfAbsent(anchorName, s -> 0); - htmlWriter.indexAnchorTable.put(anchorName, count + 1); + int count = htmlWriter.indexAnchorTable + .compute(anchorName, (k, v) -> v == null ? 0 : v + 1); if (count > 0) { anchorName += "-" + count; } @@ -430,12 +433,40 @@ public class TagletWriterImpl extends TagletWriter { si.setLabel(tagText); si.setDescription(desc); si.setUrl(htmlWriter.path.getPath() + "#" + anchorName); - DocPaths docPaths = configuration.docPaths; new SimpleElementVisitor14() { + + @Override + public Void visitModule(ModuleElement e, Void p) { + si.setHolder(resources.getText("doclet.module") + + " " + utils.getFullyQualifiedName(e)); + return null; + } + + @Override + public Void visitPackage(PackageElement e, Void p) { + si.setHolder(resources.getText("doclet.package") + + " " + utils.getFullyQualifiedName(e)); + return null; + } + + @Override + public Void visitType(TypeElement e, Void p) { + si.setHolder(utils.getTypeElementName(e, true) + + " " + utils.getFullyQualifiedName(e)); + return null; + } + + @Override + public Void visitExecutable(ExecutableElement e, Void p) { + si.setHolder(utils.getFullyQualifiedName(utils.getEnclosingTypeElement(e)) + + "." + utils.getSimpleName(e) + utils.flatSignature(e)); + return null; + } + @Override public Void visitVariable(VariableElement e, Void p) { TypeElement te = utils.getEnclosingTypeElement(e); - si.setHolder(utils.getFullyQualifiedName(e) + "." + utils.getSimpleName(e)); + si.setHolder(utils.getFullyQualifiedName(te) + "." + utils.getSimpleName(e)); return null; } diff --git a/test/langtools/jdk/javadoc/doclet/testIndex/TestIndex.java b/test/langtools/jdk/javadoc/doclet/testIndex/TestIndex.java index b633f0c6286..463b654a160 100644 --- a/test/langtools/jdk/javadoc/doclet/testIndex/TestIndex.java +++ b/test/langtools/jdk/javadoc/doclet/testIndex/TestIndex.java @@ -23,7 +23,7 @@ /* * @test - * @bug 4852280 4517115 4973608 4994589 8026567 8071982 8196202 + * @bug 4852280 4517115 4973608 4994589 8026567 8071982 8196202 8234746 * @summary Perform tests on index.html file. * Also test that index-all.html has the appropriate output. * Test for unnamed package in index. @@ -74,6 +74,6 @@ public class TestIndex extends JavadocTester { + "
 
\n" + "", "
Enum" - + " - Search tag in pkg.Coin
"); + + " - Search tag in enum pkg.Coin"); } } diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java index 4d6f55e2b46..8b82e5bc371 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java @@ -26,8 +26,8 @@ * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363 * 8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218 * 8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464 - 8164407 8192007 8182765 8196200 8196201 8196202 8196202 8205593 8202462 - 8184205 8219060 8223378 + * 8164407 8192007 8182765 8196200 8196201 8196202 8196202 8205593 8202462 + * 8184205 8219060 8223378 8234746 * @summary Test modules support in javadoc. * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -901,18 +901,18 @@ public class TestModules extends JavadocTester { + "", "
\n" + "
" - + "search_word - Search tag in moduleB
\n" + + "search_word - Search tag in module moduleB\n" + "
 
\n" + "
" - + "search phrase - Search tag in moduleA
\n" + + "search phrase - Search tag in module moduleA\n" + "
with description
\n" + "
"); checkOutput("index-all.html", false, "
" - + "search phrase - Search tag in moduleA
\n" + + "search phrase - Search tag in module moduleA\n" + "
with description
\n" + "
" - + "search phrase - Search tag in moduleA
\n" + + "search phrase - Search tag in module moduleA\n" + "
with description
"); } diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java index cc6de82b239..e43c8ea5865 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java @@ -25,7 +25,7 @@ * @test * @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 * 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202 - * 8184205 8214468 8222548 8223378 + * 8184205 8214468 8222548 8223378 8234746 * @summary Test the search feature of javadoc. * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -393,31 +393,31 @@ public class TestSearch extends JavadocTester { // Test for search tags markup in index file. checkOutput("index-all.html", expectedOutput, "
" - + "phrase with spaces - Search tag in pkg
", + + "phrase with spaces - Search tag in package pkg", "
" - + "pkg - Search tag in pkg
", + + "pkg - Search tag in package pkg", "
" - + "pkg2.5 - Search tag in pkg
", + + "pkg2.5 - Search tag in package pkg", "
" - + "r - Search tag in pkg
", + + "r - Search tag in package pkg", "
" - + "search phrase - Search tag in pkg1.RegClass
", + + "search phrase - Search tag in class pkg1.RegClass", "
" + "SearchWordWithDescription - Search tag in pkg1.RegClass.CONSTANT_FIELD_1
", "
" - + "search phrase with desc deprecated - Search tag in pkg2.TestAnnotationType
", + + "search phrase with desc deprecated - Search tag in annotation type pkg2.TestAnnotationType", "
" - + "SearchTagDeprecatedClass - Search tag in pkg2.TestClass
", + + "SearchTagDeprecatedClass - Search tag in class pkg2.TestClass", "
" + "search phrase deprecated - Search tag in pkg2.TestEnum.ONE
", "
" + "search phrase deprecated - Search tag in pkg2.TestEnum.ONE
", "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
", + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()", "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
", + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()", "
" - + "SingleWord - Search tag in pkg
", + + "SingleWord - Search tag in package pkg", "
nested {@index nested_tag_test} - " + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE
", @@ -443,35 +443,35 @@ public class TestSearch extends JavadocTester { // Test for search tags markup in split index file. checkOutput("index-files/index-13.html", true, "
" - + "search phrase - Search tag in pkg1.RegClass
", + + "search phrase - Search tag in class pkg1.RegClass", "
" + "SearchWordWithDescription - Search tag in pkg1.RegClass.CONSTANT_FIELD_1
", "
" - + "search phrase with desc deprecated - Search tag in pkg2.TestAnnotationType
", + + "search phrase with desc deprecated - Search tag in annotation type pkg2.TestAnnotationType", "
" - + "SearchTagDeprecatedClass - Search tag in pkg2.TestClass
", + + "SearchTagDeprecatedClass - Search tag in class pkg2.TestClass", "
" + "search phrase deprecated - Search tag in pkg2.TestEnum.ONE
", "
" + "search phrase deprecated - Search tag in pkg2.TestEnum.ONE
", "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
", + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()", "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
", + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()", "
" - + "SingleWord - Search tag in pkg
", + + "SingleWord - Search tag in package pkg", "
All Classes " + "All Packages"); checkOutput("index-files/index-10.html", true, "
" - + "phrase with spaces - Search tag in pkg
", + + "phrase with spaces - Search tag in package pkg", "
" - + "pkg - Search tag in pkg
", + + "pkg - Search tag in package pkg", "
" - + "pkg2.5 - Search tag in pkg
"); + + "pkg2.5 - Search tag in package pkg"); checkOutput("index-files/index-12.html", true, "
" - + "r - Search tag in pkg
"); + + "r - Search tag in package pkg"); checkOutput("index-files/index-8.html", true, "
nested {@index nested_tag_test} - " @@ -497,23 +497,23 @@ public class TestSearch extends JavadocTester { // Test for search tags markup in index file when javadoc is executed with -nocomment. checkOutput("index-all.html", false, "
" - + "phrase with spaces - Search tag in pkg
", + + "phrase with spaces - Search tag in package pkg", "
" - + "pkg - Search tag in pkg
", + + "pkg - Search tag in package pkg", "
" - + "pkg2.5 - Search tag in pkg
", + + "pkg2.5 - Search tag in package pkg", "
" - + "r - Search tag in pkg
", + + "r - Search tag in package pkg", "
" - + "search phrase - Search tag in pkg1.RegClass
", + + "search phrase - Search tag in class pkg1.RegClass", "
" + "SearchWordWithDescription - Search tag in pkg1.RegClass.CONSTANT_FIELD_1
", "
" - + "search phrase with desc deprecated - Search tag in pkg2.TestAnnotationType
", + + "search phrase with desc deprecated - Search tag in annotation type pkg2.TestAnnotationType", "
" - + "SearchTagDeprecatedClass - Search tag in pkg2.TestClass
", + + "SearchTagDeprecatedClass - Search tag in class pkg2.TestClass", "
" - + "SingleWord - Search tag in pkg
", + + "SingleWord - Search tag in package pkg", "
class_test1 passes. Search tag" + " SearchTagDeprecatedClass
", "
error_test3 passes. Search tag for\n" @@ -522,29 +522,29 @@ public class TestSearch extends JavadocTester { "
" + "search phrase deprecated - Search tag in pkg2.TestEnum.ONE
", "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
"); + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()"); } void checkIndexNoDeprecated() { // Test for search tags markup in index file when javadoc is executed using -nodeprecated. checkOutput("index-all.html", true, "
" - + "phrase with spaces - Search tag in pkg
", + + "phrase with spaces - Search tag in package pkg", "
" - + "search phrase - Search tag in pkg1.RegClass
", + + "search phrase - Search tag in class pkg1.RegClass", "
" + "SearchWordWithDescription - Search tag in pkg1.RegClass.CONSTANT_FIELD_1
", "
" - + "SingleWord - Search tag in pkg
"); + + "SingleWord - Search tag in package pkg"); checkOutput("index-all.html", false, "
" - + "search phrase with desc deprecated - Search tag in pkg2.TestAnnotationType
", + + "search phrase with desc deprecated - Search tag in annotation type pkg2.TestAnnotationType", "
" - + "SearchTagDeprecatedClass - Search tag in pkg2.TestClass
", + + "SearchTagDeprecatedClass - Search tag in class pkg2.TestClass", "
" + "search phrase deprecated - Search tag in pkg2.TestEnum.ONE
", "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
", + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()", "
class_test1 passes. Search tag" + " SearchTagDeprecatedClass
", "
error_test3 passes. Search tag for\n" @@ -629,14 +629,14 @@ public class TestSearch extends JavadocTester { // Test for search tags duplication in index file. checkOutput("index-all.html", true, "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
\n" + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()\n" + "
with description
"); checkOutput("index-all.html", false, "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
\n" + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()\n" + "
with description
\n" + "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
\n" + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()\n" + "
with description
"); } @@ -644,14 +644,14 @@ public class TestSearch extends JavadocTester { // Test for search tags duplication in index file. checkOutput("index-files/index-13.html", true, "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
\n" + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()\n" + "
with description
"); checkOutput("index-files/index-13.html", false, "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
\n" + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()\n" + "
with description
\n" + "
" - + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError
\n" + + "SearchTagDeprecatedMethod - Search tag in pkg2.TestError.TestError()\n" + "
with description
"); } diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java index f87a3ccaebe..31193e57cbf 100644 --- a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/TestSystemPropertyTaglet.java @@ -23,7 +23,7 @@ /* * @test - * @bug 5076751 + * @bug 5076751 8234746 * @summary System properties documentation needed in javadocs * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -31,7 +31,6 @@ * @run main TestSystemPropertyTaglet */ - import java.nio.file.Path; import java.nio.file.Paths; @@ -56,50 +55,167 @@ public class TestSystemPropertyTaglet extends JavadocTester { @Test public void test(Path base) throws Exception { - Path srcDir = base.resolve("src"); - Path outDir = base.resolve("out"); - - MethodBuilder method = MethodBuilder - .parse("public void func(A a) {}") - .setComments("test with {@systemProperty java.version}"); - - new ClassBuilder(tb, "pkg.A") - .setComments("test with {@systemProperty user.name}") - .setModifiers("public", "class") - .addMembers(method) - .write(srcDir); - - javadoc("-d", outDir.toString(), - "-sourcepath", srcDir.toString(), - "pkg"); + javadoc("-d", base.resolve("out").toString(), + "--module-source-path", testSrc, + "--module", "mymodule"); checkExit(Exit.OK); - checkOrder("pkg/A.html", - "

Class A

", - "test with user.name", - "

Method Details

", - "test with java.version"); + checkOrder("mymodule/mypackage/MyAnnotation.html", + "

Annotation Type MyAnnotation

", + "(annotation) the test.property system property.", + "

Element Details

", + "(annotation/method) the test.property system property.", + ""); + + checkOrder("mymodule/mypackage/MyClass.html", + "

Class MyClass

", + "(class) the test.property system property.", + "

Field Details

", + "(class/field) the test.property system property.", + "(class/static-field) the test.property system property.", + "

Constructor Details

", + "(class/constructor) the test.property system property.", + "

Method Details

", + "(class/static-method) the test.property system property.", + "(class/method) the test.property system property.", + ""); + + checkOrder("mymodule/mypackage/MyEnum.html", + "

Enum MyEnum

", + "(enum) the test.property system property.", + "

Enum Constant Details

", + "(enum/constant) the test.property system property.", + ""); + + checkOrder("mymodule/mypackage/MyError.html", + "

Class MyError

", + "(error) the test.property system property.", + "

Constructor Details

", + "(error/constructor) the test.property system property.", + ""); + + checkOrder("mymodule/mypackage/MyException.html", + "

Class MyException

", + "(exception) the test.property system property.", + "

Constructor Details

", + "(exception/constructor) the test.property", + ""); + + checkOrder("mymodule/mypackage/MyInterface.html", + "

Interface MyInterface

", + "(interface) the test.property system property.", + "

Field Details

", + "(interface/constant) the test.property system property.", + "

Method Details

", + "(interface/method-1) the test.property system property.", + "(interface/method-2) the test.property system property.", + ""); + + checkOrder("mymodule/module-summary.html", + "

Module mymodule

", + "(module) the test.property system property.", + ""); + + checkOrder("mymodule/mypackage/package-summary.html", + "

Package mypackage

", + "(package) the test.property system property.", + ""); checkOrder("index-all.html", - "

J

", - "
java.version" - + " - Search tag in pkg.A
\n
System Property
", - "

U

", - "
user.name" - + " - Search tag in pkg.A
\n
System Property
"); + "

T

", + "
test.property" + + " - Search tag in annotation type mypackage.MyAnnotation
\n
System Property
", + "
test.property" + + " - Search tag in class mypackage.MyClass
\n
System Property
", + "
test.property" + + " - Search tag in enum mypackage.MyEnum
\n
System Property
", + "
test.property" + + " - Search tag in error mypackage.MyError
\n
System Property
", + "
test.property" + + " - Search tag in exception mypackage.MyException
\n
System Property
", + "
test.property" + + " - Search tag in interface mypackage.MyInterface
\n
System Property
", + "
test.property" + + " - Search tag in module mymodule
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyAnnotation.value()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyClass.INT_CONSTANT
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyClass.MyClass()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyClass.intField
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyClass.run()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyClass.value()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyEnum.X
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyEnum.m()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyError.MyError()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyException.MyException()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyInterface.INT_CONSTANT
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyInterface.m()
\n
System Property
", + "
test.property" + + " - Search tag in mypackage.MyInterface.m(String...)
\n
System Property
", + "
test.property" + + " - Search tag in package mypackage
\n
System Property
", + ""); checkOutput("tag-search-index.js", true, - "{\"l\":\"java.version\",\"h\":\"pkg.A\",\"d\":\"System Property\"," - + "\"u\":\"pkg/A.html#java.version\"}"); - - checkOutput("tag-search-index.js", true, - "{\"l\":\"user.name\",\"h\":\"pkg.A\",\"d\":\"System Property\"," - + "\"u\":\"pkg/A.html#user.name\"}"); + "{\"l\":\"test.property\",\"h\":\"annotation type mypackage.MyAnnotation\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyAnnotation.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"class mypackage.MyClass\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyClass.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"enum mypackage.MyEnum\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyEnum.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"error mypackage.MyError\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyError.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"exception mypackage.MyException\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyException.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"interface mypackage.MyInterface\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyInterface.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"module mymodule\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/module-summary.html#test.property\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyAnnotation.value()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyAnnotation.html#test.property-1\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyClass.INT_CONSTANT\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyClass.html#test.property-2\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyClass.MyClass()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyClass.html#test.property-3\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyClass.intField\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyClass.html#test.property-1\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyClass.run()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyClass.html#test.property-5\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyClass.value()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyClass.html#test.property-4\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyEnum.X\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyEnum.html#test.property-1\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyEnum.m()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyEnum.html#test.property-2\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyError.MyError()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyError.html#test.property-1\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyException.MyException()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyException.html#test.property-1\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyInterface.INT_CONSTANT\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyInterface.html#test.property-1\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyInterface.m()\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyInterface.html#test.property-2\"}", + "{\"l\":\"test.property\",\"h\":\"mypackage.MyInterface.m(String...)\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/MyInterface.html#test.property-3\"}", + "{\"l\":\"test.property\",\"h\":\"package mypackage\"" + + ",\"d\":\"System Property\",\"u\":\"mymodule/mypackage/package-summary.html#test.property\"}", + ""); } @Test - public void testSystemProperytWithinATag(Path base) throws Exception { + public void testSystemPropertyWithinATag(Path base) throws Exception { Path srcDir = base.resolve("src"); Path outDir = base.resolve("out"); @@ -118,27 +234,4 @@ public class TestSystemPropertyTaglet extends JavadocTester { checkOutput(Output.OUT, true, "warning: {@systemProperty} tag, which expands to , within "); } - - @Test - public void testDuplicateReferences(Path base) throws Exception { - Path srcDir = base.resolve("src"); - Path outDir = base.resolve("out"); - - new ClassBuilder(tb, "pkg.A") - .setModifiers("public", "class") - .setComments("This is a class. Here is {@systemProperty foo}.") - .addMembers(MethodBuilder.parse("public void m() {}") - .setComments("This is a method. Here is {@systemProperty foo}.")) - .write(srcDir); - - javadoc("-d", outDir.toString(), - "-sourcepath", srcDir.toString(), - "pkg"); - - checkExit(Exit.OK); - - checkOutput("pkg/A.html", true, - "This is a class. Here is foo.", - "This is a method. Here is foo."); - } } diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/module-info.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/module-info.java new file mode 100644 index 00000000000..b467acbc57c --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/module-info.java @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2019, 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. + */ + +/** + * (module) the {@systemProperty test.property} system property. + */ +module mymodule { + exports mypackage; +} \ No newline at end of file diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyAnnotation.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyAnnotation.java new file mode 100644 index 00000000000..0ce159603e0 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyAnnotation.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019, 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. + */ + +package mypackage; + +/** + * (annotation) the {@systemProperty test.property} system property. + */ +public @interface MyAnnotation { + + /** + * (annotation/method) the {@systemProperty test.property} system property. + * + * @return the MyEnum + */ + MyEnum value() default MyEnum.X; +} diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyClass.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyClass.java new file mode 100644 index 00000000000..fe4b26f4a7e --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyClass.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2019, 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. + */ + +package mypackage; + +/** + * (class) the {@systemProperty test.property} system property. + */ +public class MyClass { + + /** + * (class/field) the {@systemProperty test.property} system property. + */ + public int intField; + + /** + * (class/static-field) the {@systemProperty test.property} system property. + */ + public final static int INT_CONSTANT = 42; + + /** + * (class/static-method) the {@systemProperty test.property} system property. + * + * @return an integer, 42 + */ + public static Object value() { return INT_CONSTANT; } + + /** + * (class/constructor) the {@systemProperty test.property} system property. + */ + public MyClass() { } + + /** + * (class/method) the {@systemProperty test.property} system property. + */ + public void run() { } +} \ No newline at end of file diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyEnum.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyEnum.java new file mode 100644 index 00000000000..59f9b17f447 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyEnum.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019, 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. + */ + +package mypackage; + +/** + * (enum) the {@systemProperty test.property} system property. + */ +public enum MyEnum { + + /** + * (enum/constant) the {@systemProperty test.property} system property. + */ + X { + // The mention below will not appear in the javadoc, see JDK-8144631 + + /** + * (enum/constant-specific-method) the {@systemProperty test.property} system property. + */ + public void m() { } + }; + + /** + * (enum/method) the {@systemProperty test.property} system property. + */ + public void m() { } +} \ No newline at end of file diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyError.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyError.java new file mode 100644 index 00000000000..d9a6592ac49 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyError.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019, 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. + */ + +package mypackage; + +/** + * (error) the {@systemProperty test.property} system property. + */ +public class MyError extends Error { + + /** + * (error/constructor) the {@systemProperty test.property} system property. + */ + public MyError() { } +} diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyException.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyException.java new file mode 100644 index 00000000000..fd705015690 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyException.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019, 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. + */ + +package mypackage; + +/** + * (exception) the {@systemProperty test.property} system property. + */ +public class MyException extends Exception { + + /** + * (exception/constructor) the {@systemProperty test.property} system property. + */ + public MyException() { } +} diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyInterface.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyInterface.java new file mode 100644 index 00000000000..30dee28a6a6 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/MyInterface.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019, 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. + */ + +package mypackage; + +/** + * (interface) the {@systemProperty test.property} system property. + */ +public interface MyInterface { + + /** + * (interface/constant) the {@systemProperty test.property} system property. + */ + int INT_CONSTANT = 42; + + /** + * (interface/method-1) the {@systemProperty test.property} system property. + */ + void m(); + + /** + * (interface/method-2) the {@systemProperty test.property} system property. + * + * @param strings + */ + void m(String... strings); +} diff --git a/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/package-info.java b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/package-info.java new file mode 100644 index 00000000000..bf0eace2210 --- /dev/null +++ b/test/langtools/jdk/javadoc/doclet/testSystemPropertyTaglet/mymodule/mypackage/package-info.java @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2019, 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. + */ + +/** + * (package) the {@systemProperty test.property} system property. + */ +package mypackage; \ No newline at end of file