--- old/make/Docs.gmk 2018-02-02 13:16:21.431988415 -0800 +++ new/make/Docs.gmk 2018-02-02 13:16:21.015970197 -0800 @@ -200,7 +200,7 @@ # define setup_gengraph_dot_to_png $1_$2_DOT_SRC := $$($1_GENGRAPHS_DIR)/$2.dot - $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2-graph.png + $1_$2_PNG_TARGET := $$($1_TARGET_DIR)/$2/module-graph.png # For each module needing a graph, create a png file from the dot file # generated by the GenGraphs tool and store it in the target dir. --- old/make/jdk/src/classes/build/tools/taglet/ModuleGraph.java 2018-02-02 13:16:22.236023621 -0800 +++ new/make/jdk/src/classes/build/tools/taglet/ModuleGraph.java 2018-02-02 13:16:21.820005404 -0800 @@ -64,7 +64,7 @@ } String moduleName = ((ModuleElement) element).getQualifiedName().toString(); - String imageFile = moduleName + "-graph.png"; + String imageFile = moduleName + "/module-graph.png"; int thumbnailHeight = -1; String hoverImage = ""; if (!moduleName.equals("java.base")) { --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java 2018-02-02 13:16:22.988056551 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AnnotationTypeWriterImpl.java 2018-02-02 13:16:22.560037808 -0800 @@ -82,7 +82,7 @@ */ public AnnotationTypeWriterImpl(HtmlConfiguration configuration, TypeElement annotationType, TypeMirror prevType, TypeMirror nextType) { - super(configuration, DocPath.forClass(configuration.utils, annotationType)); + super(configuration, configuration.docPaths.forClass(annotationType)); this.annotationType = annotationType; configuration.currentTypeElement = annotationType; this.prev = prevType; --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java 2018-02-02 13:16:23.664086155 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java 2018-02-02 13:16:23.308070564 -0800 @@ -233,9 +233,9 @@ public static void generate(HtmlConfiguration configuration, ClassUseMapper mapper, TypeElement typeElement) throws DocFileIOException { ClassUseWriter clsgen; - DocPath path = DocPath.forPackage(configuration.utils, typeElement) + DocPath path = configuration.docPaths.forPackage(typeElement) .resolve(DocPaths.CLASS_USE) - .resolve(DocPath.forName(configuration.utils, typeElement)); + .resolve(configuration.docPaths.forName( typeElement)); clsgen = new ClassUseWriter(configuration, mapper, path, typeElement); clsgen.generateClassUseFile(); } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java 2018-02-02 13:16:24.460121011 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java 2018-02-02 13:16:24.040102619 -0800 @@ -92,7 +92,7 @@ */ public ClassWriterImpl(HtmlConfiguration configuration, TypeElement typeElement, TypeElement prevClass, TypeElement nextClass, ClassTree classTree) { - super(configuration, DocPath.forClass(configuration.utils, typeElement)); + super(configuration, configuration.docPaths.forClass(typeElement)); this.typeElement = typeElement; configuration.currentTypeElement = typeElement; this.classtree = classTree; --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java 2018-02-02 13:16:25.220154291 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java 2018-02-02 13:16:24.820136776 -0800 @@ -74,12 +74,18 @@ switch (element.getKind()) { case MODULE: - location = configuration.utils.getLocationForModule((ModuleElement)element); + ModuleElement mdle = (ModuleElement)element; + location = configuration.utils.getLocationForModule(mdle); source = DocPaths.DOC_FILES; break; case PACKAGE: - location = configuration.utils.getLocationForPackage((PackageElement)element); - source = DocPath.forPackage((PackageElement)element).resolve(DocPaths.DOC_FILES); + PackageElement pkg = (PackageElement)element; + location = configuration.utils.getLocationForPackage(pkg); + // Note, given that we have a module-specific location, + // we want a module-relative path for the source, and not the + // standard path that may include the module directory + source = DocPath.create(pkg.getQualifiedName().toString().replace('.', '/')) + .resolve(DocPaths.DOC_FILES); break; default: throw new AssertionError("unsupported element " + element); @@ -103,10 +109,10 @@ DocPath path = null; switch (this.element.getKind()) { case MODULE: - path = DocPath.forModule((ModuleElement)this.element); + path = DocPaths.forModule((ModuleElement)this.element); break; case PACKAGE: - path = DocPath.forPackage((PackageElement)this.element); + path = configuration.docPaths.forPackage((PackageElement)this.element); break; default: throw new AssertionError("unknown kind:" + this.element.getKind()); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java 2018-02-02 13:16:25.900184068 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java 2018-02-02 13:16:25.536168129 -0800 @@ -210,6 +210,12 @@ public HtmlVersion htmlVersion = null; /** + * Flag to enable/disable use of module directories when generating docs for modules + * Default: on (module directories are enabled). + */ + public boolean useModuleDirectories = true; + + /** * Collected set of doclint options */ public Map doclintOpts = new LinkedHashMap<>(); @@ -245,6 +251,8 @@ protected final Messages messages; + protected DocPaths docPaths; + /** * Creates an object to hold the configuration for a doclet. * @@ -357,6 +365,7 @@ } } } + docPaths = new DocPaths(utils, useModuleDirectories); setCreateOverview(); setTopFile(docEnv); workArounds.initDocLint(doclintOpts.values(), tagletManager.getCustomTagNames(), @@ -406,15 +415,15 @@ topFile = DocPaths.overviewSummary(frames); } else { if (showModules) { - topFile = DocPath.empty.resolve(DocPaths.moduleSummary(modules.first())); + topFile = DocPath.empty.resolve(docPaths.moduleSummary(modules.first())); } else if (packages.size() == 1 && packages.first().isUnnamed()) { List classes = new ArrayList<>(getIncludedTypeElements()); if (!classes.isEmpty()) { TypeElement te = getValidClass(classes); - topFile = DocPath.forClass(utils, te); + topFile = docPaths.forClass(te); } } else if (!packages.isEmpty()) { - topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY); + topFile = docPaths.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY); } } } @@ -837,6 +846,13 @@ } return true; } + }, + new XOption(resources, "--no-module-directories") { + @Override + public boolean process(String option, List args) { + useModuleDirectories = false; + return true; + } } }; Set oset = new TreeSet<>(); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java 2018-02-02 13:16:26.704219275 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java 2018-02-02 13:16:26.272200358 -0800 @@ -155,6 +155,8 @@ protected final Links links; + protected final DocPaths docPaths; + /** * To check whether annotation heading is printed or not. */ @@ -202,6 +204,7 @@ this.path = path; this.pathToRoot = path.parent().invert(); this.filename = path.basename(); + this.docPaths = configuration.docPaths; messages.notice("doclet.Generating_0", DocFile.createFileForOutput(configuration, path).getPath()); @@ -399,7 +402,7 @@ */ public Content getTargetModuleLink(String target, Content label, ModuleElement mdle) { return links.createLink(pathToRoot.resolve( - DocPaths.moduleSummary(mdle)), label, "", target); + docPaths.moduleSummary(mdle)), label, "", target); } /** @@ -949,7 +952,7 @@ * @param name File name, to which path string is. */ protected DocPath pathString(PackageElement packageElement, DocPath name) { - return pathToRoot.resolve(DocPath.forPackage(packageElement).resolve(name)); + return pathToRoot.resolve(docPaths.forPackage(packageElement).resolve(name)); } /** @@ -1021,7 +1024,7 @@ public Content getModuleLink(ModuleElement mdle, Content label) { boolean included = utils.isIncluded(mdle); return (included) - ? links.createLink(pathToRoot.resolve(DocPaths.moduleSummary(mdle)), label, "", "") + ? links.createLink(pathToRoot.resolve(docPaths.moduleSummary(mdle)), label, "", "") : label; } @@ -1050,7 +1053,7 @@ } DocPath href = pathToRoot .resolve(DocPaths.SOURCE_OUTPUT) - .resolve(DocPath.forClass(utils, te)); + .resolve(docPaths.forClass(te)); Content linkContent = links.createLink(href .fragment(SourceToHTMLConverter.getAnchorName(utils, typeElement)), label, "", ""); htmltree.addContent(linkContent); @@ -1139,7 +1142,7 @@ public DocLink getCrossModuleLink(String mdleName) { return configuration.extern.getExternalLink(mdleName, pathToRoot, - DocPaths.moduleSummary(mdleName).getPath()); + docPaths.moduleSummary(mdleName).getPath()); } /** @@ -1998,22 +2001,22 @@ DocPath redirectPathFromRoot = new SimpleElementVisitor9() { @Override public DocPath visitType(TypeElement e, Void p) { - return DocPath.forPackage(utils.containingPackage(e)); + return docPaths.forPackage(utils.containingPackage(e)); } @Override public DocPath visitPackage(PackageElement e, Void p) { - return DocPath.forPackage(e); + return docPaths.forPackage(e); } @Override public DocPath visitVariable(VariableElement e, Void p) { - return DocPath.forPackage(utils.containingPackage(e)); + return docPaths.forPackage(utils.containingPackage(e)); } @Override public DocPath visitExecutable(ExecutableElement e, Void p) { - return DocPath.forPackage(utils.containingPackage(e)); + return docPaths.forPackage(utils.containingPackage(e)); } @Override --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java 2018-02-02 13:16:27.536255709 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/LinkFactoryImpl.java 2018-02-02 13:16:27.112237142 -0800 @@ -35,8 +35,9 @@ import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.Content; +import jdk.javadoc.internal.doclets.toolkit.Resources; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; -import jdk.javadoc.internal.doclets.toolkit.util.Utils; +import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; import jdk.javadoc.internal.doclets.toolkit.util.links.LinkFactory; import jdk.javadoc.internal.doclets.toolkit.util.links.LinkInfo; @@ -53,9 +54,12 @@ public class LinkFactoryImpl extends LinkFactory { private final HtmlDocletWriter m_writer; + private final DocPaths docPaths; public LinkFactoryImpl(HtmlDocletWriter writer) { + super(writer.configuration.utils); m_writer = writer; + docPaths = writer.configuration.docPaths; } /** @@ -72,7 +76,6 @@ @Override protected Content getClassLink(LinkInfo linkInfo) { BaseConfiguration configuration = m_writer.configuration; - Utils utils = configuration.utils; LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty(); TypeElement typeElement = classLinkInfo.typeElement; @@ -84,14 +87,14 @@ utils.isTypeVariable(utils.getComponentType(classLinkInfo.type)); title = getClassToolTip(typeElement, isTypeLink); } - Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration); + Content label = classLinkInfo.getClassLinkLabel(configuration); Content link = new ContentBuilder(); if (utils.isIncluded(typeElement)) { if (configuration.isGeneratedDoc(typeElement)) { DocPath filename = getPath(classLinkInfo); if (linkInfo.linkToSelf || - !(DocPath.forName(utils, typeElement)).equals(m_writer.filename)) { + !(docPaths.forName(typeElement)).equals(m_writer.filename)) { link.addContent(m_writer.links.createLink( filename.fragment(classLinkInfo.where), label, @@ -140,7 +143,6 @@ @Override public Content getTypeAnnotationLinks(LinkInfo linkInfo) { - Utils utils = ((LinkInfoImpl)linkInfo).utils; ContentBuilder links = new ContentBuilder(); List annotations; if (utils.isAnnotated(linkInfo.type)) { @@ -191,22 +193,21 @@ * @return the tool tip for the appropriate class. */ private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) { - BaseConfiguration configuration = m_writer.configuration; - Utils utils = configuration.utils; + Resources resources = m_writer.configuration.getResources(); if (isTypeLink) { - return configuration.getText("doclet.Href_Type_Param_Title", + return resources.getText("doclet.Href_Type_Param_Title", utils.getSimpleName(typeElement)); } else if (utils.isInterface(typeElement)){ - return configuration.getText("doclet.Href_Interface_Title", + return resources.getText("doclet.Href_Interface_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else if (utils.isAnnotationType(typeElement)) { - return configuration.getText("doclet.Href_Annotation_Title", + return resources.getText("doclet.Href_Annotation_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else if (utils.isEnum(typeElement)) { - return configuration.getText("doclet.Href_Enum_Title", + return resources.getText("doclet.Href_Enum_Title", utils.getPackageName(utils.containingPackage(typeElement))); } else { - return configuration.getText("doclet.Href_Class_Title", + return resources.getText("doclet.Href_Class_Title", utils.getPackageName(utils.containingPackage(typeElement))); } } @@ -223,8 +224,8 @@ if (linkInfo.context == LinkInfoImpl.Kind.PACKAGE_FRAME) { //Not really necessary to do this but we want to be consistent //with 1.4.2 output. - return DocPath.forName(linkInfo.utils, linkInfo.typeElement); + return docPaths.forName(linkInfo.typeElement); } - return m_writer.pathToRoot.resolve(DocPath.forClass(linkInfo.utils, linkInfo.typeElement)); + return m_writer.pathToRoot.resolve(docPaths.forClass(linkInfo.typeElement)); } } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java 2018-02-02 13:16:28.224285836 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleFrameWriter.java 2018-02-02 13:16:27.872270422 -0800 @@ -76,7 +76,7 @@ * @param moduleElement moduleElement under consideration. */ public ModuleFrameWriter(HtmlConfiguration configuration, ModuleElement moduleElement) { - super(configuration, DocPaths.moduleTypeFrame(moduleElement)); + super(configuration, configuration.docPaths.moduleTypeFrame(moduleElement)); this.mdle = moduleElement; if (configuration.getSpecifiedPackageElements().isEmpty()) { documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator()); @@ -101,7 +101,7 @@ ? HtmlTree.MAIN() : body; Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, HtmlStyle.bar, - mdlgen.links.createLink(DocPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); + mdlgen.links.createLink(configuration.docPaths.moduleSummary(moduleElement), mdlLabel, "", "classFrame")); htmlTree.addContent(heading); HtmlTree div = new HtmlTree(HtmlTag.DIV); div.setStyle(HtmlStyle.indexContainer); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java 2018-02-02 13:16:29.152326473 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexFrameWriter.java 2018-02-02 13:16:28.788310534 -0800 @@ -114,9 +114,9 @@ } private Content getModuleFramesHyperLink(ModuleElement mdle, Content label, String target) { - DocLink mdlLink = new DocLink(DocPaths.moduleFrame(mdle)); - DocLink mtFrameLink = new DocLink(DocPaths.moduleTypeFrame(mdle)); - DocLink cFrameLink = new DocLink(DocPaths.moduleSummary(mdle)); + DocLink mdlLink = new DocLink(docPaths.moduleFrame(mdle)); + DocLink mtFrameLink = new DocLink(docPaths.moduleTypeFrame(mdle)); + DocLink cFrameLink = new DocLink(docPaths.moduleSummary(mdle)); HtmlTree anchor = HtmlTree.A(mdlLink.toString(), label); String onclickStr = "updateModuleFrame('" + mtFrameLink + "','" + cFrameLink + "');"; anchor.addAttr(HtmlAttr.TARGET, target); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java 2018-02-02 13:16:30.076366935 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModulePackageIndexFrameWriter.java 2018-02-02 13:16:29.728351696 -0800 @@ -76,7 +76,7 @@ * @param mdle the module being documented */ public static void generate(HtmlConfiguration configuration, ModuleElement mdle) throws DocFileIOException { - DocPath filename = DocPaths.moduleFrame(mdle); + DocPath filename = configuration.docPaths.moduleFrame(mdle); ModulePackageIndexFrameWriter modpackgen = new ModulePackageIndexFrameWriter(configuration, filename); modpackgen.buildModulePackagesIndexFile("doclet.Window_Overview", false, mdle); } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java 2018-02-02 13:16:30.732395661 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleWriterImpl.java 2018-02-02 13:16:30.384380422 -0800 @@ -192,7 +192,7 @@ */ public ModuleWriterImpl(HtmlConfiguration configuration, ModuleElement mdle, ModuleElement prevModule, ModuleElement nextModule) { - super(configuration, DocPaths.moduleSummary(mdle)); + super(configuration, configuration.docPaths.moduleSummary(mdle)); this.prevModule = prevModule; this.nextModule = nextModule; this.mdle = mdle; @@ -1056,7 +1056,7 @@ if (prevModule == null) { li = HtmlTree.LI(contents.prevModuleLabel); } else { - li = HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( + li = HtmlTree.LI(links.createLink(pathToRoot.resolve(docPaths.moduleSummary( prevModule)), contents.prevModuleLabel, "", "")); } return li; @@ -1073,7 +1073,7 @@ if (nextModule == null) { li = HtmlTree.LI(contents.nextModuleLabel); } else { - li = HtmlTree.LI(links.createLink(pathToRoot.resolve(DocPaths.moduleSummary( + li = HtmlTree.LI(links.createLink(pathToRoot.resolve(docPaths.moduleSummary( nextModule)), contents.nextModuleLabel, "", "")); } return li; --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java 2018-02-02 13:16:31.404425088 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageFrameWriter.java 2018-02-02 13:16:31.052409674 -0800 @@ -38,7 +38,6 @@ import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; -import jdk.javadoc.internal.doclets.toolkit.util.DocPath; import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; /** @@ -79,7 +78,8 @@ * @param packageElement PackageElement under consideration. */ public PackageFrameWriter(HtmlConfiguration configuration, PackageElement packageElement) { - super(configuration, DocPath.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME)); + super(configuration, + configuration.docPaths.forPackage(packageElement).resolve(DocPaths.PACKAGE_FRAME)); this.packageElement = packageElement; if (configuration.getSpecifiedPackageElements().isEmpty()) { documentedClasses = new TreeSet<>(utils.makeGeneralPurposeComparator()); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java 2018-02-02 13:16:32.060453814 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageTreeWriter.java 2018-02-02 13:16:31.712438575 -0800 @@ -103,7 +103,7 @@ PackageElement pkg, PackageElement prev, PackageElement next, boolean noDeprecated) throws DocFileIOException { - DocPath path = DocPath.forPackage(pkg).resolve(DocPaths.PACKAGE_TREE); + DocPath path = configuration.docPaths.forPackage(pkg).resolve(DocPaths.PACKAGE_TREE); PackageTreeWriter packgen = new PackageTreeWriter(configuration, path, pkg, prev, next); packgen.generatePackageTreeFile(); } @@ -192,7 +192,7 @@ if (prev == null) { return getNavLinkPrevious(null); } else { - DocPath path = DocPath.relativePath(packageElement, prev); + DocPath path = docPaths.relativePath(packageElement, prev); return getNavLinkPrevious(path.resolve(DocPaths.PACKAGE_TREE)); } } @@ -207,7 +207,7 @@ if (next == null) { return getNavLinkNext(null); } else { - DocPath path = DocPath.relativePath(packageElement, next); + DocPath path = docPaths.relativePath(packageElement, next); return getNavLinkNext(path.resolve(DocPaths.PACKAGE_TREE)); } } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java 2018-02-02 13:16:32.716482540 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageUseWriter.java 2018-02-02 13:16:32.368467301 -0800 @@ -75,7 +75,7 @@ public PackageUseWriter(HtmlConfiguration configuration, ClassUseMapper mapper, DocPath filename, PackageElement pkgElement) { - super(configuration, DocPath.forPackage(pkgElement).resolve(filename)); + super(configuration, configuration.docPaths.forPackage(pkgElement).resolve(filename)); this.packageElement = pkgElement; // by examining all classes in this package, find what packages @@ -221,7 +221,7 @@ .setColumnStyles(HtmlStyle.colFirst, HtmlStyle.colLast); for (TypeElement te : usingPackageToUsedClasses.get(packageName)) { DocPath dp = pathString(te, - DocPaths.CLASS_USE.resolve(DocPath.forName(utils, te))); + DocPaths.CLASS_USE.resolve(docPaths.forName(te))); Content stringContent = new StringContent(utils.getSimpleName(te)); Content typeContent = links.createLink(dp.fragment(getPackageAnchorName(usingPackage)), stringContent); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java 2018-02-02 13:16:33.372511266 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageWriterImpl.java 2018-02-02 13:16:33.028496203 -0800 @@ -105,8 +105,8 @@ */ public PackageWriterImpl(HtmlConfiguration configuration, PackageElement packageElement, PackageElement prev, PackageElement next) { - super(configuration, DocPath - .forPackage(packageElement) + super(configuration, + configuration.docPaths.forPackage(packageElement) .resolve(DocPaths.PACKAGE_SUMMARY)); this.prev = prev; this.next = next; @@ -402,7 +402,7 @@ if (prev == null) { li = HtmlTree.LI(contents.prevPackageLabel); } else { - DocPath p = DocPath.relativePath(packageElement, prev); + DocPath p = docPaths.relativePath(packageElement, prev); li = HtmlTree.LI(links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY), contents.prevPackageLabel, "", "")); } @@ -420,7 +420,7 @@ if (next == null) { li = HtmlTree.LI(contents.nextPackageLabel); } else { - DocPath p = DocPath.relativePath(packageElement, next); + DocPath p = docPaths.relativePath(packageElement, next); li = HtmlTree.LI(links.createLink(p.resolve(DocPaths.PACKAGE_SUMMARY), contents.nextPackageLabel, "", "")); } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java 2018-02-02 13:16:34.040540518 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java 2018-02-02 13:16:33.696525454 -0800 @@ -182,7 +182,7 @@ int lineno = 1; String line; relativePath = DocPaths.SOURCE_OUTPUT - .resolve(DocPath.forPackage(utils, te)) + .resolve(configuration.docPaths.forPackage(te)) .invert(); Content body = getHeader(); Content pre = new HtmlTree(HtmlTag.PRE); @@ -196,7 +196,7 @@ addBlankLines(pre); Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre); body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(div) : div); - writeToFile(body, outputdir.resolve(DocPath.forClass(utils, te))); + writeToFile(body, outputdir.resolve(configuration.docPaths.forClass(te))); } catch (IOException e) { String message = resources.getText("doclet.exception.read.file", fo.getName()); throw new SimpleDocletException(message, e); --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java 2018-02-02 13:16:34.696569244 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TagletWriterImpl.java 2018-02-02 13:16:34.348554005 -0800 @@ -112,17 +112,18 @@ SearchIndexItem si = new SearchIndexItem(); si.setLabel(tagText); si.setDescription(desc); + DocPaths docPaths = configuration.docPaths; new SimpleElementVisitor9() { @Override public Void visitModule(ModuleElement e, Void p) { - si.setUrl(DocPaths.moduleSummary(e).getPath() + "#" + anchorName); + si.setUrl(docPaths.moduleSummary(e).getPath() + "#" + anchorName); si.setHolder(utils.getFullyQualifiedName(element)); return null; } @Override public Void visitPackage(PackageElement e, Void p) { - si.setUrl(DocPath.forPackage(e).getPath() + si.setUrl(docPaths.forPackage(e).getPath() + "/" + DocPaths.PACKAGE_SUMMARY.getPath() + "#" + anchorName); si.setHolder(utils.getSimpleName(element)); return null; @@ -130,7 +131,7 @@ @Override public Void visitType(TypeElement e, Void p) { - si.setUrl(DocPath.forClass(utils, e).getPath() + "#" + anchorName); + si.setUrl(docPaths.forClass(e).getPath() + "#" + anchorName); si.setHolder(utils.getFullyQualifiedName(e)); return null; } @@ -138,7 +139,7 @@ @Override public Void visitVariable(VariableElement e, Void p) { TypeElement te = utils.getEnclosingTypeElement(e); - si.setUrl(DocPath.forClass(utils, te).getPath() + "#" + anchorName); + si.setUrl(docPaths.forClass(te).getPath() + "#" + anchorName); si.setHolder(utils.getFullyQualifiedName(e) + "." + utils.getSimpleName(e)); return null; } @@ -146,7 +147,7 @@ @Override protected Void defaultAction(Element e, Void p) { TypeElement te = utils.getEnclosingTypeElement(e); - si.setUrl(DocPath.forClass(utils, te).getPath() + "#" + anchorName); + si.setUrl(docPaths.forClass(te).getPath() + "#" + anchorName); si.setHolder(utils.getFullyQualifiedName(e)); return null; } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties 2018-02-02 13:16:35.376599021 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties 2018-02-02 13:16:35.028583782 -0800 @@ -280,6 +280,10 @@ doclet.usage.nodeprecatedlist.description=\ Do not generate deprecated list +doclet.usage.no-module-directories.description=\ + Do not group files for module documentation into \n\ + module-specific directories + doclet.usage.notree.description=\ Do not generate class hierarchy @@ -315,7 +319,7 @@ Charset for cross-platform viewing of generated documentation doclet.usage.javafx.description=\ - Enable javafx functionality + Enable JavaFX functionality doclet.usage.helpfile.parameters=\ --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java 2018-02-02 13:16:36.040628098 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseConfiguration.java 2018-02-02 13:16:35.688612683 -0800 @@ -65,8 +65,7 @@ /** * Configure the output based on the options. Doclets should sub-class * BaseConfiguration, to configure and add their own options. This class contains - * all user options which are supported by the 1.1 doclet and the standard - * doclet. + * all user options which are supported by the standard doclet. *

*

This is NOT part of any supported API. * If you write code that depends on this, you do so at your own risk. --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java 2018-02-02 13:16:36.712657524 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/ClassUseMapper.java 2018-02-02 13:16:36.364642285 -0800 @@ -46,7 +46,7 @@ import javax.lang.model.util.Types; import jdk.javadoc.doclet.DocletEnvironment; -import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; +import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberMap.Kind; /** @@ -192,7 +192,7 @@ private final Types typeUtils; private final Utils utils; - public ClassUseMapper(HtmlConfiguration configuration, ClassTree classtree) { + public ClassUseMapper(BaseConfiguration configuration, ClassTree classtree) { docEnv = configuration.docEnv; elementUtils = docEnv.getElementUtils(); typeUtils = docEnv.getTypeUtils(); @@ -414,11 +414,11 @@ } } - private List refList(Map> map, Element element) { + private List refList(Map> map, TypeElement element) { List list = map.get(element); if (list == null) { list = new ArrayList<>(); - map.put((TypeElement) element, list); + map.put(element, list); } return list; } @@ -570,7 +570,7 @@ @Override public Void visitPackage(PackageElement e, Void p) { for (AnnotationMirror a : e.getAnnotationMirrors()) { - refList(map, a.getAnnotationType().asElement()).add(holder); + refList(map, (TypeElement) a.getAnnotationType().asElement()).add(holder); } return null; } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java 2018-02-02 13:16:37.372686425 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPath.java 2018-02-02 13:16:37.024671187 -0800 @@ -61,94 +61,6 @@ return (p == null) || p.isEmpty() ? empty : new DocPath(p); } - /** - * Returns the path for a class. - * For example, if the class is java.lang.Object, - * the path is java/lang/Object.html. - * @param utils utility class for handling type elements - * @param typeElement the type element - * @return the path - */ - public static DocPath forClass(Utils utils, TypeElement typeElement) { - return (typeElement == null) - ? empty - : forPackage(utils.containingPackage(typeElement)).resolve(forName(utils, typeElement)); - } - - /** - * Returns the path for the simple name of a class. - * For example, if the class is java.lang.Object, - * the path is Object.html. - * @param utils utility class for handling type elements - * @param typeElement the type element - * @return the path - */ - public static DocPath forName(Utils utils, TypeElement typeElement) { - return (typeElement == null) ? empty : new DocPath(utils.getSimpleName(typeElement) + ".html"); - } - - /** - * Returns the path for the name of a module. - * For example, if the module is java.base, - * the path is java.base. - * @param mdle the module element - * @return the path - */ - public static DocPath forModule(ModuleElement mdle) { - return mdle == null || mdle.isUnnamed() - ? empty - : DocPath.create(mdle.getQualifiedName().toString()); - } - - /** - * Returns the path for the package of a class. - * For example, if the class is java.lang.Object, - * the path is java/lang. - * @param utils utility class for handling type elements - * @param typeElement the type element - * @return the path - */ - public static DocPath forPackage(Utils utils, TypeElement typeElement) { - return (typeElement == null) ? empty : forPackage(utils.containingPackage(typeElement)); - } - - /** - * Returns the path for a package. - * For example, if the package is java.lang, - * the path is java/lang. - * @param pkgElement the package element - * @return the path - */ - public static DocPath forPackage(PackageElement pkgElement) { - return pkgElement == null || pkgElement.isUnnamed() - ? empty - : DocPath.create(pkgElement.getQualifiedName().toString().replace('.', '/')); - } - - /** - * Returns the inverse path for a package. - * For example, if the package is java.lang, - * the inverse path is ../... - * @param pkgElement the package element - * @return the path - */ - public static DocPath forRoot(PackageElement pkgElement) { - String name = (pkgElement == null || pkgElement.isUnnamed()) - ? "" - : pkgElement.getQualifiedName().toString(); - return new DocPath(name.replace('.', '/').replaceAll("[^/]+", "..")); - } - - /** - * Returns the relative path from one package to another. - * @param from the initial package - * @param to the target package - * @return the path - */ - public static DocPath relativePath(PackageElement from, PackageElement to) { - return forRoot(from).resolve(forPackage(to)); - } - protected DocPath(String p) { path = (p.endsWith("/") ? p.substring(0, p.length() - 1) : p); } --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java 2018-02-02 13:16:38.040715677 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocPaths.java 2018-02-02 13:16:37.692700437 -0800 @@ -26,6 +26,8 @@ package jdk.javadoc.internal.doclets.toolkit.util; import javax.lang.model.element.ModuleElement; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; /** * Standard DocPath objects. @@ -37,6 +39,16 @@ * */ public class DocPaths { + private final boolean useModuleDirectories; + private final String moduleSeparator; + private final Utils utils; + + public DocPaths(Utils utils, boolean useModuleDirectories) { + this.utils = utils; + this.useModuleDirectories = useModuleDirectories; + moduleSeparator = useModuleDirectories ? "/module-" : "-"; + } + /** The name of the file for all classes, without using frames, when --no-frames is specified. */ public static final DocPath ALLCLASSES = DocPath.create("allclasses.html"); @@ -80,7 +92,11 @@ /** The name of the directory for the split index files. */ public static final DocPath INDEX_FILES = DocPath.create("index-files"); - /** Generate the name of one of the files in the split index. */ + /** + * Generate the name of one of the files in the split index. + * @param n the position in the index + * @return the path + */ public static DocPath indexN(int n) { return DocPath.create("index-" + n + ".html"); } @@ -173,29 +189,151 @@ /** The name of the file for the package usage info. */ public static final DocPath PACKAGE_USE = DocPath.create("package-use.html"); - /** The name of the output directory for module documentation files. */ - public static DocPath moduleDocFiles(ModuleElement mdle) { - return DocPath.create(mdle.getQualifiedName() + "-doc-files"); + /** + * Returns the path for a type element. + * For example, if the type element is {@code java.lang.Object}, + * the path is {@code java/lang/Object.html}. + * + * @param typeElement the type element + * @return the path + */ + public DocPath forClass(TypeElement typeElement) { + return (typeElement == null) + ? DocPath.empty + : forPackage(utils.containingPackage(typeElement)).resolve(forName(typeElement)); + } + + /** + * Returns the path for the simple name of a type element. + * For example, if the type element is {@code java.lang.Object}, + * the path is {@code Object.html}. + * + * @param typeElement the type element + * @return the path + */ + public DocPath forName(TypeElement typeElement) { + return (typeElement == null) + ? DocPath.empty + : new DocPath(utils.getSimpleName(typeElement) + ".html"); + } + + public static DocPath forModule(ModuleElement mdle) { + return mdle == null || mdle.isUnnamed() + ? DocPath.empty + : DocPath.create(mdle.getQualifiedName().toString()); + } + + /** + * Returns the path for the package of a type element. + * For example, if the type element is {@code java.lang.Object}, + * the path is {@code java/lang}. + * + * @param typeElement the type element + * @return the path + */ + public DocPath forPackage(TypeElement typeElement) { + return (typeElement == null) ? DocPath.empty : forPackage(utils.containingPackage(typeElement)); + } + + /** + * Returns the path for a package. + * For example, if the package is {@code java.lang}, + * the path is {@code java/lang}. + * + * @param pkgElement the package element + * @return the path + */ + public DocPath forPackage(PackageElement pkgElement) { + if (pkgElement == null || pkgElement.isUnnamed()) { + return DocPath.empty; + } + + DocPath pkgPath = DocPath.create(pkgElement.getQualifiedName().toString().replace('.', '/')); + if (useModuleDirectories) { + ModuleElement mdle = (ModuleElement) pkgElement.getEnclosingElement(); + return forModule(mdle).resolve(pkgPath); + } else { + return pkgPath; + } + } + + /** + * Returns the inverse path for a package. + * For example, if the package is {@code java.lang}, + * the inverse path is {@code ../..}. + * + * @param pkgElement the package element + * @return the path + */ + public static DocPath forRoot(PackageElement pkgElement) { + String name = (pkgElement == null || pkgElement.isUnnamed()) + ? "" + : pkgElement.getQualifiedName().toString(); + return new DocPath(name.replace('.', '/').replaceAll("[^/]+", "..")); + } + + /** + * Returns a relative path from one package to another. + * + * @param from the origin of the relative path + * @param to the destination of the relative path + * @return the path + */ + public DocPath relativePath(PackageElement from, PackageElement to) { + return forRoot(from).resolve(forPackage(to)); + } + + /** + * The path for the output directory for module documentation files. + * @param mdle the module + * @return the path + */ + public DocPath moduleDocFiles(ModuleElement mdle) { + return createModulePath(mdle, "doc-files"); + } + + /** + * The path for the file for a module's frame page. + * @param mdle the module + * @return the path + */ + public DocPath moduleFrame(ModuleElement mdle) { + return createModulePath(mdle, "frame.html"); + } + + /** + * The path for the file for a module's summary page. + * @param mdle the module + * @return the path + */ + public DocPath moduleSummary(ModuleElement mdle) { + return createModulePath(mdle, "summary.html"); } - /** The name of the file for the module frame. */ - public static DocPath moduleFrame(ModuleElement mdle) { - return DocPath.create(mdle.getQualifiedName() + "-frame.html"); + /** + * The path for the file for a module's summary page. + * @param mdleName the module + * @return the path + */ + public DocPath moduleSummary(String mdleName) { + return createModulePath(mdleName, "summary.html"); } - /** The name of the file for the module summary. */ - public static DocPath moduleSummary(ModuleElement mdle) { - return DocPaths.moduleSummary(mdle.getQualifiedName().toString()); + /** + * The path for the file for a module's type frame page. + * @param mdle the module + * @return the path + */ + public DocPath moduleTypeFrame(ModuleElement mdle) { + return createModulePath(mdle, "type-frame.html"); } - /** The name of the file for the module summary. */ - public static DocPath moduleSummary(String mdleName) { - return DocPath.create(mdleName + "-summary.html"); + private DocPath createModulePath(ModuleElement mdle, String path) { + return DocPath.create(mdle.getQualifiedName() + moduleSeparator + path); } - /** The name of the file for the module frame. */ - public static DocPath moduleTypeFrame(ModuleElement mdle) { - return DocPath.create(mdle.getQualifiedName() + "-type-frame.html"); + private DocPath createModulePath(String moduleName, String path) { + return DocPath.create(moduleName + moduleSeparator + path); } /** The name of the file for the module overview frame. */ --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java 2018-02-02 13:16:38.720745454 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java 2018-02-02 13:16:38.368730040 -0800 @@ -82,7 +82,6 @@ import com.sun.source.util.SimpleDocTreeVisitor; import com.sun.source.util.TreePath; import com.sun.tools.javac.model.JavacTypes; -import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.CommentUtils.DocCommentDuo; import jdk.javadoc.internal.doclets.toolkit.Messages; --- old/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java 2018-02-02 13:16:39.412775756 -0800 +++ new/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/links/LinkFactory.java 2018-02-02 13:16:39.064760518 -0800 @@ -28,7 +28,6 @@ import java.util.ArrayList; import java.util.List; -import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeParameterElement; @@ -39,7 +38,6 @@ import javax.lang.model.type.WildcardType; import javax.lang.model.util.SimpleTypeVisitor9; -import jdk.javadoc.internal.doclets.formats.html.LinkInfoImpl; import jdk.javadoc.internal.doclets.toolkit.Content; import jdk.javadoc.internal.doclets.toolkit.util.Utils; @@ -54,6 +52,11 @@ * @author Jamie Ho */ public abstract class LinkFactory { + protected final Utils utils; + + protected LinkFactory(Utils utils) { + this.utils = utils; + } /** * Return an empty instance of a content object. @@ -69,7 +72,6 @@ * @return the output of the link. */ public Content getLink(LinkInfo linkInfo) { - Utils utils = ((LinkInfoImpl) linkInfo).configuration.utils; if (linkInfo.type != null) { SimpleTypeVisitor9 linkVisitor = new SimpleTypeVisitor9() { @@ -207,26 +209,27 @@ } /** - * Return the link to the given class. + * Returns a link to the given class. * - * @param linkInfo the information about the link to construct. + * @param linkInfo the information about the link to construct * * @return the link for the given class. */ protected abstract Content getClassLink(LinkInfo linkInfo); /** - * Return the link to the given type parameter. + * Returns a link to the given type parameter. * - * @param linkInfo the information about the link to construct. - * @param typeParam the type parameter to link to. + * @param linkInfo the information about the link to construct + * @param typeParam the type parameter to link to + * @return the link */ protected abstract Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam); /** - * Return the links to the type parameters. + * Returns links to the type parameters. * - * @param linkInfo the information about the link to construct. + * @param linkInfo the information about the link to construct * @return the links to the type parameters. */ public Content getTypeParameterLinks(LinkInfo linkInfo) { @@ -234,15 +237,14 @@ } /** - * Return the links to the type parameters. + * Returns links to the type parameters. * - * @param linkInfo the information about the link to construct. - * @param isClassLabel true if this is a class label. False if it is - * the type parameters portion of the link. - * @return the links to the type parameters. + * @param linkInfo the information about the link to construct + * @param isClassLabel true if this is a class label, or false if it is + * the type parameters portion of the link + * @return the links to the type parameters */ public Content getTypeParameterLinks(LinkInfo linkInfo, boolean isClassLabel) { - Utils utils = ((LinkInfoImpl)linkInfo).utils; Content links = newContent(); List vars = new ArrayList<>(); TypeMirror ctype = linkInfo.type != null --- old/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java 2018-02-02 13:16:40.084805182 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testCopyFiles/TestCopyFiles.java 2018-02-02 13:16:39.724789418 -0800 @@ -49,26 +49,26 @@ "--module-source-path", testSrc("modules"), "--module", "acme.mdle"); checkExit(Exit.OK); - checkOrder("p/doc-files/inpackage.html", + checkOrder("acme.mdle/p/doc-files/inpackage.html", "\"Hello World\" (phi-WINDOW-TITLE-phi)", "phi-TOP-phi", // check top navbar - "Module", + "Module", "Package", - "Tree", - "Deprecated", - "Index", + "Tree", + "Deprecated", + "Index", "phi-HEADER-phi", "In a named module acme.module and named package " + "p.", "\"simpleTagLabel\">Since:Module", + "Module", "Package", - "Tree", - "Deprecated", - "Index", + "Tree", + "Deprecated", + "Index", "phi-FOOTER-phi", "phi-BOTTOM-phi" ); @@ -86,52 +86,53 @@ "--module-source-path", testSrc("modules"), "--module", "acme.mdle,acme2.mdle"); checkExit(Exit.OK); - checkOrder("p/doc-files/inpackage.html", + checkOrder("acme.mdle/p/doc-files/inpackage.html", "\"Hello World\" (phi-WINDOW-TITLE-phi)", "phi-TOP-phi", // check top navbar - "Module", + "Module", "Package", - "Tree", - "Deprecated", - "Index", + "Tree", + "Deprecated", + "Index", "phi-HEADER-phi", "In a named module acme.module and named package " + "p.", "\"simpleTagLabel\">Since:Module", + "Module", "Package", - "Tree", - "Deprecated", - "Index", + "Tree", + "Deprecated", + "Index", "phi-FOOTER-phi", "phi-BOTTOM-phi" ); // check the bottom most doc file - checkOrder("p2/doc-files/sub-dir/sub-dir-1/SubSubReadme.html", + checkOrder("acme2.mdle/p2/doc-files/sub-dir/sub-dir-1/SubSubReadme.html", "SubSubReadme (phi-WINDOW-TITLE-phi)", "phi-TOP-phi", // check top navbar - "Module", + "Module", "Package", - "Tree", - "Deprecated", - "Index", + "Tree", + "Deprecated", + "Index", "phi-HEADER-phi", "SubSubReadme.html at third level of doc-file directory.", // check bottom navbar - "Module", + "Module", "Package", - "Tree", - "Deprecated", - "Index", + "Tree", + "Deprecated", + "Index", "phi-FOOTER-phi", "phi-BOTTOM-phi" ); } + @Test void testDocFilesInModulePackagesWithRecursiveCopy() { javadoc("-d", "modules-out-recursive", @@ -139,7 +140,7 @@ "--module-source-path", testSrc("modules"), "--module", "acme.mdle"); checkExit(Exit.OK); - checkOutput("p/doc-files/inpackage.html", true, + checkOutput("acme.mdle/p/doc-files/inpackage.html", true, "In a named module acme.module and named package " + "p." ); @@ -153,7 +154,7 @@ "--module-source-path", testSrc("modules"), "--module", "acme.mdle"); checkExit(Exit.OK); - checkOutput("p/doc-files/inpackage.html", true, + checkOutput("acme.mdle/p/doc-files/inpackage.html", true, "In a named module acme.module and named package " + "p." ); --- old/test/langtools/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java 2018-02-02 13:16:40.756834609 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java 2018-02-02 13:16:40.388818494 -0800 @@ -301,18 +301,18 @@ private void checkFrameFiles() { // these files are all only generated in frames mode - // -frame.html and -type-frame.html files + // /module-frame.html and /module-type-frame.html files checkFiles(frames, classes.stream() .filter(c -> isInModule(c)) .map(c -> modulePart(c)) .flatMap(m -> Arrays.asList( - m + "-frame.html", - m + "-type-frame.html").stream()) + m + "/module-frame.html", + m + "/module-type-frame.html").stream()) .collect(Collectors.toSet())); // /package-frame.html files checkFiles(frames, classes.stream() - .map(c -> packagePart(c) + "/package-frame.html") + .map(c -> (isInModule(c) ? (modulePart(c) + "/") : "") + packagePart(c) + "/package-frame.html") .collect(Collectors.toSet())); } @@ -360,7 +360,7 @@ // contain FRAMES/NO-FRAMES links in frames mode List navbarFiles = new ArrayList<>(); navbarFiles.addAll(classes.stream() - .map(c -> toHtml(packageClassPart(c))) + .map(c -> (isInModule(c) ? (modulePart(c) + "/") : "") + toHtml(packageClassPart(c))) .collect(Collectors.toSet())); for (String f : navbarFiles) { checkOutput(f, frames, --- old/test/langtools/jdk/javadoc/doclet/testModules/TestEmptyModule.java 2018-02-02 13:16:41.420863685 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModules/TestEmptyModule.java 2018-02-02 13:16:41.060847921 -0800 @@ -64,7 +64,7 @@ "--module", "empty"); checkExit(Exit.OK); - checkOutput("empty-summary.html", true, + checkOutput("empty/module-summary.html", true, "module empty."); } --- old/test/langtools/jdk/javadoc/doclet/testModules/TestIndirectExportsOpens.java 2018-02-02 13:16:42.076892412 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModules/TestIndirectExportsOpens.java 2018-02-02 13:16:41.720876822 -0800 @@ -156,15 +156,15 @@ // In details mode all kinds of packages from java.base, // could be listed in the indirects section, so just // check for minimal expected strings. - checkOutput("a-summary.html", true, + checkOutput("a/module-summary.html", true, "Indirect Exports table", - "m\n" - + "exportsto\n" + "m\n" + + "exportsto\n" + "\n"); - checkOutput("a-summary.html", true, + checkOutput("a/module-summary.html", true, "Indirect Opens table", - "m\n" + "m\n" + "opensto\n" + "\n"); } @@ -183,11 +183,11 @@ // Avoid false positives, just check for primary string absence. if (!present) { - checkOutput("a-summary.html", false, typeString); + checkOutput("a/module-summary.html", false, typeString); return; } - checkOutput("a-summary.html", present, + checkOutput("a/module-summary.html", present, "\n" + "\n" + "\n" @@ -196,8 +196,8 @@ + "\n" + "\n" + "\n" - + "\n" - + "\n" + + "\n" + + "\n" + "\n" + "\n" + "
" + typeString + " 
mpmmpm
\n"); --- old/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java 2018-02-02 13:16:42.728920962 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModules/TestModulePackages.java 2018-02-02 13:16:42.372905373 -0800 @@ -70,7 +70,7 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", false, + checkOutput("m/module-summary.html", false, "

Packages

\n" + ""); @@ -159,7 +159,7 @@ checkTableHead("m", ColKind.EXPORTED_TO); checkPackageRow("m", "p", "i0", "All Modules", null, " "); checkPackageRow("m", "q", "i1", - "other", null, " "); + "other", null, " "); } @Test @@ -247,11 +247,11 @@ checkPackageRow("m", "c", "i0", "None", "None", " "); checkPackageRow("m", "e.all", "i1", "All Modules", "None", " "); checkPackageRow("m", "e.other", "i2", - "other", "None", " "); + "other", "None", " "); checkPackageRow("m", "eo", "i3", "All Modules", "All Modules", " "); checkPackageRow("m", "o.all", "i4", "None", "All Modules", " "); checkPackageRow("m", "o.other", "i5", "None", - "other", " "); + "other", " "); } @Test @@ -367,7 +367,7 @@ checkTableHead("m", ColKind.OPENED_TO); checkPackageRow("m", "p", "i0", null, "All Modules", " "); checkPackageRow("m", "q", "i1", null, - "other", " "); + "other", " "); } @Test @@ -443,7 +443,7 @@ + ""; } - checkOutput(moduleName + "-summary.html", true, expect); + checkOutput(moduleName + "/module-summary.html", true, expect); } @@ -461,7 +461,7 @@ sb.append("\n" + ""); - checkOutput(moduleName + "-summary.html", true, sb.toString()); + checkOutput(moduleName + "/module-summary.html", true, sb.toString()); } private void checkPackageRow(String moduleName, String packageName, @@ -481,7 +481,7 @@ } sb.append(""); - checkOutput(moduleName + "-summary.html", true, sb.toString()); + checkOutput(moduleName + "/module-summary.html", true, sb.toString()); } } --- old/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java 2018-02-02 13:16:43.384949688 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServices.java 2018-02-02 13:16:43.024933924 -0800 @@ -124,31 +124,31 @@ "moduleServiceUserNoDescription/pkgServiceUserNoDescription"); checkExit(Exit.OK); - checkOutput("moduleServiceProvider-summary.html", true, + checkOutput("moduleServiceProvider/module-summary.html", true, "\n" - + "\n" + "\n" + ""); - checkOutput("moduleServiceUser-summary.html", true, + checkOutput("moduleServiceUser/module-summary.html", true, "\n" - + "\n" + + "\n" + "\n" + ""); - checkOutput("moduleServiceUserNoDescription-summary.html", true, + checkOutput("moduleServiceUserNoDescription/module-summary.html", true, "\n" - + "\n" + + "\n" + "\n" + ""); - checkOutput("moduleServiceProvider-summary.html", false, + checkOutput("moduleServiceProvider/module-summary.html", false, "A service Interface for service providers."); - checkOutput("moduleServiceUser-summary.html", false, + checkOutput("moduleServiceUser/module-summary.html", false, "A service Interface for service providers."); } @@ -169,7 +169,7 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", false, + checkOutput("m/module-summary.html", false, "

Services

"); } @@ -190,10 +190,10 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "

Services

"); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "
Description
" + desc + "
Service\n" + "
Provides a service whose name is ServiceProvider.
\n" + "
ServiceService\n" + "
If no other provider is found, a default internal implementation will be used.
\n" + "
ServiceService\n" + "
A service Interface for service providers.
\n" + "
\n" + "\n" + "\n" + @@ -230,10 +230,10 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "

Services

"); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "
Uses 
\n" + "\n" + "\n" + @@ -270,7 +270,7 @@ checkExit(Exit.OK); - checkOutput("m-summary.html", false, + checkOutput("m/module-summary.html", false, "

Services

"); } @@ -296,10 +296,10 @@ checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "

Services

"); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "
Uses 
\n" + "\n" + "\n" + @@ -339,10 +339,10 @@ checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "

Services

"); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "
Provides 
\n" + "\n" + "\n" + @@ -381,10 +381,10 @@ checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "

Services

"); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "
Provides 
\n" + "\n" + "\n" + --- old/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServicesLink.java 2018-02-02 13:16:44.060979290 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModules/TestModuleServicesLink.java 2018-02-02 13:16:43.700963525 -0800 @@ -68,7 +68,7 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "Description |" + " Modules |" + " Packages |" @@ -92,7 +92,7 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "Description |" + " Modules |" + " Packages |" @@ -114,7 +114,7 @@ "--module", "m"); checkExit(Exit.OK); - checkOutput("m-summary.html", true, + checkOutput("m/module-summary.html", true, "Description | Modules |" + " Packages |" + " Services"); --- old/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java 2018-02-02 13:16:44.721008191 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java 2018-02-02 13:16:44.360992426 -0800 @@ -444,14 +444,14 @@ } void checkDescription(boolean found) { - checkOutput("moduleA-summary.html", found, + checkOutput("moduleA/module-summary.html", found, "\n" + "\n" + "\n" + "\n" + "
This is a test description for the moduleA module with a Search " + "phrase search phrase.
"); - checkOutput("moduleB-summary.html", found, + checkOutput("moduleB/module-summary.html", found, "\n" + "\n" + "\n" @@ -478,14 +478,14 @@ } void checkNoDescription(boolean found) { - checkOutput("moduleA-summary.html", found, + checkOutput("moduleA/module-summary.html", found, "
\n" + "
\n" + "\n" - + "\n" + + "\n" + "\n" + ""); - checkOutput("moduleB-summary.html", true, + checkOutput("moduleB/module-summary.html", true, "
  • Description | Modules | " + "Packages | " + "Services
  • ", @@ -785,7 +785,7 @@ } void checkAggregatorModuleSummary() { - checkOutput("moduleT-summary.html", true, + checkOutput("moduleT/module-summary.html", true, "
    \n" + "

    Module moduleT

    \n" + "
    ", @@ -795,7 +795,7 @@ "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n" - + "\n" + + "\n" + "\n" @@ -812,7 +812,7 @@ } void checkNegatedModuleSummary() { - checkOutput("moduleA-summary.html", false, + checkOutput("moduleA/module-summary.html", false, "\n" + "\n" + "\n" @@ -821,11 +821,11 @@ void checkModuleClickThroughLinks() { checkOutput("module-overview-frame.html", true, - "
  • moduleA
  • ", - "
  • moduleB
  • "); checkOutput("script.js", true, "function updateModuleFrame(pFrame, cFrame)\n" @@ -837,37 +837,37 @@ void checkModuleClickThrough(boolean found) { checkFiles(found, - "moduleA-type-frame.html", - "moduleB-type-frame.html"); + "moduleA/module-type-frame.html", + "moduleB/module-type-frame.html"); } void checkModuleFilesAndLinks(boolean found) { - checkFileAndOutput("testpkgmdlA/package-summary.html", found, - "
  • Module
  • ", + checkFileAndOutput("moduleA/testpkgmdlA/package-summary.html", found, + "
  • Module
  • ", "
    Module " - + "moduleA
    "); - checkFileAndOutput("testpkgmdlA/TestClassInModuleA.html", found, - "
  • Module
  • ", + + "moduleA"); + checkFileAndOutput("moduleA/testpkgmdlA/TestClassInModuleA.html", found, + "
  • Module
  • ", "
    Module " - + "moduleA
    "); - checkFileAndOutput("testpkgmdlB/AnnotationType.html", found, + + "moduleA"); + checkFileAndOutput("moduleB/testpkgmdlB/AnnotationType.html", found, "
    Module " - + "moduleB
    ", + + "moduleB", "
    " + "Package testpkgmdlB
    "); checkFiles(found, - "moduleA-frame.html", - "moduleA-summary.html", + "moduleA/module-frame.html", + "moduleA/module-summary.html", "module-overview-frame.html"); } void checkModuleFrameFiles(boolean found) { checkFiles(found, - "moduleC-frame.html", - "moduleC-type-frame.html", + "moduleC/module-frame.html", + "moduleC/module-type-frame.html", "module-overview-frame.html"); checkFiles(true, - "moduleC-summary.html", + "moduleC/module-summary.html", "allclasses-frame.html", "allclasses-noframe.html"); } @@ -880,74 +880,74 @@ void checkModulesInSearch(boolean found) { checkOutput("index-all.html", found, "
    \n" - + "
    moduleA - module moduleA
    \n" + + "
    moduleA - module moduleA
    \n" + "
    \n" + "
    This is a test description for the moduleA module with a Search " + "phrase search phrase.
    \n" + "
    \n" - + "
    moduleB - module moduleB
    \n" + + "
    moduleB - module moduleB
    \n" + "
    \n" + "
    This is a test description for the moduleB module.
    \n" + "
    \n" + "
    ", "
    \n" - + "
    " + + "
    " + "search phrase - Search tag in moduleA
    \n" + "
    with description
    \n" - + "
    " + + "
    " + "search_word - Search tag in moduleB
    \n" + "
     
    \n" + "
    "); checkOutput("index-all.html", false, - "
    " + "
    " + "search phrase - Search tag in moduleA
    \n" + "
    with description
    \n" - + "
    " + + "
    " + "search phrase - Search tag in moduleA
    \n" + "
    with description
    "); } void checkModuleModeCommon() { checkOutput("overview-summary.html", true, - "\n" + "\n" + "", - "\n" + "\n" + "", - "\n" + "\n" + ""); - checkOutput("moduleA-summary.html", true, + checkOutput("moduleA/module-summary.html", true, "
  • Description | " + "Modules | Packages | Services
  • ", - "\n" - + "\n"); - checkOutput("moduleB-summary.html", true, + "\n" + + "\n"); + checkOutput("moduleB/module-summary.html", true, "\n" + "\n"); - checkOutput("moduletags-summary.html", true, + checkOutput("moduletags/module-summary.html", true, "
  • Description | Modules" + " | Packages | Services
  • ", "
    Provides 
    transitivemoduleBmoduleB\n" + "
    This is a test description for the moduleB module.
    \n" + "
    transitivemoduleAmoduleA\n" + "
    This is a test description for the moduleA module with a Search " + "phrase search phrase.
    \n" @@ -803,7 +803,7 @@ + "
    transitivemoduleBmoduleB\n" + "
    This is a test description for the moduleB module.
    \n" + "
    moduleAmoduleA\n" + "
    This is a test description for the moduleA module with a Search " + "phrase search phrase.
    \n" + "
    moduleBmoduleB\n" + "
    This is a test description for the moduleB module.
    \n" + "
    moduletagsmoduletags\n" + "
    This is a test description for the moduletags module.
    \n" - + " Type Link: TestClassInModuleTags.
    \n" - + " Member Link: testMethod(String).
    \n" - + " Package Link: testpkgmdltags.
    \n" + + " Type Link: TestClassInModuleTags.
    \n" + + " Member Link: testMethod(String).
    \n" + + " Package Link: testpkgmdltags.
    \n" + "
    moduleBtestpkgmdlBmoduleBtestpkgmdlBTestClassInModuleB\n" + "
    With a test description for uses.
    \n
    \n" + "", "\n" - + "\n" + + "\n" + "", "
    Indirect Requires 
    transitivemoduleBmoduleB\n" + "
    This is a test description for the moduleB module.
    \n" + "
    \n" + "", "\n" - + "\n" + + "\n" + "\n" + "\n" + "\n", - "\n" - + "\n"); + "\n" + + "\n"); } void checkModuleModeApi(boolean found) { - checkOutput("moduleA-summary.html", found, + checkOutput("moduleA/module-summary.html", found, "\n" + ""); - checkOutput("moduleB-summary.html", found, + checkOutput("moduleB/module-summary.html", found, "
  • Description | Modules | " + "Packages | Services
  • ", "\n" @@ -996,23 +996,23 @@ + "\n" + "\n" + "
    Indirect Exports 
    transitive staticmoduleAmoduleA\n" + "
    This is a test description for the moduleA module with a Search " + "phrase search phrase.
    \n" @@ -970,15 +970,15 @@ + "
    FromPackages
    moduleBtestpkgmdlBmoduleBtestpkgmdlBtestpkgmdlA testpkgmdlB
    "); - checkOutput("moduletags-summary.html", true, + checkOutput("moduletags/module-summary.html", true, "testpkgmdltags\n" + " "); } void checkModuleModeAll(boolean found) { - checkOutput("moduleA-summary.html", found, + checkOutput("moduleA/module-summary.html", found, " \n" + "java.base\n" + " ", " \n" - + "moduleC\n" + + "moduleC\n" + "\n" + "
    This is a test description for the moduleC module.
    \n" + "", - "moduleC\n" - + "testpkgmdlC", + "moduleC\n" + + "testpkgmdlC", "testpkgmdlA\n" + "All Modules\n" + " ", @@ -1023,7 +1023,7 @@ "concealedpkgmdlA\n" + "None\n" + " "); - checkOutput("moduleB-summary.html", found, + checkOutput("moduleB/module-summary.html", found, "
  • Description | " + "Modules | Packages | Services
  • ", "testpkgmdlB\n" @@ -1044,20 +1044,20 @@ "All Packages " + "Exports " + "Opens "); - checkOutput("moduleC-summary.html", found, + checkOutput("moduleC/module-summary.html", found, "Exports \n" + "\n" + "Package\n" + "Exported To Modules\n" + "Description\n" + ""); - checkOutput("moduletags-summary.html", true, + checkOutput("moduletags/module-summary.html", true, "testpkgmdltags\n" + " "); } void checkModuleDeprecation(boolean found) { - checkOutput("moduleA-summary.html", found, + checkOutput("moduleA/module-summary.html", found, "
    Deprecated, for removal:" + " This API element is subject to removal in a future version.\n" + "
    This module is deprecated.
    \n" @@ -1068,26 +1068,26 @@ + "
  • Modules
  • \n" + "", "\n" - + "moduleA\n" + + "moduleA\n" + "\n" + "
    This module is deprecated.
    \n" + "\n" + ""); - checkOutput("moduleB-summary.html", !found, + checkOutput("moduleB/module-summary.html", !found, "
    Deprecated.\n" + "
    This module is deprecated using just the javadoc tag.
    \n"); - checkOutput("moduletags-summary.html", found, + checkOutput("moduletags/module-summary.html", found, "

    @Deprecated\n" + "

    ", "
    Deprecated.
    "); } void checkModuleAnnotation() { - checkOutput("moduleB-summary.html", true, + checkOutput("moduleB/module-summary.html", true, "

    @AnnotationType(optional=\"Module Annotation\",\n" + " required=2016)\n" + "

    "); - checkOutput("moduleB-summary.html", false, + checkOutput("moduleB/module-summary.html", false, "@AnnotationTypeUndocumented"); } @@ -1099,7 +1099,7 @@ } void checkModuleSummaryNoExported(boolean found) { - checkOutput("moduleNoExport-summary.html", found, + checkOutput("moduleNoExport/module-summary.html", found, "\n" + "\n" + "\n" @@ -1194,30 +1194,30 @@ } void checkModuleName(boolean found) { - checkOutput("test.moduleFullName-summary.html", found, + checkOutput("test.moduleFullName/module-summary.html", found, "
    \n" + "

    Module test.moduleFullName

    \n" + "
    "); checkOutput("index-all.html", found, "

    T

    \n" + "
    \n" - + "
    test.moduleFullName - module test.moduleFullName
    \n" + + "
    test.moduleFullName - module test.moduleFullName
    \n" + "
    \n" + "
    This is a test description for the test.moduleFullName.
    \n" + "
    "); checkOutput("module-overview-frame.html", found, "

    Modules

    \n" + ""); - checkOutput("test.moduleFullName-summary.html", !found, + checkOutput("test.moduleFullName/module-summary.html", !found, "
    \n" + "

    Module moduleFullName

    \n" + "
    "); checkOutput("index-all.html", !found, "
    \n" - + "
    moduleFullName - module moduleFullName
    \n" + + "
    moduleFullName - module moduleFullName
    \n" + "
    \n" + "
    This is a test description for the test.moduleFullName.
    \n" + "
    \n" @@ -1225,14 +1225,14 @@ } void checkLinkOffline() { - checkOutput("testpkg3mdlB/package-summary.html", true, + checkOutput("moduleB/testpkg3mdlB/package-summary.html", true, "Link to String Class"); - checkOutput("testpkg3mdlB/package-summary.html", true, + checkOutput("moduleB/testpkg3mdlB/package-summary.html", true, "Link to java.lang package"); - checkOutput("testpkg3mdlB/package-summary.html", true, - "Link to java.base module"); } } --- /dev/null 2017-01-21 22:54:52.877512947 -0800 +++ new/test/langtools/jdk/javadoc/doclet/testModuleDirs/TestModuleDirs.java 2018-02-02 13:16:45.125025882 -0800 @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8195795 + * @summary test the use of module directories in output, + * and the --no-module-directories option + * @modules jdk.javadoc/jdk.javadoc.internal.api + * jdk.javadoc/jdk.javadoc.internal.tool + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @library ../lib /tools/lib + * @build toolbox.ToolBox toolbox.ModuleBuilder JavadocTester + * @run main TestModuleDirs + */ + +import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; + +import toolbox.ModuleBuilder; +import toolbox.ToolBox; + +public class TestModuleDirs extends JavadocTester { + + public final ToolBox tb; + public static void main(String... args) throws Exception { + TestModuleDirs tester = new TestModuleDirs(); + tester.runTests(m -> new Object[] { Paths.get(m.getName()) }); + } + + public TestModuleDirs() { + tb = new ToolBox(); + } + + @Test + public void testNoModules(Path base) throws IOException { + Path src = base.resolve("src"); + tb.writeJavaFiles(src, "package p; public class C { }"); + + javadoc("-d", base.resolve("api").toString(), + "-sourcepath", src.toString(), + "-quiet", + "p"); + + checkExit(Exit.OK); + checkFiles(true, "p/package-summary.html"); + } + + @Test + public void testNoModuleDirs(Path base) throws IOException { + Path src = base.resolve("src"); + new ModuleBuilder(tb, "m") + .classes("package p; public class A {}") + .exports("p") + .write(src); + + javadoc("-d", base.resolve("api").toString(), + "-quiet", + "--module-source-path", src.toString(), + "--no-module-directories", + "--module", "m"); + + checkExit(Exit.OK); + checkFiles(true, + "m-summary.html", + "p/package-summary.html"); + checkFiles(false, + "m/module-summary.html", + "m/p/package-summary.html"); + } + + @Test + public void testModuleDirs(Path base) throws IOException { + Path src = base.resolve("src"); + new ModuleBuilder(tb, "m") + .classes("package p; public class A {}") + .exports("p") + .write(src); + + javadoc("-d", base.resolve("api").toString(), + "-quiet", + "--module-source-path", src.toString(), + "--module", "m"); + + checkExit(Exit.OK); + checkFiles(false, + "m-summary.html", + "p/package-summary.html"); + checkFiles(true, + "m/module-summary.html", + "m/p/package-summary.html"); + } +} +