Skip to content

Commit

Permalink
8264274: Block tags in overview.html are ignored
Browse files Browse the repository at this point in the history
Reviewed-by: jjg
  • Loading branch information
hns committed Aug 17, 2021
1 parent c5c84b8 commit 0e3fde6
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -66,9 +66,8 @@ public AbstractOverviewIndexWriter(HtmlConfiguration configuration,
*/
protected void addOverviewHeader(Content main) {
addConfigurationTitle(main);
if (!utils.getFullBody(configuration.overviewElement).isEmpty()) {
addOverviewComment(main);
}
addOverviewComment(main);
addOverviewTags(main);
}

/**
Expand All @@ -84,6 +83,17 @@ protected void addOverviewComment(Content htmltree) {
}
}

/**
* 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.
*
Expand Down
20 changes: 14 additions & 6 deletions test/langtools/jdk/javadoc/doclet/testOverview/TestOverview.java
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -50,7 +50,7 @@ public void test1() {
"-sourcepath", testSrc("src"),
"p1", "p2");
checkExit(Exit.OK);
checkOverview();
checkOverview("");
}

@Test
Expand All @@ -62,17 +62,25 @@ public void test2() {
"-sourcepath", testSrc("msrc"),
"p1", "p2");
checkExit(Exit.OK);
checkOverview();
checkOverview("acme/");
}

void checkOverview() {
void checkOverview(String modulePrefix) {
checkOutput("index.html", true,
"""
<main role="main">
<div class="header">
<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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<html>
<body bgcolor="white">
This is line1. This is line 2.
@see p1.C
</body>
</html>

1 comment on commit 0e3fde6

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.