Skip to content

Commit 96faae3

Browse files
committed
feat: Add support for Java 25
- Update GitHub Actions workflow to include Java 25 in the test matrix. - Upgrade Byte Buddy to 1.18.4 to support newer bytecode versions. - Introduce conditional patching for the Spring Petclinic test fixture, adding a specific patch for Java 25 compatibility. - Update JDBC and Spring Boot test modules to support Jakarta EE namespaces (Spring Boot 3.x) when running on newer Java versions. - Refactor test infrastructure to handle Gradle 9+ and newer JDKs, including Gretty and Gradle wrapper version adjustments. - Improve thread ID detection in Petclinic tests to account for differentiation in thread numbering between JDK versions. - Clean up hardcoded Java toolchains in classloading tests to allow running tests on the current environment's JDK.
1 parent 6c0af57 commit 96faae3

File tree

16 files changed

+168
-71
lines changed

16 files changed

+168
-71
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
--health-retries 5
5757
strategy:
5858
matrix:
59-
java: ['21', '17', '11', '8']
59+
java: ['25', '21', '17', '11', '8']
6060
runs-on: ubuntu-latest
6161
name: Run test suite with Java ${{ matrix.java }}
6262
needs: build-and-check

agent/bin/test_projects

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,23 @@ else
8787
install_petclinic "land-of-apps/spring-petclinic" old-java-support
8888
fi
8989

90-
patch -N -p1 -d build/fixtures/spring-petclinic < test/petclinic/pom.patch
90+
# Select the appropriate patch file based on Java version
91+
if is_java 25; then
92+
PATCH_FILE="test/petclinic/pom-java25.patch"
93+
else
94+
PATCH_FILE="test/petclinic/pom.patch"
95+
fi
96+
97+
# Apply patch, but only ignore if already applied (not other failures)
98+
if ! patch -N -p1 -d build/fixtures/spring-petclinic < "$PATCH_FILE" 2>&1 | tee /tmp/patch_output.txt; then
99+
if grep -q "Reversed (or previously applied) patch detected" /tmp/patch_output.txt; then
100+
echo "Patch already applied, continuing..."
101+
else
102+
echo "ERROR: Patch failed to apply!"
103+
cat /tmp/patch_output.txt
104+
exit 1
105+
fi
106+
fi
91107

92108

93109
install_scala_test_app

agent/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ dependencies {
5252
implementation 'com.alibaba:fastjson:1.2.83'
5353
implementation "org.javassist:javassist:${javassistVersion}"
5454
implementation 'org.reflections:reflections:0.10.2'
55-
implementation 'net.bytebuddy:byte-buddy:1.14.10'
55+
implementation 'net.bytebuddy:byte-buddy:1.18.4'
5656
implementation 'org.apache.commons:commons-lang3:3.20.0'
5757
implementation 'commons-io:commons-io:2.15.1'
5858
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.16.1'

agent/test/classloading/app/build.gradle

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ dependencies {
3535
implementation files(appmapJar)
3636
}
3737

38-
// Apply a specific Java toolchain to ease working on different environments.
39-
java {
40-
toolchain {
41-
languageVersion = JavaLanguageVersion.of(8)
42-
}
43-
}
44-
45-
4638
application {
4739
// Define the main class for the application.
4840
mainClass = 'com.appland.appmap.test.fixture.Runner'

agent/test/classloading/lib/build.gradle

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,3 @@ repositories {
1818

1919
dependencies {
2020
}
21-
22-
// Apply a specific Java toolchain to ease working on different environments.
23-
java {
24-
toolchain {
25-
languageVersion = JavaLanguageVersion.of(8)
26-
}
27-
}
Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,2 @@
1-
/*
2-
* This file was generated by the Gradle 'init' task.
3-
*
4-
* The settings file is used to specify which projects to include in your build.
5-
*
6-
* Detailed information about configuring a multi-project build in Gradle can be found
7-
* in the user manual at https://docs.gradle.org/8.1.1/userguide/multi_project_builds.html
8-
*/
9-
10-
plugins {
11-
// Apply the foojay-resolver plugin to allow automatic download of JDKs
12-
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
13-
}
14-
151
rootProject.name = 'classloading'
162
include 'app', 'lib'

agent/test/gretty-tomcat/build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
buildscript {
2+
ext {
3+
if (GradleVersion.current() >= GradleVersion.version('9.0')) {
4+
grettyVersion = '5.0.1'
5+
} else {
6+
grettyVersion = '4.1.6'
7+
}
8+
}
9+
}
10+
111
plugins {
212
id 'war'
3-
id 'org.gretty' version '4.1.6'
13+
id 'org.gretty' version "${grettyVersion}"
414
}
515

616
repositories {

agent/test/helper.bash

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,13 @@ find_annotation_jar() {
151151
export ANNOTATION_JAR="$(find_annotation_jar)"
152152

153153
# absolute gradle wrapper path (in the same directory as this file)
154-
GRADLE_WRAPPER="$TOP_LEVEL/agent/test/gradlew"
154+
if is_java 25; then
155+
# use 9.1 for newer java
156+
GRADLE_WRAPPER="$TOP_LEVEL/gradlew"
157+
else
158+
# this is 8.5 for older javas
159+
GRADLE_WRAPPER="$TOP_LEVEL/agent/test/gradlew"
160+
fi
155161

156162
# Shared gradle wrapper function
157163
gradlew() {

agent/test/http_client/httpclient/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ dependencies {
3232
}
3333

3434
application {
35-
// mainClass = 'http_client.HttpClientTest'
36-
mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL"
35+
if (properties.containsKey("mainClass")) {
36+
mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL"
37+
} else {
38+
mainClassName = project.hasProperty("mainClass") ? project.getProperty("mainClass") : "NULL"
39+
}
3740
applicationDefaultJvmArgs = [
3841
System.env.JAVA_OUTPUT_OPTIONS,
3942
"-javaagent:${appmapJar}",
4043
"-Djava.util.logging.config.file=${System.env.JUL_CONFIG}",
4144
//"-Dappmap.debug=true",
4245
//"-Dappmap.debug.file=../../build/log/httpclient-appmap.log"
4346
]
44-
4547
}

agent/test/http_client/setup_suite.bash

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ setup_suite() {
88
export FIXTURE_DIR="build/fixtures/spring-petclinic"
99
_shared_setup
1010
start_petclinic >&3
11-
12-
if is_java 17; then
13-
SPRING_BOOT_VERSION="3.2.2"
14-
else
15-
SPRING_BOOT_VERSION="2.7.18"
16-
fi
17-
export SPRING_BOOT_VERSION
1811
}
1912

2013
teardown_suite() {

0 commit comments

Comments
 (0)