From aa0a6662452c219d2b1d04be224a2a17e19c6a3d Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Fri, 7 Jun 2024 22:29:54 +0200 Subject: [PATCH] [MJAVADOC-796] Do not follow links for Java 12+ This closes #287 --- .../apache/maven/plugins/javadoc/AbstractJavadocMojo.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java index f951e1293..09c9e4889 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -5727,13 +5727,17 @@ protected final OfflineLink getDefaultJavadocApiLink() { } /** - * Follows all of the given links, and returns their last redirect locations. Ordering is kept. - * This is necessary because javadoc tool doesn't follow links, see JDK-8190312 (MJAVADOC-427, MJAVADOC-487) + * Follows all of the given links if the Javadoc version is before 12, and returns their last + * redirect locations. Ordering is kept. This is necessary because javadoc tool doesn't follow + * links, see JDK-8190312 (MJAVADOC-427, MJAVADOC-487) * * @param links Links to follow. * @return Last redirect location of all the links. */ private Set followLinks(Set links) { + if (javadocRuntimeVersion.isAtLeast("12")) { + return links; + } Set redirectLinks = new LinkedHashSet<>(links.size()); for (String link : links) { try {