# HG changeset patch # User jjg # Date 1547839590 28800 # Node ID a99bd25706606e9983cfaa79d0bee3bc2e1e5f92 # Parent 46db9786cd673aaa84a62df5a6d22e20a5628fa5 8217034: JavadocTester should check for missing files by default Reviewed-by: hannesw diff -r 46db9786cd67 -r a99bd2570660 src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Fri Jan 18 13:49:45 2019 -0500 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Fri Jan 18 11:26:30 2019 -0800 @@ -25,6 +25,8 @@ package jdk.javadoc.internal.doclets.formats.html; +import java.util.Collections; + import jdk.javadoc.internal.doclets.formats.html.markup.Head; import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.formats.html.markup.DocType; @@ -78,6 +80,7 @@ Content htmlComment = contents.newPage; Head head = new Head(path, configuration.htmlVersion, configuration.docletVersion) .setTimestamp(true) + .setStylesheets(configuration.getMainStylesheet(), Collections.emptyList()) // avoid reference to default stylesheet .addDefaultScript(false); String title = (configuration.windowtitle.length() > 0) diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java --- a/test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -65,9 +65,8 @@ "
with a block tag
"); checkOutput("pkg/BreakIteratorTest.html", true, - "
Return methods to the specified\n" + - " access\n" + - " modifier option.
"); + "
with an anchor for the\n" + + " top level index.
"); checkOutput("pkg/BreakIteratorTest.html", true, "
A constant indicating that the keyLocation is indeterminate\n" + diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java --- a/test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ -43,9 +43,8 @@ public void baz(){} /** - * Return methods to the specified - * access - * modifier option. Second line. + * with an anchor for the + * top level index. Second line. */ public void foobar(){} diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testCopyFiles/packages/p2/doc-files/theme.css diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java --- a/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootInlineTag.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -58,7 +58,7 @@ checkOutput("TestDocRootTag.html", true, "File", - "glossary", + "index", "Second File Link", "The value of @docRoot is \"./\""); diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootTag.java --- a/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootTag.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testDocRootInlineTag/TestDocRootTag.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2019, 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 @@ /** * Here is the use of link: {@link java.io.File File} - * Here is the use of docRoot: glossary. + * Here is the use of docRoot: index. * Here is the use of link: {@link java.io.File Second File Link} */ public class TestDocRootTag {} diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testDocRootLink/TestDocRootLink.java --- a/test/langtools/jdk/javadoc/doclet/testDocRootLink/TestDocRootLink.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testDocRootLink/TestDocRootLink.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2019, 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 @@ -37,6 +37,14 @@ public static void main(String... args) throws Exception { TestDocRootLink tester = new TestDocRootLink(); + + // The test files intentionally contain examples of links that should + // or should not be affected by the -Xdocrootparent option, and the + // results are checked explicitly; so, disable the automatic link + // checker to prevent spurious "missing files" errors from some of + // these links. + tester.setAutomaticCheckLinks(false); + tester.runTests(); } diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java --- a/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testHtmlLandmarkRegions/TestHtmlLandmarkRegions.java Fri Jan 18 11:26:30 2019 -0800 @@ -57,6 +57,7 @@ TestHtmlLandmarkRegions() { tb = new ToolBox(); + setAutomaticCheckLinks(false); // @ignore 8217013 } @Test diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testIndexWithModules/TestIndexWithModules.java --- a/test/langtools/jdk/javadoc/doclet/testIndexWithModules/TestIndexWithModules.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testIndexWithModules/TestIndexWithModules.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -83,6 +83,7 @@ //multiple modules with frames @Test public void testIndexWithMultipleModules1(Path base) throws Exception { + setAutomaticCheckLinks(false); // @ignore 8217013 Path out = base.resolve("out"); javadoc("-d", out.toString(), "--module-source-path", src.toString(), @@ -98,6 +99,7 @@ "m1", "m3", "m4"); + setAutomaticCheckLinks(true); // @ignore 8217013 } //multiple modules with out frames diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java --- a/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testLinkOption/TestLinkOption.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, 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 @@ -115,6 +115,7 @@ ); String out1_html4 = "out1-html4"; + setAutomaticCheckLinks(false); // The example code has toy/bad links javadoc("-d", out1_html4, "-source", "8", "-html4", @@ -134,6 +135,8 @@ + "" + "createTempFile(prefix, suffix, null).
"); + setAutomaticCheckLinks(true); // re-enable checks + // Generate the documentation using -linkoffline and a relative path as the first parameter. // We will try linking to the docs generated in test 1 with a relative path. String out2 = "out2"; @@ -182,6 +185,7 @@ ); // check multiple linkoffline options + setAutomaticCheckLinks(false); // The example code has toy/bad links javadoc("-d", "out6", "-sourcepath", testSrc, "-linkoffline", "../copy/out1", "out1", @@ -200,6 +204,8 @@ + "title=\"class or interface in mylib.lang\" class=\"externalLink\">" + "link to mylib.lang.StringBuilderChild.\n" ); + + setAutomaticCheckLinks(true); // re-enable checks } /* diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java --- a/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testOptions/TestOptions.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 4749567 8071982 8175200 8186332 8185371 8182765 + * @bug 4749567 8071982 8175200 8186332 8185371 8182765 8217034 * @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, -nonavbar, -notree, * -stylesheetfile, --main-stylesheet, --add-stylesheet options. * @author Bhavesh Patel diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java --- a/test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/doclet/testRelativeLinks/TestRelativeLinks.java Fri Jan 18 11:26:30 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -33,6 +33,10 @@ * @run main TestRelativeLinks */ +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; + import javadoc.tester.JavadocTester; public class TestRelativeLinks extends JavadocTester { @@ -106,5 +110,27 @@ "-sourcepath", testSrc, "pkg", "pkg2"); checkExit(Exit.OK); + } + + @Override + public void checkLinks() { + // since the test uses explicit links to non-existent files, + // we create those files to avoid false positive errors from checkLinks + touch("pkg/relative-class-link.html"); + touch("pkg/relative-field-link.html"); + touch("pkg/relative-method-link.html"); + touch("pkg/relative-package-link.html"); + touch("pkg/relative-multi-line-link.html"); + super.checkLinks(); + } + + private void touch(String file) { + File f = new File(outputDir, file); + out.println("touch " + f); + try (FileOutputStream fos = new FileOutputStream(f)) { + } catch (IOException e) { + checking("Touch file"); + failed("Error creating file: " + e); + } + } } -} diff -r 46db9786cd67 -r a99bd2570660 test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java --- a/test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java Fri Jan 18 13:49:45 2019 -0500 +++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/LinkChecker.java Fri Jan 18 11:26:30 2019 -0800 @@ -72,7 +72,7 @@ missingFiles.stream() .sorted() .forEach(this::reportMissingFile); - + errors += missingFiles.size(); } if (!allURIs.isEmpty()) {