# HG changeset patch # User bpatel # Date 1520361947 28800 # Node ID 771616d26ca1adf42233b15310d38473fc1b0121 # Parent 67912cbf784a72004afa75813dbf3bce91a2e253 8182765: HTML5 must be the default javadoc codegen mode in the near future Reviewed-by: jjg diff -r 67912cbf784a -r 771616d26ca1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Mar 06 17:43:21 2018 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Tue Mar 06 10:45:47 2018 -0800 @@ -307,8 +307,7 @@ } if (htmlVersion == null) { - reporter.print(WARNING, getText("doclet.HTML_version_not_specified", helpfile)); - htmlVersion = HtmlVersion.HTML4; + htmlVersion = HtmlVersion.HTML5; } // check if helpfile exists @@ -658,6 +657,7 @@ new Option(resources, "-html4") { @Override public boolean process(String opt, List args) { + reporter.print(WARNING, getText("doclet.HTML_4_specified", helpfile)); htmlVersion = HtmlVersion.HTML4; return true; } diff -r 67912cbf784a -r 771616d26ca1 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Tue Mar 06 17:43:21 2018 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties Tue Mar 06 10:45:47 2018 -0800 @@ -445,9 +445,8 @@ disable checks for the specified packages. # L10N: do not localize the option names -html4 and -html5 -doclet.HTML_version_not_specified=\ - You have not specified the version of HTML to use.\n\ - The default is currently HTML 4.01, but this will change to HTML5\n\ - in a future release. To suppress this warning, please specify the\n\ - version of HTML used in your documentation comments and to be\n\ - generated by this doclet, using the -html4 or -html5 options. +doclet.HTML_4_specified=\ + You have specified the HTML version as HTML 4.01 by using the -html4 option.\n\ + The default is currently HTML5 and the support for HTML 4.01 will be removed\n\ + in a future release. To suppress this warning, please ensure that any HTML constructs\n\ + in your comments are valid in HTML5, and remove the -html4 option. diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/AccessSkipNav/AccessSkipNav.java --- a/test/langtools/jdk/javadoc/doclet/AccessSkipNav/AccessSkipNav.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/AccessSkipNav/AccessSkipNav.java Tue Mar 06 10:45:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 4638136 7198273 8025633 8081854 + * @bug 4638136 7198273 8025633 8081854 8182765 * @summary Add ability to skip over nav bar for accessibility * @author dkramer * @library ../lib @@ -46,21 +46,37 @@ "p1", "p2"); checkExit(Exit.OK); - // Testing only for the presence of the and + // Testing only for the presence of the and checkOutput("p1/C1.html", true, // Top navbar "Skip navigation links", // Top navbar - "\n" + "\n" + "\n" + "", // Bottom navbar "Skip navigation links", // Bottom navbar + "\n" + + "\n" + + ""); + } + + @Test + void test_html4() { + javadoc("-d", "out-html4", + "-html4", + "-sourcepath", testSrc, + "p1", "p2"); + checkExit(Exit.OK); + + // Testing only for the presence of + checkOutput("p1/C1.html", true, + "\n" + + "\n" + + "", "\n" + "\n" + ""); - - } } diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/AccessSummary/AccessSummary.java --- a/test/langtools/jdk/javadoc/doclet/AccessSummary/AccessSummary.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/AccessSummary/AccessSummary.java Tue Mar 06 10:45:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 4637604 4775148 8183037 + * @bug 4637604 4775148 8183037 8182765 * @summary Test the tables for summary attribute * @author dkramer * @library ../lib @@ -47,15 +47,29 @@ void testAccessSummary() { javadoc("-d", "out", "-sourcepath", testSrc, "p1", "p2"); checkExit(Exit.OK); - checkOutput("overview-summary.html", true, + checkSummary(false); + } + + @Test + void testAccessSummary_html4() { + javadoc("-d", "out-html4", + "-html4", + "-sourcepath", testSrc, + "p1", "p2"); + checkExit(Exit.OK); + checkSummary(true); + } + + void checkSummary(boolean found) { + checkOutput("overview-summary.html", found, "summary=\"Package Summary table, listing packages, and an explanation\""); - // Test that the summary attribute appears - checkOutput("p1/C1.html", true, + // Test that the summary attribute appears or not + checkOutput("p1/C1.html", found, "summary=\"Constructor Summary table, listing constructors, and an explanation\""); - // Test that the summary attribute appears - checkOutput("constant-values.html", true, + // Test that the summary attribute appears or not + checkOutput("constant-values.html", found, "summary=\"Constant Field Values table, listing constant fields, and values\""); } } diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java --- a/test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java Tue Mar 06 10:45:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 4034096 4764726 6235799 + * @bug 4034096 4764726 6235799 8182765 * @summary Add support for HTML keywords via META tag for * class and member names to improve API search * @author dkramer @@ -58,23 +58,7 @@ checkExit(Exit.OK); - checkOutput("p1/C1.html", true, - "", - "", - "", - "", - ""); - - checkOutput("p1/package-summary.html", true, - ""); - - checkOutput("overview-summary.html", true, - ""); - - // NOTE: Hopefully, this regression test is not run at midnight. If the output - // was generated yesterday and this test is run today, the test will fail. - checkOutput("overview-summary.html", true, - ""); + checkMeta("dc.created", true); } @Test @@ -87,24 +71,55 @@ checkExit(Exit.OK); // No keywords when -keywords is not used. - checkOutput("p1/C1.html", false, - "", - "", - "", - "", - ""); + checkMeta("dc.created", false); + } + + @Test + void testStandard_html4() { + javadoc("-d", "out-1-html4", + "-html4", + "-sourcepath", testSrc, + "-keywords", + "-doctitle", "Sample Packages", + "p1", "p2"); + + checkExit(Exit.OK); + + checkMeta("date", true); + } - checkOutput("p1/package-summary.html", false, - ""); + @Test + void testNoTimestamp_html4() { + javadoc("-d", "out-2-html4", + "-html4", + "-sourcepath", testSrc, + "-notimestamp", + "-doctitle", "Sample Packages", + "p1", "p2"); + checkExit(Exit.OK); + + // No keywords when -keywords is not used. + checkMeta("date", false); + } - checkOutput("overview-summary.html", false, - ""); + void checkMeta(String metaNameDate, boolean found) { + checkOutput("p1/C1.html", found, + "", + "", + "", + "", + ""); - // The date metatag should not show up when -notimestamp is used. + checkOutput("p1/package-summary.html", found, + ""); + + checkOutput("overview-summary.html", found, + ""); + // NOTE: Hopefully, this regression test is not run at midnight. If the output // was generated yesterday and this test is run today, the test will fail. - checkOutput("overview-summary.html", false, - ""); + checkOutput("overview-summary.html", found, + ""); } private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/ValidHtml/ValidHtml.java --- a/test/langtools/jdk/javadoc/doclet/ValidHtml/ValidHtml.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/ValidHtml/ValidHtml.java Tue Mar 06 10:45:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2018, 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 4275630 4749453 4625400 4753048 4415270 8074521 + * @bug 4275630 4749453 4625400 4753048 4415270 8074521 8182765 * @summary Generated HTML is invalid with frames. * Displays unnecessary horizontal scroll bars. * Missing whitespace in DOCTYPE declaration @@ -53,26 +53,42 @@ "-sourcepath", testSrc, "p1", "p2"); checkExit(Exit.OK); - - // Test the proper DOCTYPE element are present: - checkOutput("index.html", true, LOOSE); - checkOutput("overview-summary.html", true, LOOSE); - checkOutput("p1/package-summary.html", true, LOOSE); - checkOutput("p1/C.html", true, LOOSE); - checkOutput("overview-frame.html", true, LOOSE); - checkOutput("allclasses-frame.html", true, LOOSE); - checkOutput("p1/package-frame.html", true, LOOSE); - // Test for IFRAME element: checkOutput("index.html", true, "\n" + ""); + String HTML5 = ""; + checkValidHTML(HTML5); } - private static final String LOOSE = - ""; + @Test + void test_html4() { + // Test for all cases except the split index page + javadoc("-d", "out-html4", + "-html4", + "-doctitle", "Document Title", + "-windowtitle", "Window Title", + "-use", + "-overview", testSrc("overview.html"), + "-sourcepath", testSrc, + "p1", "p2"); + checkExit(Exit.OK); + String HTML4 = ""; + + checkValidHTML(HTML4); } + + void checkValidHTML(String doctype) { + // Test the proper DOCTYPE element are present: + checkOutput("index.html", true, doctype); + checkOutput("overview-summary.html", true, doctype); + checkOutput("p1/package-summary.html", true, doctype); + checkOutput("p1/C.html", true, doctype); + checkOutput("overview-frame.html", true, doctype); + checkOutput("allclasses-frame.html", true, doctype); + checkOutput("p1/package-frame.html", true, doctype); + } +} diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java --- a/test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testAnchorNames/TestAnchorNames.java Tue Mar 06 10:45:47 2018 -0800 @@ -23,7 +23,7 @@ /* * @test - * @bug 8025633 8025524 8081854 8187521 + * @bug 8025633 8025524 8081854 8187521 8182765 * @summary Test for valid name attribute in HTML anchors. * @author Bhavesh Patel * @library /tools/lib ../lib @@ -33,7 +33,6 @@ */ import java.io.IOException; -import java.nio.charset.Charset; import java.nio.file.Path; import java.nio.file.Paths; @@ -54,6 +53,7 @@ @Test void testHtml4(Path ignore) { javadoc("-d", "out-html4", + "-html4", "-sourcepath", testSrc, "-source", "8", //so that '_' can be used as an identifier "-use", @@ -175,7 +175,6 @@ "-sourcepath", testSrc, "-source", "8", //so that '_' can be used as an identifier "-use", - "-html5", "pkg1"); checkExit(Exit.OK); diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/testAnnotationOptional/TestAnnotationOptional.java --- a/test/langtools/jdk/javadoc/doclet/testAnnotationOptional/TestAnnotationOptional.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testAnnotationOptional/TestAnnotationOptional.java Tue Mar 06 10:45:47 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, 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 8025633 8081854 + * @bug 8025633 8081854 8182765 * @summary Make sure that annotations types with optional elements have * element headers * @author Mahmood Ali @@ -48,6 +48,18 @@ checkExit(Exit.OK); checkOutput("pkg/AnnotationOptional.html", true, + ""); + } + + @Test + void test_html4() { + javadoc("-d", "out-html4", + "-html4", + "-sourcepath", testSrc, + "pkg"); + checkExit(Exit.OK); + + checkOutput("pkg/AnnotationOptional.html", true, ""); } } diff -r 67912cbf784a -r 771616d26ca1 test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java --- a/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Tue Mar 06 17:43:21 2018 +0100 +++ b/test/langtools/jdk/javadoc/doclet/testAnnotationTypes/TestAnnotationTypes.java Tue Mar 06 10:45:47 2018 -0800 @@ -23,7 +23,7 @@ /* * @test - * @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 + * @bug 4973609 8015249 8025633 8026567 6469561 8071982 8162363 8182765 * @summary Make sure that annotation types with 0 members does not have * extra HR tags. * @author jamieh @@ -72,11 +72,11 @@ checkOutput("pkg/AnnotationType.html", true, "", "