diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java index de78ee052f6..a9ede57265a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java @@ -25,13 +25,14 @@ package jdk.javadoc.internal.doclets.formats.html; +import java.io.FileNotFoundException; import java.io.IOException; +import java.net.URL; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.InvalidPathException; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumSet; import java.util.HashMap; import java.util.List; @@ -61,6 +62,7 @@ import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder; import jdk.javadoc.internal.doclets.toolkit.util.NewAPIBuilder; import jdk.javadoc.internal.doclets.toolkit.util.PreviewAPIListBuilder; +import jdk.javadoc.internal.doclets.toolkit.util.ResourceIOException; /** * The class with "start" method, calls individual Writers. @@ -107,12 +109,6 @@ public class HtmlDoclet extends AbstractDoclet { */ private WriterFactory writerFactory; - /** - * Base path for resources for this doclet. - */ - private static final DocPath DOCLET_RESOURCES = DocPath - .create("/jdk/javadoc/internal/doclets/formats/html/resources"); - @Override // defined by Doclet public void init(Locale locale, Reporter reporter) { configuration = new HtmlConfiguration(initiatingDoclet, locale, reporter); @@ -232,13 +228,13 @@ public class HtmlDoclet extends AbstractDoclet { return; } boolean nodeprecated = options.noDeprecated(); - performCopy(options.helpFile(), DocPath.empty); - performCopy(options.stylesheetFile(), DocPath.empty); + copyFile(options.helpFile(), DocPath.empty); + copyFile(options.stylesheetFile(), DocPaths.RESOURCE_FILES); for (String stylesheet : options.additionalStylesheets()) { - performCopy(stylesheet, DocPath.empty); + copyFile(stylesheet, DocPaths.RESOURCE_FILES); } for (String script : options.additionalScripts()) { - performCopy(script, DocPaths.SCRIPT_DIR); + copyFile(script, DocPaths.SCRIPT_FILES); } // do early to reduce memory footprint if (options.classUse()) { @@ -304,31 +300,25 @@ public class HtmlDoclet extends AbstractDoclet { // If a stylesheet file is not specified, copy the default stylesheet // and replace newline with platform-specific newline. - DocFile f; if (options.stylesheetFile().length() == 0) { - f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); - f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), true, true); + copyResource(DocPaths.STYLESHEET, DocPaths.RESOURCE_FILES.resolve(DocPaths.STYLESHEET), true); } - f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); - f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); - f = DocFile.createFileForOutput(configuration, DocPaths.CLIPBOARD_SVG); - f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.CLIPBOARD_SVG), true, true); - f = DocFile.createFileForOutput(configuration, DocPaths.LINK_SVG); - f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.LINK_SVG), true, true); + copyResource(DocPaths.SCRIPT_JS, DocPaths.SCRIPT_FILES.resolve(DocPaths.SCRIPT_JS), true); + copyResource(DocPaths.CLIPBOARD_SVG, DocPaths.RESOURCE_FILES.resolve(DocPaths.CLIPBOARD_SVG), true); + copyResource(DocPaths.LINK_SVG, DocPaths.RESOURCE_FILES.resolve(DocPaths.LINK_SVG), true); + if (options.createIndex()) { - f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS); - f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_JS_TEMPLATE), configuration.docResources); - - f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_PAGE_JS); - f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_PAGE_JS), configuration.docResources); - - f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG)); - f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.GLASS_IMG), true, false); - - f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG)); - f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.X_IMG), true, false); - copyJqueryFiles(); - } + copyResource(DocPaths.SEARCH_JS_TEMPLATE, DocPaths.SCRIPT_FILES.resolve(DocPaths.SEARCH_JS), true); + copyResource(DocPaths.SEARCH_PAGE_JS, DocPaths.SCRIPT_FILES.resolve(DocPaths.SEARCH_PAGE_JS), true); + copyResource(DocPaths.GLASS_IMG, DocPaths.RESOURCE_FILES.resolve(DocPaths.GLASS_IMG), false); + copyResource(DocPaths.X_IMG, DocPaths.RESOURCE_FILES.resolve(DocPaths.X_IMG), false); + // No newline replacement for JQuery files + copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_JS), + DocPaths.SCRIPT_FILES.resolve(DocPaths.JQUERY_JS), false); + copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_UI_JS), + DocPaths.SCRIPT_FILES.resolve(DocPaths.JQUERY_UI_JS), false); + copyResource(DocPaths.JQUERY_DIR.resolve(DocPaths.JQUERY_UI_CSS), + DocPaths.RESOURCE_FILES.resolve(DocPaths.JQUERY_UI_CSS), false); } copyLegalFiles(options.createIndex()); } @@ -340,20 +330,6 @@ public class HtmlDoclet extends AbstractDoclet { if (configuration.tagletManager != null) { // may be null, if no files generated, perhaps because of errors configuration.tagletManager.printReport(); } - - } - - private void copyJqueryFiles() throws DocletException { - List files = Arrays.asList( - DocPaths.JQUERY_JS.getPath(), - DocPaths.JQUERY_UI_JS.getPath(), - DocPaths.JQUERY_UI_CSS.getPath()); - DocFile f; - for (String file : files) { - DocPath filePath = DocPaths.SCRIPT_DIR.resolve(file); - f = DocFile.createFileForOutput(configuration, filePath); - f.copyResource(DOCLET_RESOURCES.resolve(filePath), true, false); - } } private void copyLegalFiles(boolean includeJQuery) throws DocletException { @@ -444,7 +420,24 @@ public class HtmlDoclet extends AbstractDoclet { return configuration.getOptions().getSupportedOptions(); } - private void performCopy(String filename, DocPath targetPath) throws DocFileIOException { + private void copyResource(DocPath sourcePath, DocPath targetPath, boolean replaceNewLine) + throws DocletException { + DocPath resourcePath = DocPaths.RESOURCES.resolve(sourcePath); + // Resolve resources against doclets.formats.html package + URL resourceURL = HtmlConfiguration.class.getResource(resourcePath.getPath()); + if (resourceURL == null) { + throw new ResourceIOException(sourcePath, new FileNotFoundException(resourcePath.getPath())); + } + DocFile f = DocFile.createFileForOutput(configuration, targetPath); + + if (sourcePath.getPath().toLowerCase(Locale.ROOT).endsWith(".template")) { + f.copyResource(resourcePath, resourceURL, configuration.docResources); + } else { + f.copyResource(resourcePath, resourceURL, replaceNewLine); + } + } + + private void copyFile(String filename, DocPath targetPath) throws DocFileIOException { if (filename.isEmpty()) { return; } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index c9ee4b1a450..11e1d01f465 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -466,7 +466,6 @@ public abstract class HtmlDocletWriter { Content body) throws DocFileIOException { List additionalStylesheets = configuration.getAdditionalStylesheets(); - additionalStylesheets.addAll(localStylesheets); Head head = new Head(path, configuration.getDocletVersion(), configuration.getBuildDate()) .setTimestamp(!options.noTimestamp()) .setDescription(description) @@ -474,7 +473,7 @@ public abstract class HtmlDocletWriter { .setTitle(winTitle) .setCharset(options.charset()) .addKeywords(metakeywords) - .setStylesheets(configuration.getMainStylesheet(), additionalStylesheets) + .setStylesheets(configuration.getMainStylesheet(), additionalStylesheets, localStylesheets) .setAdditionalScripts(configuration.getAdditionalScripts()) .setIndex(options.createIndex(), mainBodyScript) .addContent(extraHeadContent); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java index 7ce0b639266..1837b6c5b2d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, 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 @@ -74,7 +74,7 @@ public class IndexRedirectWriter extends HtmlDocletWriter { .setTimestamp(!options.noTimestamp()) .setDescription("index redirect") .setGenerator(getGenerator(getClass())) - .setStylesheets(configuration.getMainStylesheet(), List.of()) // avoid reference to default stylesheet + .setStylesheets(configuration.getMainStylesheet(), List.of(), List.of()) .addDefaultScript(false); String title = (options.windowTitle().length() > 0) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java index 2e268101dd2..938895d0678 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, 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 @@ -96,7 +96,8 @@ public class SearchWriter extends HtmlDocletWriter { .setId(HtmlId.of("page-search-link"))) .add(new HtmlTree(TagName.BUTTON) .add(new HtmlTree(TagName.IMG) - .put(HtmlAttr.SRC, pathToRoot.resolve(DocPaths.CLIPBOARD_SVG).getPath()) + .put(HtmlAttr.SRC, pathToRoot.resolve(DocPaths.RESOURCE_FILES) + .resolve(DocPaths.CLIPBOARD_SVG).getPath()) .put(HtmlAttr.ALT, copyUrlText)) .add(HtmlTree.SPAN(Text.of(copyText)) .put(HtmlAttr.DATA_COPIED, copiedText)) @@ -114,6 +115,7 @@ public class SearchWriter extends HtmlDocletWriter { .addUnchecked(Text.EMPTY)) .setId(HtmlId.of("result-section")) .put(HtmlAttr.STYLE, "display: none;") - .add(HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.SEARCH_PAGE_JS).getPath()))); + .add(HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.SCRIPT_FILES) + .resolve(DocPaths.SEARCH_PAGE_JS).getPath()))); } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java index c01bc08b874..6f1381a70ca 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, 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 @@ -30,6 +30,7 @@ import jdk.javadoc.internal.doclets.formats.html.markup.Head; import java.io.IOException; import java.io.LineNumberReader; import java.io.Reader; +import java.util.List; import javax.lang.model.element.Element; import javax.lang.model.element.ModuleElement; @@ -232,43 +233,13 @@ public class SourceToHTMLConverter { .setDescription(HtmlDocletWriter.getDescription("source", te)) .setGenerator(HtmlDocletWriter.getGenerator(getClass())) .addDefaultScript(false) - .setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets()); + .setStylesheets(configuration.getMainStylesheet(), configuration.getAdditionalStylesheets(), List.of()); var html = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body); HtmlDocument document = new HtmlDocument(html); messages.notice("doclet.Generating_0", path.getPath()); document.write(DocFile.createFileForOutput(configuration, path)); } - /** - * Returns a link to the stylesheet file. - * - * @param head the content to which the stylesheet links will be added - */ - public void addStyleSheetProperties(Content head) { - String filename = options.stylesheetFile(); - DocPath stylesheet; - if (filename.length() > 0) { - DocFile file = DocFile.createFileForInput(configuration, filename); - stylesheet = DocPath.create(file.getName()); - } else { - stylesheet = DocPaths.STYLESHEET; - } - DocPath p = relativePath.resolve(stylesheet); - var link = HtmlTree.LINK("stylesheet", "text/css", p.getPath(), "Style"); - head.add(link); - addStylesheets(head); - } - - protected void addStylesheets(Content head) { - options.additionalStylesheets().forEach(css -> { - DocFile file = DocFile.createFileForInput(configuration, css); - DocPath cssPath = DocPath.create(file.getName()); - var slink = HtmlTree.LINK("stylesheet", "text/css", relativePath.resolve(cssPath).getPath(), - "Style"); - head.add(slink); - }); - } - /** * Get the header. * diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java index eeec1b182a4..7a11aedbb57 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2023, 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 @@ -55,6 +55,7 @@ public class Head extends Content { private boolean showTimestamp; private DocPath mainStylesheet; private List additionalStylesheets = List.of(); + private List localStylesheets = List.of(); private boolean index; private Script mainBodyScript; private final List - + + """); } diff --git a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java index 39788956f29..b6f802d8625 100644 --- a/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java +++ b/test/langtools/jdk/javadoc/doclet/testSearch/TestSearch.java @@ -135,7 +135,7 @@ public class TestSearch extends JavadocTester { "index-all.html", "allpackages-index.html", "allclasses-index.html", - "search-page.js", + "script-files/search-page.js", "search.html"); } @@ -179,7 +179,7 @@ public class TestSearch extends JavadocTester { "tag-search-index.js", "type-search-index.js", "index-all.html", - "search-page.js", + "script-files/search-page.js", "search.html"); } @@ -418,13 +418,13 @@ public class TestSearch extends JavadocTester { // Test for search related markup checkOutput(fileName, expectedOutput, """ - + """, """ - + """, """ - """, + """, """ var pathtoroot = "./"; loadScripts(document, 'script');""", @@ -690,29 +690,29 @@ public class TestSearch extends JavadocTester { void checkJqueryAndImageFiles(boolean expectedOutput) { checkFiles(expectedOutput, - "search.js", - "script-dir/jquery-3.6.1.min.js", - "script-dir/jquery-ui.min.js", - "script-dir/jquery-ui.min.css", - "resources/x.png", - "resources/glass.png"); + "script-files/search.js", + "script-files/jquery-3.6.1.min.js", + "script-files/jquery-ui.min.js", + "resource-files/jquery-ui.min.css", + "resource-files/x.png", + "resource-files/glass.png"); } void checkSearchJS() { // ensure all resource keys were resolved - checkOutput("search.js", false, + checkOutput("script-files/search.js", false, "##REPLACE:"); - checkOutput("search.js", true, + checkOutput("script-files/search.js", true, "function searchIndex(indexArray, category) {", "function getURLPrefix(item, category) {", "url += item.l;"); - checkOutput("search-page.js", true, + checkOutput("script-files/search-page.js", true, "function renderResults(result) {", "function selectTab(category) {"); - checkCssClasses("search.js", "stylesheet.css"); + checkCssClasses("script-files/search.js", "resource-files/stylesheet.css"); } void checkCssClasses(String jsFile, String cssFile) { diff --git a/test/langtools/jdk/javadoc/doclet/testSnippetTag/SnippetTester.java b/test/langtools/jdk/javadoc/doclet/testSnippetTag/SnippetTester.java index 0436fa894fb..48d4fb75fc2 100644 --- a/test/langtools/jdk/javadoc/doclet/testSnippetTag/SnippetTester.java +++ b/test/langtools/jdk/javadoc/doclet/testSnippetTag/SnippetTester.java @@ -115,7 +115,7 @@ public class SnippetTester extends JavadocTester { Optional id) { // the further away from the root, the further to reach to common resources int nComponents = (int) pathToHtmlFile.chars().filter(c -> c == '/').count(); - var svgString = "../".repeat(nComponents) + "copy.svg"; + var svgString = "../".repeat(nComponents) + "resource-files/copy.svg"; var idString = id.isEmpty() ? "" : " id=\"%s\"".formatted(id.get()); var langString = lang.isEmpty() ? "" : " class=\"language-%s\"".formatted(lang.get()); return """ diff --git a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java index 8c729c8d3ec..b4ceac438b2 100644 --- a/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java +++ b/test/langtools/jdk/javadoc/doclet/testStylesheet/TestStylesheet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2023, 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,7 +65,7 @@ public class TestStylesheet extends JavadocTester { // TODO: most of this test seems a bit silly, since javadoc is simply // copying in the stylesheet from the source directory - checkOutput("stylesheet.css", true, + checkOutput("resource-files/stylesheet.css", true, """ body { background-color:var(--body-background-color); @@ -141,7 +141,7 @@ public class TestStylesheet extends JavadocTester { overflow-x: auto; scrollbar-width: thin; }""", - "@import url('resources/fonts/dejavu.css');", + "@import url('fonts/dejavu.css');", """ .search-tag-result:target { background-color:var(--search-tag-highlight-color); @@ -175,7 +175,7 @@ public class TestStylesheet extends JavadocTester { """ #reset-button { background-color: transparent; - background-image:url('resources/x.png'); + background-image:url('x.png'); background-repeat:no-repeat; background-size:contain; border:0; @@ -197,7 +197,7 @@ public class TestStylesheet extends JavadocTester { // Test whether a link to the stylesheet file is inserted properly // in the class documentation. """ - """, + """, """
Test comment for a class which has an anchor_with_name and an anchor_with_id.
"""); @@ -211,9 +211,9 @@ public class TestStylesheet extends JavadocTester { checkOutput("index.html", true, """ - """); + """); - checkOutput("stylesheet.css", false, + checkOutput("resource-files/stylesheet.css", false, """ * { margin:0; @@ -275,7 +275,7 @@ public class TestStylesheet extends JavadocTester { Set readStylesheet() { // scan for class selectors, skipping '{' ... '}' Set styles = new TreeSet<>(); - String stylesheet = readFile("stylesheet.css"); + String stylesheet = readFile("resource-files/stylesheet.css"); for (int i = 0; i < stylesheet.length(); i++) { char ch = stylesheet.charAt(i); switch (ch) { diff --git a/test/langtools/jdk/javadoc/doclet/testStylesheetOverwrite/TestStylesheetOverwrite.java b/test/langtools/jdk/javadoc/doclet/testStylesheetOverwrite/TestStylesheetOverwrite.java index 55124e91b4e..7953834f62f 100644 --- a/test/langtools/jdk/javadoc/doclet/testStylesheetOverwrite/TestStylesheetOverwrite.java +++ b/test/langtools/jdk/javadoc/doclet/testStylesheetOverwrite/TestStylesheetOverwrite.java @@ -1,4 +1,4 @@ -/* * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. +/* * Copyright (c) 2018, 2023, 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,9 +58,10 @@ public class TestStylesheetOverwrite extends JavadocTester { createTestClass(srcDir); Path outDir = base.resolve("out"); + Path resourceDir = outDir.resolve("resource-files"); + Files.createDirectories(resourceDir); - Files.createDirectory(outDir); - Path stylesheet = outDir.resolve("stylesheet.css"); + Path stylesheet = resourceDir.resolve("stylesheet.css"); Files.createFile(stylesheet); Files.write(stylesheet, List.of("/* custom stylesheet */")); @@ -71,7 +72,7 @@ public class TestStylesheetOverwrite extends JavadocTester { "pkg"); checkExit(Exit.OK); - checkOutput("stylesheet.css", true, "Javadoc style sheet"); + checkOutput("resource-files/stylesheet.css", true, "Javadoc style sheet"); } void createTestClass(Path srcDir) throws Exception { diff --git a/test/langtools/jdk/javadoc/doclet/testTerminology/TestTerminology.java b/test/langtools/jdk/javadoc/doclet/testTerminology/TestTerminology.java index d29844000ae..6fca237cc88 100644 --- a/test/langtools/jdk/javadoc/doclet/testTerminology/TestTerminology.java +++ b/test/langtools/jdk/javadoc/doclet/testTerminology/TestTerminology.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, 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 @@ -141,11 +141,11 @@ public class TestTerminology extends JavadocTester { "p"); checkExit(Exit.OK); - checkOutput("search.js", sv.compareTo(SourceVersion.RELEASE_16) < 0, + checkOutput("script-files/search.js", sv.compareTo(SourceVersion.RELEASE_16) < 0, """ types: "Types",""" ); - checkOutput("search.js", sv.compareTo(SourceVersion.RELEASE_16) >= 0, + checkOutput("script-files/search.js", sv.compareTo(SourceVersion.RELEASE_16) >= 0, """ types: "Classes and Interfaces",""" ); diff --git a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java index 6ab0362b69e..7bc76b05064 100644 --- a/test/langtools/jdk/javadoc/tool/api/basic/APITest.java +++ b/test/langtools/jdk/javadoc/tool/api/basic/APITest.java @@ -196,17 +196,11 @@ class APITest { "allclasses-index.html", "allpackages-index.html", "constant-values.html", - "copy.svg", "deprecated-list.html", "help-doc.html", "index-all.html", "index.html", - "link.svg", - "script-dir/jquery-3.6.1.min.js", - "script-dir/jquery-ui.min.js", - "script-dir/jquery-ui.min.css", "search.html", - "search-page.js", "member-search-index.js", "module-search-index.js", "overview-tree.html", @@ -215,23 +209,32 @@ class APITest { "pkg/C.html", "pkg/package-summary.html", "pkg/package-tree.html", - "resources/glass.png", - "resources/x.png", - "script.js", - "search.js", - "stylesheet.css", + "resource-files/copy.svg", + "resource-files/glass.png", + "resource-files/jquery-ui.min.css", + "resource-files/link.svg", + "resource-files/stylesheet.css", + "resource-files/x.png", + "script-files/jquery-3.6.1.min.js", + "script-files/jquery-ui.min.js", + "script-files/script.js", + "script-files/search.js", + "script-files/search-page.js", "tag-search-index.js", "type-search-index.js" )); protected static Set noIndexFiles = standardExpectFiles.stream() - .filter(s -> !s.startsWith("script-dir") - && !s.startsWith("resources") - && !s.endsWith("-search-index.js") + .filter(s -> + !s.endsWith("-search-index.js") && !s.equals("index-all.html") - && !s.equals("search.js") + && !s.equals("resource-files/glass.png") + && !s.equals("resource-files/jquery-ui.min.css") + && !s.equals("resource-files/x.png") + && !s.startsWith("script-files/jquery-") + && !s.equals("script-files/search.js") + && !s.equals("script-files/search-page.js") && !s.equals("search.html") - && !s.equals("search-page.js") && !s.equals("allclasses-index.html") && !s.equals("allpackages-index.html") && !s.equals("system-properties.html"))