Browse Source

Run tests with jdk 22 (#11191)

Lauri Tulmin 10 months ago
parent
commit
17f58ed20a

+ 2 - 1
.github/workflows/build-common.yml

@@ -182,6 +182,7 @@ jobs:
           - 11
           - 17
           - 21
+          - 22
         vm:
           - hotspot
           - openj9
@@ -192,7 +193,7 @@ jobs:
           - 3
         exclude:
           - vm: ${{ inputs.skip-openj9-tests && 'openj9' || '' }}
-          - test-java-version: 21
+          - test-java-version: 22
             vm: openj9
       fail-fast: false
     steps:

+ 4 - 4
docs/supported-libraries.md

@@ -205,10 +205,10 @@ These are the application servers that the smoke tests are run against:
 
 These are the JVMs and operating systems that the integration tests are run against:
 
-| JVM                                                                                       | Versions      | OS                                    |
-| ----------------------------------------------------------------------------------------- |---------------| ------------------------------------- |
-| [OpenJDK (Eclipse Temurin)](https://adoptium.net/)                                        | 8, 11, 17, 21 | [`ubuntu-latest`], [`windows-latest`] |
-| [OpenJ9 (IBM Semeru Runtimes)](https://developer.ibm.com/languages/java/semeru-runtimes/) | 8, 11, 17     | [`ubuntu-latest`]                     |
+| JVM                                                                                       | Versions          | OS                                    |
+| ----------------------------------------------------------------------------------------- |-------------------| ------------------------------------- |
+| [OpenJDK (Eclipse Temurin)](https://adoptium.net/)                                        | 8, 11, 17, 21, 22 | [`ubuntu-latest`], [`windows-latest`] |
+| [OpenJ9 (IBM Semeru Runtimes)](https://developer.ibm.com/languages/java/semeru-runtimes/) | 8, 11, 17, 21     | [`ubuntu-latest`]                     |
 
 ## Disabled instrumentations
 

+ 13 - 2
instrumentation-api/src/main/java/io/opentelemetry/instrumentation/api/internal/ClassNames.java

@@ -26,10 +26,21 @@ public final class ClassNames {
   }
 
   private static String computeSimpleName(Class<?> type) {
+    String className = type.getName();
     if (!type.isAnonymousClass()) {
-      return type.getSimpleName();
+      String simpleName = type.getSimpleName();
+      // on openj9 21 simple name for lambda classes is an empty string
+      if (!simpleName.isEmpty()) {
+        return simpleName;
+      } else {
+        // handle lambda names on openj9 21
+        // only lambda class names contain /
+        int index = className.indexOf('/');
+        if (index != -1) {
+          className = className.substring(0, index);
+        }
+      }
     }
-    String className = type.getName();
     if (type.getPackage() != null) {
       String pkgName = type.getPackage().getName();
       if (!pkgName.isEmpty()) {

+ 7 - 0
instrumentation/hibernate/hibernate-reactive-1.0/javaagent/build.gradle.kts

@@ -83,3 +83,10 @@ tasks {
     dependsOn(testing.suites)
   }
 }
+
+if (!latestDepTest) {
+  // https://bugs.openjdk.org/browse/JDK-8320431
+  otelJava {
+    maxJavaVersionForTests.set(JavaVersion.VERSION_21)
+  }
+}

+ 8 - 0
instrumentation/vertx/vertx-sql-client-4.0/javaagent/build.gradle.kts

@@ -26,3 +26,11 @@ tasks {
     usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
   }
 }
+
+val latestDepTest = findProperty("testLatestDeps") as Boolean
+if (!latestDepTest) {
+  // https://bugs.openjdk.org/browse/JDK-8320431
+  otelJava {
+    maxJavaVersionForTests.set(JavaVersion.VERSION_21)
+  }
+}