From cf3cd0be486e6594cd2c330934ea671c33d4fc7c Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Fri, 5 Jun 2020 17:20:16 +0200 Subject: [PATCH 1/4] Use Class.getName() as fallback in HandlerFunctionDescription In JDK 15 the concept of hidden classes was introduced, which also affects Lambdas in so far that Class.getCanonicalName() will return null for those. This commit uses Class.getName() as a fallback when no canonical name is available. See gh-21713 --- .../mappings/reactive/HandlerFunctionDescription.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java index 044e27da9c..f4ecb17d08 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2020 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,11 +29,17 @@ public class HandlerFunctionDescription { private final String className; HandlerFunctionDescription(HandlerFunction handlerFunction) { - this.className = handlerFunction.getClass().getCanonicalName(); + this.className = getHandlerFunctionClassName(handlerFunction); } public String getClassName() { return this.className; } + private String getHandlerFunctionClassName(HandlerFunction handlerFunction) { + Class functionClass = handlerFunction.getClass(); + String canonicalName = functionClass.getCanonicalName(); + return canonicalName != null ? canonicalName : functionClass.getName(); + } + } From 3d27391d47910f73c1e889b76030a53038a38f25 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Fri, 5 Jun 2020 17:25:00 +0200 Subject: [PATCH 2/4] Allow StringSequence.isEmpty() to be compatible with JDK 15 JDK 15 introduces isEmpty() on CharSequence which clashes with the one declared in StringSequence because it is not public. See gh-21713 --- .../org/springframework/boot/loader/jar/StringSequence.java | 6 +++++- src/checkstyle/checkstyle-suppressions.xml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java index 25822d0fcd..b77492e562 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/StringSequence.java @@ -72,7 +72,11 @@ final class StringSequence implements CharSequence { return new StringSequence(this.source, subSequenceStart, subSequenceEnd); } - boolean isEmpty() { + /** + * Returns {@code true} if the sequence is empty. Public to be compatible with JDK 15. + * @return {@code true} if {@link #length()} is {@code 0}, otherwise {@code false} + */ + public boolean isEmpty() { return length() == 0; } diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index 7eb5d2d0c2..e2dc2e9cdd 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -46,4 +46,5 @@ + From 85218db2220f1bba1d6c389684f365ccd2c6995b Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Fri, 5 Jun 2020 08:29:41 +0200 Subject: [PATCH 3/4] Add Java 15 CI See gh-21713 --- ci/images/get-jdk-url.sh | 3 ++ .../spring-boot-jdk15-ci-image/Dockerfile | 12 +++++ ci/pipeline.yml | 53 ++++++++++++++++++- ci/scripts/detect-jdk-updates.sh | 12 +++-- 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 ci/images/spring-boot-jdk15-ci-image/Dockerfile diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh index 40195de252..f1e56b614f 100755 --- a/ci/images/get-jdk-url.sh +++ b/ci/images/get-jdk-url.sh @@ -11,6 +11,9 @@ case "$1" in java14) echo "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_linux_hotspot_14.0.1_7.tar.gz" ;; + java15) + echo "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-2020-05-26-19-22/OpenJDK-jdk_x64_linux_hotspot_2020-05-26-11-00.tar.gz" + ;; *) echo $"Unknown java version" exit 1 diff --git a/ci/images/spring-boot-jdk15-ci-image/Dockerfile b/ci/images/spring-boot-jdk15-ci-image/Dockerfile new file mode 100644 index 0000000000..6d0e9d1299 --- /dev/null +++ b/ci/images/spring-boot-jdk15-ci-image/Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:bionic-20200403 + +ADD setup.sh /setup.sh +ADD get-jdk-url.sh /get-jdk-url.sh +ADD get-docker-url.sh /get-docker-url.sh +RUN ./setup.sh java15 + +ENV JAVA_HOME /opt/openjdk +ENV PATH $JAVA_HOME/bin:$PATH +ADD docker-lib.sh /docker-lib.sh + +ENTRYPOINT [ "switch", "shell=/bin/bash", "--", "codep", "/bin/docker daemon" ] diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 0838f1234b..a439a36e7b 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -151,6 +151,12 @@ resources: source: <<: *docker-resource-source repository: ((docker-hub-organization))/spring-boot-jdk14-ci-image +- name: spring-boot-jdk15-ci-image + type: docker-image + icon: docker + source: + <<: *docker-resource-source + repository: ((docker-hub-organization))/spring-boot-jdk15-ci-image - name: artifactory-repo type: artifactory-resource icon: package-variant @@ -183,6 +189,14 @@ resources: access_token: ((github-ci-status-token)) branch: ((branch)) context: jdk14-build +- name: repo-status-jdk15-build + type: github-status-resource + icon: eye-check-outline + source: + repository: ((github-repo-name)) + access_token: ((github-ci-status-token)) + branch: ((branch)) + context: jdk15-build - name: slack-alert type: slack-notification icon: slack @@ -217,6 +231,10 @@ jobs: params: build: ci-images-git-repo/ci/images dockerfile: ci-images-git-repo/ci/images/spring-boot-jdk14-ci-image/Dockerfile + - put: spring-boot-jdk15-ci-image + params: + build: ci-images-git-repo/ci/images + dockerfile: ci-images-git-repo/ci/images/spring-boot-jdk15-ci-image/Dockerfile - name: detect-jdk-updates plan: - get: git-repo @@ -242,6 +260,12 @@ jobs: params: <<: *github-task-params JDK_VERSION: java14 + - task: detect-jdk15-update + image: spring-boot-ci-image + file: git-repo/ci/tasks/detect-jdk-updates.yml + params: + <<: *github-task-params + JDK_VERSION: java15 - name: detect-ubuntu-image-updates plan: - get: git-repo @@ -378,7 +402,32 @@ jobs: params: { state: "success", commit: "git-repo" } - put: slack-alert params: - <<: *slack-success-params + <<: *slack-success-params +- name: jdk15-build + serial: true + public: true + plan: + - get: spring-boot-jdk15-ci-image + - get: git-repo + trigger: true + - put: repo-status-jdk15-build + params: { state: "pending", commit: "git-repo" } + - do: + - task: build-project + image: spring-boot-jdk15-ci-image + <<: *build-project-task-params + on_failure: + do: + - put: repo-status-jdk15-build + params: { state: "failure", commit: "git-repo" } + - put: slack-alert + params: + <<: *slack-fail-params + - put: repo-status-jdk15-build + params: { state: "success", commit: "git-repo" } + - put: slack-alert + params: + <<: *slack-success-params - name: windows-build serial: true plan: @@ -568,7 +617,7 @@ jobs: body: generated-release-notes/release-notes.md groups: - name: "Build" - jobs: ["build", "jdk11-build", "jdk14-build", "windows-build"] + jobs: ["build", "jdk11-build", "jdk14-build", "jdk15-build", "windows-build"] - name: "Release" jobs: ["stage-milestone", "stage-rc", "stage-release", "promote-milestone", "promote-rc", "promote-release", "sync-to-maven-central"] - name: "CI Images" diff --git a/ci/scripts/detect-jdk-updates.sh b/ci/scripts/detect-jdk-updates.sh index 8228c116e0..f5715c9a64 100755 --- a/ci/scripts/detect-jdk-updates.sh +++ b/ci/scripts/detect-jdk-updates.sh @@ -2,15 +2,19 @@ case "$JDK_VERSION" in java8) - BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/8" + BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/8/ga" ISSUE_TITLE="Upgrade Java 8 version in CI image" ;; java11) - BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/11" + BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/11/ga" ISSUE_TITLE="Upgrade Java 11 version in CI image" ;; java14) - BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/14" + BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/14/ga" + ISSUE_TITLE="Upgrade Java 14 version in CI image" + ;; + java15) + BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/15/ea" ISSUE_TITLE="Upgrade Java 14 version in CI image" ;; *) @@ -18,7 +22,7 @@ case "$JDK_VERSION" in exit 1; esac -response=$( curl -s ${BASE_URL}\/ga\?architecture\=x64\&heap_size\=normal\&image_type\=jdk\&jvm_impl\=hotspot\&os\=linux\&sort_order\=DESC\&vendor\=adoptopenjdk ) +response=$( curl -s ${BASE_URL}\?architecture\=x64\&heap_size\=normal\&image_type\=jdk\&jvm_impl\=hotspot\&os\=linux\&sort_order\=DESC\&vendor\=adoptopenjdk ) latest=$( jq -r '.[0].binaries[0].package.link' <<< "$response" ) current=$( git-repo/ci/images/get-jdk-url.sh ${JDK_VERSION} ) From e87c3193ce0e94cba108fabc8600cf3b60ad075d Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Mon, 15 Jun 2020 17:06:28 +0200 Subject: [PATCH 4/4] Polish "Add Java 15 CI" See gh-21713 --- ci/images/get-jdk-url.sh | 2 +- ci/pipeline.yml | 2 +- ci/scripts/detect-jdk-updates.sh | 2 +- .../reactive/HandlerFunctionDescription.java | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ci/images/get-jdk-url.sh b/ci/images/get-jdk-url.sh index f1e56b614f..ea552f0316 100755 --- a/ci/images/get-jdk-url.sh +++ b/ci/images/get-jdk-url.sh @@ -12,7 +12,7 @@ case "$1" in echo "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.1%2B7/OpenJDK14U-jdk_x64_linux_hotspot_14.0.1_7.tar.gz" ;; java15) - echo "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk-2020-05-26-19-22/OpenJDK-jdk_x64_linux_hotspot_2020-05-26-11-00.tar.gz" + echo "https://github.com/AdoptOpenJDK/openjdk15-binaries/releases/download/jdk15-2020-06-15-05-34/OpenJDK15-jdk_x64_linux_hotspot_2020-06-15-05-34.tar.gz" ;; *) echo $"Unknown java version" diff --git a/ci/pipeline.yml b/ci/pipeline.yml index a439a36e7b..6f497eef9a 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -402,7 +402,7 @@ jobs: params: { state: "success", commit: "git-repo" } - put: slack-alert params: - <<: *slack-success-params + <<: *slack-success-params - name: jdk15-build serial: true public: true diff --git a/ci/scripts/detect-jdk-updates.sh b/ci/scripts/detect-jdk-updates.sh index f5715c9a64..8921784dd8 100755 --- a/ci/scripts/detect-jdk-updates.sh +++ b/ci/scripts/detect-jdk-updates.sh @@ -15,7 +15,7 @@ case "$JDK_VERSION" in ;; java15) BASE_URL="https://api.adoptopenjdk.net/v3/assets/feature_releases/15/ea" - ISSUE_TITLE="Upgrade Java 14 version in CI image" + ISSUE_TITLE="Upgrade Java 15 version in CI image" ;; *) echo $"Unknown java version" diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java index f4ecb17d08..694e69a98a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/web/mappings/reactive/HandlerFunctionDescription.java @@ -32,14 +32,14 @@ public class HandlerFunctionDescription { this.className = getHandlerFunctionClassName(handlerFunction); } - public String getClassName() { - return this.className; - } - - private String getHandlerFunctionClassName(HandlerFunction handlerFunction) { + private static String getHandlerFunctionClassName(HandlerFunction handlerFunction) { Class functionClass = handlerFunction.getClass(); String canonicalName = functionClass.getCanonicalName(); - return canonicalName != null ? canonicalName : functionClass.getName(); + return (canonicalName != null) ? canonicalName : functionClass.getName(); + } + + public String getClassName() { + return this.className; } }