Skip to content

BAU: Upgrade Java to 25#8338

Open
alhcomer wants to merge 14 commits into
mainfrom
BAU/upgrade-java-to-25
Open

BAU: Upgrade Java to 25#8338
alhcomer wants to merge 14 commits into
mainfrom
BAU/upgrade-java-to-25

Conversation

@alhcomer
Copy link
Copy Markdown
Contributor

@alhcomer alhcomer commented May 15, 2026

What

  • Upgrade Java from 17 to 25 (latest LTS per GDS Way)
  • Configure Java 25 toolchain with foojay-resolver for auto-provisioning
  • Replace deprecated new URL(String) with URI.create(s).toURL()
  • Upgrade google-java-format to 1.35.0 for Java 25 AST support
  • Update Lambda runtime to java25 in Terraform and CloudFormation
  • Bump AWS provider to >= 5.82.0 and tflint-ruleset-aws to 0.47.0 for java25 support
  • Update CI workflows and Docker images to Java 25
  • Use try-with-resources for ExecutorService (available since Java 19)

Note: depends on #8337 (Gradle 9.5.0 upgrade) being merged first. This branch will be rebased onto main after that merge.

How to review

  1. Code Review
  2. Check CI passes

@alhcomer alhcomer requested review from a team as code owners May 15, 2026 19:36
- project.buildDir is removed in Gradle 9
- Replace all usages with layout.buildDirectory across
  the root build.gradle and pact subproject build files

See: https://docs.gradle.org/9.5.0/userguide/upgrading_version_8.html#project_builddir
@alhcomer alhcomer force-pushed the BAU/upgrade-java-to-25 branch 10 times, most recently from ab1c239 to b40cfbb Compare May 15, 2026 20:43
alhcomer added 13 commits May 15, 2026 21:53
- Project#exec is removed in Gradle 9
- Inject ExecOperations via @Inject into the Terraform
  task class and use it for all exec calls

See: https://docs.gradle.org/9.5.0/userguide/upgrading_version_8.html#deprecated_project_exec
- SpotBugs: 6.4.8 → 6.5.0
- docker-compose: 0.17.12 → 0.17.21
- Pact: 4.6.18 → 4.7.0 (with library 4.6.20 → 4.7.0)
- Add testClassesDirs/classpath to custom Test tasks for Gradle 9

See: https://docs.gradle.org/9.5.0/userguide/upgrading_version_8.html#relying_on_conventions_for_custom_test_tasks
- Upgrade from Gradle 8.14.3 to 9.5.0
- Add jackson-core buildscript constraint for GHSA-72hv-8253-57qq
- All deprecated API usages fixed in prior commits

See: https://docs.gradle.org/9.5.0/userguide/upgrading_version_8.html
- Add foojay-resolver-convention plugin for toolchain provisioning
- Configure Java 25 toolchain in allprojects block
- Remove per-subproject sourceCompatibility/targetCompatibility
- Gradle will auto-provision Java 25 JDK when needed

See: https://docs.gradle.org/9.5.0/userguide/toolchains.html
See: https://github.com/gradle/foojay-toolchains
- new URL(String) is deprecated for removal in Java 25
- Migrate to URI.create(s).toURL() across source and test files

See: https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/net/URL.html
- google-java-format 1.29+ requires Java 21+ to run
- Upgrade to 1.35.0 for Java 25 AST support

See: https://github.com/google/google-java-format/releases/tag/v1.35.0
- Update Lambda runtime from java17 to java25 in Terraform and
  CloudFormation/SAM templates
- Update Docker images to Corretto 25
- Bump AWS provider to >= 5.82.0 for java25 runtime support
- Delete .terraform.lock.hcl files — they will be regenerated
  by the pre-commit hook (Update terraform provider locks)

See: https://aws.amazon.com/blogs/compute/aws-lambda-now-supports-java-25/
See: https://docs.aws.amazon.com/lambda/latest/dg/lambda-java.html
- Update java-version in GitHub Actions workflows to 25

See: https://github.com/actions/setup-java
- ExecutorService implements AutoCloseable since Java 19
- Replaces manual shutdownNow() with automatic close()
- Resolves SonarCloud S2095 blocker

See: https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/ExecutorService.html
- Updated to reflect AWS provider >= 5.82.0 constraint
- Replace unused exception variables with _ (unnamed pattern,
  available since Java 22)
- Resolves SonarCloud S7467 across 89 files

See: https://openjdk.org/jeps/456
@alhcomer alhcomer force-pushed the BAU/upgrade-java-to-25 branch from e6c18f8 to 6d03ff8 Compare May 15, 2026 20:54
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
67.5% Coverage on New Code (required ≥ 80%)
3.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant