diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java index a103ffb70fb..8e5920eef63 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java @@ -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); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlIds.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlIds.java index 8b48c7a6f22..53dd622b2b0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlIds.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlIds.java @@ -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"); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties index 44f285f21db..66302785ee6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties @@ -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} diff --git a/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java b/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java index bf89f377d24..5398502bcd0 100644 --- a/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java +++ b/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java @@ -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 { 5 + Toggle all