From f34c91bd8f8a659b5e6eeb56302c195324947e33 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Wed, 17 Jul 2024 14:50:46 -0500 Subject: [PATCH] Include the module name when linking to recent Javadoc Fixes #9895 --- .../google/doctool/custom/JavaEmulSummaryDoclet.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java b/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java index 1b8a5ce21b..ba0d8eb0f2 100644 --- a/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java +++ b/build_tools/doctool/src/com/google/doctool/custom/JavaEmulSummaryDoclet.java @@ -42,6 +42,7 @@ import java.util.Iterator; import java.util.List; import java.util.Locale; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -79,13 +80,18 @@ public boolean run(DocletEnvironment env) { pw.println("\n"); getSpecifiedPackages(env).forEach(pack -> { + Optional matchingModuleName = ModuleLayer.boot().modules().stream() + .filter(m -> m.getPackages().contains(pack.getQualifiedName().toString())) + .findFirst(); + pw.format("

Package %s

\n", pack.getQualifiedName().toString().replace('.', '_'), pack.getQualifiedName().toString()); pw.println("
"); - String packURL = JAVADOC_URL + pack.getQualifiedName().toString() - .replace(".", "/") + "/"; + String packURL = JAVADOC_URL + + matchingModuleName.map(m -> m.getName() + "/").orElse("") + + pack.getQualifiedName().toString().replace(".", "/") + "/"; Iterator classesIterator = pack.getEnclosedElements() .stream()