8264274: Block tags in overview.html are ignored

Reviewed-by: jjg
This commit is contained in:
Hannes Wallnöfer 2021-08-17 08:29:49 +00:00
parent c5c84b8fdc
commit 0e3fde6c3c
3 changed files with 29 additions and 10 deletions
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html
test/langtools/jdk/javadoc/doclet/testOverview

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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
@ -66,9 +66,8 @@ public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
*/
protected void addOverviewHeader(Content main) {
addConfigurationTitle(main);
if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
addOverviewComment(main);
}
addOverviewComment(main);
addOverviewTags(main);
}
/**
@ -84,6 +83,17 @@ public abstract class AbstractOverviewIndexWriter extends HtmlDocletWriter {
}
}
/**
* Adds the block tags provided in the file specified by the "-overview" option.
*
* @param htmlTree the content tree to which the tags will be added
*/
protected void addOverviewTags(Content htmlTree) {
if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
addTagsInfo(configuration.overviewElement, htmlTree);
}
}
/**
* Generate and prints the contents in the index file.
*

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2021, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 8173302 8182765 8196202 8210047
* @bug 8173302 8182765 8196202 8210047 8264274
* @summary make sure the overview-summary and module-summary pages don't
* don't have the See link, and the overview is copied correctly.
* @library ../../lib
@ -50,7 +50,7 @@ public class TestOverview extends JavadocTester {
"-sourcepath", testSrc("src"),
"p1", "p2");
checkExit(Exit.OK);
checkOverview();
checkOverview("");
}
@Test
@ -62,10 +62,10 @@ public class TestOverview extends JavadocTester {
"-sourcepath", testSrc("msrc"),
"p1", "p2");
checkExit(Exit.OK);
checkOverview();
checkOverview("acme/");
}
void checkOverview() {
void checkOverview(String modulePrefix) {
checkOutput("index.html", true,
"""
<main role="main">
@ -73,6 +73,14 @@ public class TestOverview extends JavadocTester {
<h1 class="title">Document Title</h1>
</div>
<div class="block">This is line1. This is line 2.</div>
""");
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="%sp1/C.html" title="class in p1"><code>C</code></a></li>
</ul>
</dd>
</dl>
""".formatted(modulePrefix)); // adapt expected reference URL to module context
}
}

@ -2,5 +2,6 @@
<html>
<body bgcolor="white">
This is line1. This is line 2.
@see p1.C
</body>
</html>