This is an automated email from the ASF dual-hosted git repository.

jgus pushed a commit to branch 2.3
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/2.3 by this push:
     new 8504b66  MINOR: Work around OpenJDK 11 javadocs issue. (#6747)
8504b66 is described below

commit 8504b662d48b3c0d43fde6bdd2298f209e1fa870
Author: Colin Hicks <[email protected]>
AuthorDate: Mon May 20 18:24:15 2019 -0400

    MINOR: Work around OpenJDK 11 javadocs issue. (#6747)
    
    Some versions of OpenJDK 11 do not properly handle external javadocs links 
referencing previous Java versions. See: 
https://bugs.openjdk.java.net/browse/JDK-8212233.
    
    Failure symptom:
    `> Task :connect:api:javadoc
    javadoc: error - The code being documented uses modules but the packages 
defined in https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
    1 error`
    
    This PR conditionally sets the Java api docs link for the affected Gradle 
tasks. I verified that the links render correctly in the generated 
documentation when building with `1.8.0_181` and `11.0.3`. For example, in 
`build/docs/javadoc/org/apache/kafka/connect/source/SourceTask.html` the 
hyperlink to `java.nio.channels.Selector` points to a valid page on Oracle's 
site in both cases.
    
    Reviewers: José Armando García Sancio <[email protected]>, 
Jason Gustafson <[email protected]>
---
 build.gradle | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index 9787ebe..07200a8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1437,7 +1437,11 @@ project(':connect:api') {
 
   javadoc {
     include "**/org/apache/kafka/connect/**" // needed for the `javadocAll` 
task
-    options.links "https://docs.oracle.com/javase/8/docs/api/";
+    // The URL structure was changed to include the locale after Java 8
+    if (JavaVersion.current().isJava11Compatible())
+      options.links 
"https://docs.oracle.com/en/java/javase/${JavaVersion.current().majorVersion}/docs/api/"
+    else
+      options.links "https://docs.oracle.com/javase/8/docs/api/";
   }
 
   tasks.create(name: "copyDependantLibs", type: Copy) {
@@ -1717,5 +1721,9 @@ task aggregatedJavadoc(type: Javadoc) {
   classpath = files(projectsWithJavadoc.collect { 
it.sourceSets.main.compileClasspath })
   includes = projectsWithJavadoc.collectMany { it.javadoc.getIncludes() }
   excludes = projectsWithJavadoc.collectMany { it.javadoc.getExcludes() }
-  options.links "https://docs.oracle.com/javase/8/docs/api/";
+  // The URL structure was changed to include the locale after Java 8
+  if (JavaVersion.current().isJava11Compatible())
+    options.links 
"https://docs.oracle.com/en/java/javase/${JavaVersion.current().majorVersion}/docs/api/"
+  else
+    options.links "https://docs.oracle.com/javase/8/docs/api/";
 }

Reply via email to