Skip to content

Commit eaa9fa9

Browse files
authored
Upgrade test sources to Java 25 (#1591)
## Summary - Upgrade test compilation target from Java 21 to Java 25 - Apply OpenRewrite `UpgradeToJava25` recipe to modernize test sources (instanceof pattern matching, `@Serial` annotation, unnamed variables, etc.) - Apply OpenRewrite `UpgradeToJava17` recipe improvements to main sources (instanceof pattern matching) - Fix incorrect OpenRewrite migration of `@Test(expected=...)` to AssertJ in `NullExpressionTest` and `EnumConversionTest` - Add `.sdkmanrc` for consistent Java 25 toolchain selection ## Test plan - [ ] `./mvnw -Pdev -Dtoolchain.skip=true verify` passes with Java 25 - [ ] CI pipeline passes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents c33c181 + 3db4ab2 commit eaa9fa9

File tree

121 files changed

+1676
-1642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+1676
-1642
lines changed

.circleci/config.yml

Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
executors:
1717
java:
1818
docker:
19-
- image: velo/toolchains-4-ci-builds:latest
19+
- image: velo/toolchains-4-ci-builds:with-25
2020

2121
# common commands
2222
commands:
@@ -25,7 +25,7 @@ commands:
2525
steps:
2626
- restore_cache:
2727
keys:
28-
- m2-{{ checksum "pom.xml" }}
28+
- m2repo-{{ checksum "pom.xml" }}
2929
- run:
3030
name: 'Check if cache was restored'
3131
command: |
@@ -63,6 +63,7 @@ defaults: &defaults
6363
environment:
6464
# Customize the JVM maximum heap limit
6565
MAVEN_OPTS: -Xmx3200m
66+
JAVA_HOME: /usr/lib/jvm/java-25-openjdk-amd64
6667

6768
# branch filters
6869
master-only: &master-only
@@ -92,26 +93,27 @@ jobs:
9293
<<: *defaults
9394
working_directory: ~/querydsl
9495
docker:
95-
- image: velo/toolchains-4-ci-builds:latest
96+
- image: velo/toolchains-4-ci-builds:with-25
9697
steps:
9798
- checkout
9899
- resolve-dependencies
99100
- save_cache:
100101
paths:
101-
- ~/.m2
102-
key: m2-{{ checksum "pom.xml" }}
102+
- ~/.m2/repository
103+
key: m2repo-{{ checksum "pom.xml" }}
103104
test:
104105
<<: *defaults
105106
working_directory: ~/querydsl
106107
docker:
107-
- image: velo/toolchains-4-ci-builds:latest
108+
- image: velo/toolchains-4-ci-builds:with-25
108109
steps:
109110
- checkout
110111
- restore_cache:
111112
keys:
112-
- m2-{{ checksum "pom.xml" }}
113+
- m2repo-{{ checksum "pom.xml" }}
113114
- run:
114115
name: 'Test'
116+
no_output_timeout: 60m
115117
command: |
116118
./mvnw -ntp -B verify -Pno-databases
117119
- save-test-results
@@ -120,32 +122,48 @@ jobs:
120122
machine:
121123
image: windows-server-2019-vs2019:current # Windows machine image
122124
resource_class: windows.medium
125+
environment:
126+
MAVEN_OPTS: -Xmx3200m
123127

124128
steps:
125129
- checkout
126130
- restore_cache:
127131
keys:
128-
- m2-{{ checksum "pom.xml" }}
132+
- m2repo-{{ checksum "pom.xml" }}
133+
- run:
134+
name: 'Install JDK 25'
135+
command: |
136+
$ProgressPreference = 'SilentlyContinue'
137+
Invoke-WebRequest -Uri "https://api.adoptium.net/v3/binary/latest/25/ga/windows/x64/jdk/hotspot/normal/eclipse?project=jdk" -OutFile "$env:TEMP\jdk.zip"
138+
Expand-Archive -Path "$env:TEMP\jdk.zip" -DestinationPath "C:\jdk25"
139+
$jdkDir = Get-ChildItem "C:\jdk25" -Directory | Select-Object -First 1
140+
[Environment]::SetEnvironmentVariable("JAVA_HOME", $jdkDir.FullName, "Machine")
141+
Write-Host "JAVA_HOME set to $($jdkDir.FullName)"
142+
& "$($jdkDir.FullName)\bin\java" -version
143+
shell: powershell.exe
129144
- run:
130145
name: 'Test'
131146
command: |
147+
export JAVA_HOME="$(ls -d /c/jdk25/jdk-* | head -1)"
148+
export PATH="$JAVA_HOME/bin:$PATH"
149+
java -version
132150
./mvnw -ntp -B verify -Pno-databases -Dtoolchain.skip=true
133151
shell: bash.exe
134152

135153
buildExamples:
136154
<<: *defaults
137155
working_directory: ~/querydsl
138156
docker:
139-
- image: velo/toolchains-4-ci-builds:latest
157+
- image: velo/toolchains-4-ci-builds:with-25
140158
steps:
141159
- checkout
142160
- restore_cache:
143161
keys:
144-
- m2-{{ checksum "pom.xml" }}
162+
- m2repo-{{ checksum "pom.xml" }}
145163
- run:
146164
name: 'Prepare environment'
147165
command: |
148-
./mvnw -ntp -B install -Pquickbuild -pl :querydsl-sql-spring,:querydsl-jpa-spring,:querydsl-kotlin-codegen,:querydsl-mongodb,:querydsl-r2dbc,:querydsl-sql-json -am -T2
166+
./mvnw -ntp -B install -Pquickbuild -pl :querydsl-sql-spring,:querydsl-jpa-spring,:querydsl-kotlin-codegen,:querydsl-mongodb,:querydsl-r2dbc,:querydsl-sql-json -am
149167
- run:
150168
name: 'Build and test examples'
151169
command: |
@@ -169,16 +187,18 @@ jobs:
169187
<<: *defaults
170188
working_directory: ~/querydsl
171189
docker:
172-
- image: velo/toolchains-4-ci-builds:latest
190+
- image: velo/toolchains-4-ci-builds:with-25
173191
steps:
174192
- checkout
175193
- run:
176194
name: 'Prepare environment'
177195
command: |
178196
./mvnw -N org.codehaus.mojo:properties-maven-plugin:1.2.1:write-project-properties -Dproperties.outputFile=querydsl-examples/querydsl-example-ksp-codegen/gradle.properties
179-
./mvnw -ntp -B install -Pquickbuild -pl :querydsl-ksp-codegen,:querydsl-jpa -am -T2
197+
./mvnw -ntp -B install -Pquickbuild -pl :querydsl-ksp-codegen,:querydsl-jpa -am
180198
- run:
181199
name: 'Build and test examples'
200+
environment:
201+
JAVA_HOME: /usr/lib/jvm/java-21-openjdk-amd64
182202
command: |
183203
cd querydsl-examples/querydsl-example-ksp-codegen
184204
./gradlew --no-daemon --console=plain --info --stacktrace test
@@ -194,7 +214,7 @@ jobs:
194214
<<: *defaults
195215
working_directory: ~/querydsl
196216
docker:
197-
- image: velo/toolchains-4-ci-builds:latest
217+
- image: velo/toolchains-4-ci-builds:with-25
198218
- image: mysql:5.6.38
199219
environment:
200220
- MYSQL_ROOT_PASSWORD=querydsl
@@ -205,7 +225,7 @@ jobs:
205225
- checkout
206226
- restore_cache:
207227
keys:
208-
- m2-{{ checksum "pom.xml" }}
228+
- m2repo-{{ checksum "pom.xml" }}
209229
- run:
210230
name: 'Test'
211231
command: |
@@ -215,7 +235,7 @@ jobs:
215235
<<: *defaults
216236
working_directory: ~/querydsl
217237
docker:
218-
- image: velo/toolchains-4-ci-builds:latest
238+
- image: velo/toolchains-4-ci-builds:with-25
219239
- image: postgis/postgis:16-3.4-alpine
220240
environment:
221241
- POSTGRES_USER=querydsl
@@ -225,7 +245,7 @@ jobs:
225245
- checkout
226246
- restore_cache:
227247
keys:
228-
- m2-{{ checksum "pom.xml" }}
248+
- m2repo-{{ checksum "pom.xml" }}
229249
- run:
230250
name: 'Test'
231251
command: |
@@ -235,15 +255,15 @@ jobs:
235255
<<: *defaults
236256
working_directory: ~/querydsl
237257
docker:
238-
- image: velo/toolchains-4-ci-builds:latest
258+
- image: velo/toolchains-4-ci-builds:with-25
239259
- image: cubrid/cubrid:11.3
240260
environment:
241261
- CUBRID_DB=demodb
242262
steps:
243263
- checkout
244264
- restore_cache:
245265
keys:
246-
- m2-{{ checksum "pom.xml" }}
266+
- m2repo-{{ checksum "pom.xml" }}
247267
- run:
248268
name: 'Test'
249269
command: |
@@ -253,7 +273,7 @@ jobs:
253273
<<: *defaults
254274
working_directory: ~/querydsl
255275
docker:
256-
- image: velo/toolchains-4-ci-builds:latest
276+
- image: velo/toolchains-4-ci-builds:with-25
257277
- image: gvenzl/oracle-xe:slim-faststart
258278
environment:
259279
- ORACLE_PASSWORD=querydsl
@@ -264,7 +284,7 @@ jobs:
264284
- checkout
265285
- restore_cache:
266286
keys:
267-
- m2-{{ checksum "pom.xml" }}
287+
- m2repo-{{ checksum "pom.xml" }}
268288
- run:
269289
name: 'Test'
270290
command: |
@@ -274,13 +294,13 @@ jobs:
274294
<<: *defaults
275295
working_directory: ~/querydsl
276296
docker:
277-
- image: velo/toolchains-4-ci-builds:latest
297+
- image: velo/toolchains-4-ci-builds:with-25
278298
- image: mongo:8.0.9
279299
steps:
280300
- checkout
281301
- restore_cache:
282302
keys:
283-
- m2-{{ checksum "pom.xml" }}
303+
- m2repo-{{ checksum "pom.xml" }}
284304
- run:
285305
name: 'Test'
286306
command: |
@@ -290,7 +310,7 @@ jobs:
290310
<<: *defaults
291311
working_directory: ~/querydsl
292312
docker:
293-
- image: velo/toolchains-4-ci-builds:latest
313+
- image: velo/toolchains-4-ci-builds:with-25
294314
- image: jacobalberty/firebird:v4
295315
environment:
296316
- ISC_PASSWORD=masterkey
@@ -302,7 +322,7 @@ jobs:
302322
- checkout
303323
- restore_cache:
304324
keys:
305-
- m2-{{ checksum "pom.xml" }}
325+
- m2repo-{{ checksum "pom.xml" }}
306326
- run:
307327
name: 'Test'
308328
command: |
@@ -312,12 +332,12 @@ jobs:
312332
<<: *defaults
313333
working_directory: ~/querydsl
314334
docker:
315-
- image: velo/toolchains-4-ci-builds:latest
335+
- image: velo/toolchains-4-ci-builds:with-25
316336
steps:
317337
- checkout
318338
- restore_cache:
319339
keys:
320-
- m2-{{ checksum "pom.xml" }}
340+
- m2repo-{{ checksum "pom.xml" }}
321341
- run:
322342
name: 'Test'
323343
command: |
@@ -328,18 +348,15 @@ jobs:
328348
machine: true
329349
working_directory: ~/querydsl
330350
environment:
331-
# You can also set any DB2-specific environment variables here if needed
332351
DB2INST1_PASSWORD: a3sd!fDj
333352
steps:
334353
- checkout
335354
- restore_cache:
336355
keys:
337-
- m2-{{ checksum "pom.xml" }}
338-
# Start the DB2 container in detached mode
356+
- m2repo-{{ checksum "pom.xml" }}
339357
- run:
340358
name: "Start DB2 container"
341359
command: |
342-
# Start the DB2 container with the same settings as your docker-compose file
343360
docker run -d --privileged --name db2 \
344361
-p 50000:50000 \
345362
-e DB2INST1_PASSWORD=a3sd!fDj \
@@ -351,7 +368,6 @@ jobs:
351368
ibmcom/db2:11.5.0.0
352369
353370
echo "Waiting for DB2 to initialize..."
354-
# Basic health-check loop; replace with a more robust check if available
355371
for i in {1..60}; do
356372
if docker logs db2 2>&1 | grep -q "All databases are now active"; then
357373
echo "DB2 appears to be up"
@@ -361,17 +377,23 @@ jobs:
361377
sleep 10
362378
done
363379
docker ps
364-
365-
# Run your tests against DB2; adjust the Maven command according to your project
366380
- run:
367381
name: "Run DB2 tests"
368382
command: |
369-
./mvnw -ntp -B install -Pci -Dgroups=com.querydsl.core.testutil.DB2 -Dtoolchain.skip=true
370-
# Clean up the DB2 container once the tests are done
383+
docker run --rm \
384+
--network host \
385+
-v $(pwd):/code \
386+
-v ~/.m2/repository:/root/.m2/repository \
387+
-w /code \
388+
-e MAVEN_OPTS=-Xmx3200m \
389+
-e JAVA_HOME=/usr/lib/jvm/java-25-openjdk-amd64 \
390+
velo/toolchains-4-ci-builds:with-25 \
391+
./mvnw -ntp -B install -Pci -Dgroups=com.querydsl.core.testutil.DB2
371392
- run:
372393
name: "Stop and remove DB2 container"
373394
command: |
374395
docker stop db2 && docker rm db2
396+
when: always
375397
- save-test-results
376398

377399
deploySnapshot:
@@ -382,7 +404,7 @@ jobs:
382404
- checkout
383405
- restore_cache:
384406
keys:
385-
- m2-{{ checksum "pom.xml" }}
407+
- m2repo-{{ checksum "pom.xml" }}
386408
- configure-gpg
387409
- run:
388410
name: 'Deploy Core Modules Sonatype'
@@ -397,7 +419,7 @@ jobs:
397419
- checkout
398420
- restore_cache:
399421
keys:
400-
- m2-{{ checksum "pom.xml" }}
422+
- m2repo-{{ checksum "pom.xml" }}
401423
- configure-gpg
402424
- run:
403425
name: 'Deploy Core Modules Sonatype'

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
uses: actions/setup-java@v4.0.0
9494
with:
9595
distribution: 'temurin'
96-
java-version: '21'
96+
java-version: '25'
9797

9898
- name: Compile project
9999
run: ./mvnw -B -ntp clean package -DskipTests=true -Dtoolchain.skip=true -pl '!:querydsl-kotlin-codegen,!:querydsl-ksp-codegen,!:querydsl-kotlin'

pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989

9090
<!-- default bytecode version for src/main -->
9191
<main.java.version>17</main.java.version>
92-
<latest.java.version>21</latest.java.version>
92+
<latest.java.version>25</latest.java.version>
9393

9494
<git-code-format-maven-plugin.version>5.4</git-code-format-maven-plugin.version>
9595

@@ -974,6 +974,7 @@
974974

975975
<properties>
976976
<excludedGroups>com.querydsl.core.testutil.Database,
977+
com.querydsl.core.testutil.MongoDB,
977978
com.querydsl.core.testutil.SlowTest,
978979
com.querydsl.core.testutil.Performance,
979980
com.querydsl.core.testutil.ReportingOnly</excludedGroups>
@@ -993,6 +994,7 @@
993994
<properties>
994995
<!-- default groups to exclude from surefire plugin -->
995996
<excludedGroups>com.querydsl.core.testutil.ExternalDatabase,
997+
com.querydsl.core.testutil.MongoDB,
996998
com.querydsl.core.testutil.SlowTest,
997999
com.querydsl.core.testutil.Performance,
9981000
com.querydsl.core.testutil.ReportingOnly</excludedGroups>
@@ -1053,7 +1055,7 @@
10531055
<recipe>org.openrewrite.java.testing.junit5.AssertToAssertions</recipe>
10541056
<recipe>org.openrewrite.java.testing.assertj.JUnitToAssertj</recipe>
10551057
<recipe>org.openrewrite.java.testing.assertj.Assertj</recipe>
1056-
<recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
1058+
<recipe>org.openrewrite.java.migrate.UpgradeToJava25</recipe>
10571059
</activeRecipes>
10581060
<exclusions>
10591061
<exclusion>**/src/main/java/**</exclusion>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21 AS build
1+
FROM quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-25 AS build
22
COPY --chown=quarkus:quarkus . /code/
33
USER quarkus
44
WORKDIR /code
55

6-
RUN ./mvnw -ntp -B install -Pquickbuild -pl :querydsl-jpa -am -T2 -Dtoolchain.skip -Dgcf.skip
6+
RUN ./mvnw -ntp -B install -Pquickbuild -pl :querydsl-jpa -am -Dtoolchain.skip -Dgcf.skip
77
RUN ./mvnw verify -Dnative -Pexamples -pl :querydsl-example-jpa-quarkus -Dtoolchain.skip -Dgcf.skip

querydsl-libraries/querydsl-core/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,16 @@
4343
<version>2.9.1</version>
4444
<scope>test</scope>
4545
</dependency>
46+
<dependency>
47+
<groupId>org.junit.jupiter</groupId>
48+
<artifactId>junit-jupiter-params</artifactId>
49+
<scope>test</scope>
50+
</dependency>
4651

4752
<dependency>
4853
<groupId>jakarta.annotation</groupId>
4954
<artifactId>jakarta.annotation-api</artifactId>
55+
<scope>provided</scope>
5056
</dependency>
5157
</dependencies>
5258

0 commit comments

Comments
 (0)