8331873: Improve/expand info in New API In on Help page

Co-authored-by: Jonathan Gibbons <jjg@openjdk.org>
Reviewed-by: liach, hannesw
This commit is contained in:
Nizar Benalla 2025-01-31 01:16:54 +00:00
parent d589a82d08
commit 8986cb2772
4 changed files with 46 additions and 13 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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,8 +27,8 @@ package jdk.javadoc.internal.doclets.formats.html;
import java.util.List;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyles;
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException;
import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
@ -36,7 +36,6 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
import jdk.javadoc.internal.html.Content;
import jdk.javadoc.internal.html.ContentBuilder;
import jdk.javadoc.internal.html.HtmlId;
import jdk.javadoc.internal.html.HtmlTag;
import jdk.javadoc.internal.html.HtmlTree;
import jdk.javadoc.internal.html.Text;
@ -109,6 +108,10 @@ public class HelpWriter extends HtmlDocletWriter {
.add(getNavigationSection())
.add(HtmlTree.HR())
.add(getPageKindSection())
.add(options.noSince()
? new ContentBuilder()
: new ContentBuilder(HtmlTree.HR(),
getReleasesSection()))
.add(HtmlTree.HR())
.add(HtmlTree.SPAN(HtmlStyles.helpFootnote,
getContent("doclet.help.footnote")));
@ -407,6 +410,26 @@ public class HelpWriter extends HtmlDocletWriter {
return pageKindsSection;
}
private Content getReleasesSection() {
Content releasesHeading = contents.getContent("doclet.help.releases.head");
var releasesSection = HtmlTree.DIV(HtmlStyles.subTitle)
.add(HtmlTree.HEADING(Headings.CONTENT_HEADING, releasesHeading).setId(HtmlIds.HELP_RELEASES))
.add(HtmlTree.P(contents.getContent("doclet.help.releases.body.specify.top-level")))
.add(HtmlTree.P(contents.getContent("doclet.help.releases.body.specify.member")));
if (configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.DEPRECATED)
|| configuration.conditionalPages.contains(HtmlConfiguration.ConditionalPage.NEW)) {
releasesSection.add(HtmlTree.P(contents.getContent("doclet.help.releases.body.refer")));
}
tableOfContents.addLink(HtmlIds.HELP_RELEASES, releasesHeading);
tableOfContents.pushNestedList();
tableOfContents.popNestedList();
return releasesSection;
}
private Content getContent(String key) {
return contents.getContent(key);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, 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
@ -93,6 +93,7 @@ public class HtmlIds {
static final HtmlId FOR_REMOVAL = HtmlId.of("for-removal");
static final HtmlId HELP_NAVIGATION = HtmlId.of("help-navigation");
static final HtmlId HELP_PAGES = HtmlId.of("help-pages");
static final HtmlId HELP_RELEASES = HtmlId.of("help-releases");
static final HtmlId METHOD_DETAIL = HtmlId.of("method-detail");
static final HtmlId METHOD_SUMMARY = HtmlId.of("method-summary");
static final HtmlId METHOD_SUMMARY_TABLE = HtmlId.of("method-summary-table");

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2025, 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
@ -116,14 +116,14 @@ doclet.tag.invalid_input=invalid input: ''{0}''
doclet.tag.invalid=invalid @{0}
doclet.Deprecated_API=Deprecated API
doclet.Deprecated_API_Checkbox_Label=Show API deprecated in:
doclet.Deprecated_API_Checkbox_All_Releases=all
doclet.Deprecated_API_Checkbox_All_Releases=Toggle all
doclet.Deprecated_API_Checkbox_Other_Releases=other
doclet.Deprecated_Elements=Deprecated {0}
doclet.Deprecated_Elements_Release_Column_Header=Deprecated in
doclet.Deprecated_In_Release=Deprecated in {0}
doclet.New_API=New API
doclet.New_API_Checkbox_Label=Show API added in:
doclet.New_API_Checkbox_All_Releases=all
doclet.New_API_Checkbox_All_Releases=Toggle all
doclet.New_Elements=New {0}
doclet.New_Elements_Release_Column_Header=Added in
doclet.New_Label=New
@ -385,7 +385,16 @@ doclet.help.search.refer=Refer to the {0} for a full description of search featu
doclet.help.search.spec.url=https://docs.oracle.com/en/java/javase/{0}/docs/specs/javadoc/javadoc-search-spec.html
# The title for the Javadoc Search Specification
doclet.help.search.spec.title=Javadoc Search Specification
doclet.help.releases.head=Release Details
doclet.help.releases.body.specify.top-level=\
The details for each module, package, class or interface \
normally include the release in which the declaration was introduced.
doclet.help.releases.body.specify.member=\
When a member is added after the initial introduction of the enclosing class or interface, the details \
of the member include the release in which it was introduced.
doclet.help.releases.body.refer=\
Some summary pages (New API, Deprecated) allow you to filter the contents of the page according to \
the release in which the declaration was introduced or deprecated.
doclet.ClassUse_Packages.that.use.0=Packages that use {0}
doclet.ClassUse_Uses.of.0.in.1=Uses of {0} in {1}
doclet.ClassUse_Classes.in.0.used.by.1=Classes in {0} used by {1}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, 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 8263468 8269401 8268422 8287524 8325874
* @bug 8263468 8269401 8268422 8287524 8325874 8331873
* @summary New page for "recent" new API
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@ -117,7 +117,7 @@ public class TestNewApiList extends JavadocTester {
<input type="checkbox" id="release-6" disabled checked onclick="toggleGlobal(this, '6', 3)">
<span>5</span></label> <label for="release-all">
<input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>all</span></label></div>
<span>Toggle all</span></label></div>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">
<li id="contents-module"><a href="#module">Modules</a></li>
@ -610,7 +610,7 @@ public class TestNewApiList extends JavadocTester {
<input type="checkbox" id="release-other" disabled checked onclick="toggleGlobal(this, 'other', 3)">
<span>other</span></label> <label for="release-all">
<input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>all</span></label></div>
<span>Toggle all</span></label></div>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">
<li id="contents-for-removal"><a href="#for-removal">Terminally Deprecated</a></li>
@ -683,7 +683,7 @@ public class TestNewApiList extends JavadocTester {
<input type="checkbox" id="release-5" disabled checked onclick="toggleGlobal(this, '5', 3)">
<span>6</span></label> <label for="release-all">
<input type="checkbox" id="release-all" disabled checked onclick="toggleGlobal(this, 'all', 3)">
<span>all</span></label></div>
<span>Toggle all</span></label></div>
<h2 title="Contents">Contents</h2>
<ul class="contents-list">
<li id="contents-class"><a href="#class">Classes</a></li>