Skip to content

(chore) - remove Java 20 from CI and add Java 25#1718

Merged
thomasc-adyen merged 2 commits intomainfrom
feature/update-Java-CI-versions
Feb 9, 2026
Merged

(chore) - remove Java 20 from CI and add Java 25#1718
thomasc-adyen merged 2 commits intomainfrom
feature/update-Java-CI-versions

Conversation

@thomasc-adyen
Copy link
Contributor

Description
This PR removes support for Java 20 on CI and adds Java 25. In general we should only test against LTS versions as those are what the vast majority of our clients should be using, and are the official, stable & supported versions from the Java community.

@thomasc-adyen thomasc-adyen requested review from a team as code owners February 6, 2026 11:23
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

thomasc-adyen added a commit that referenced this pull request Feb 6, 2026
… Java 25

This commit refactors the TerminalCommonNameValidator to work with Java 21+
by introducing an abstraction layer for certificate information. This fixes
test compatibility issues with sealed JDK classes (X509Certificate, X500Principal)
that cannot be mocked directly on Java 21+ versions.

Changes:
- Add CertificateInfo interface: A simple abstraction that provides only the
  subject name, decoupling the validator from JDK certificate classes

- Add X509CertificateInfo adapter: Wraps X509Certificate to implement
  CertificateInfo for production use without requiring mocks

- Refactor TerminalCommonNameValidator: Add overloaded validateCertificate
  method accepting CertificateInfo. Original method now delegates via adapter
  for 100% backwards compatibility

- Refactor TerminalCommonNameValidatorTest: Mock the simple CertificateInfo
  interface instead of sealed JDK classes. Removes @DisabledIf annotation,
  allowing all 27 test cases to run on Java 25

Benefits:
- Tests now pass on Java 21 and 25 without being disabled
- Uses a clean design pattern (Adapter) rather than skipping tests
- Maintains full backwards compatibility with existing SDK users
- Future-proof for Java versions with more restrictive sealing

Related PR: #1718 (chore: remove Java 20 from CI and add Java 25)
@thomasc-adyen
Copy link
Contributor Author

/gemini summarize

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request updates the project's build and testing infrastructure to align with current Java LTS versions, specifically migrating from Java 20 to Java 25 in the CI pipeline. A significant architectural change involves abstracting certificate handling to enhance testability and future-proof compatibility with evolving Java security features, such as sealed classes in Java 21+. Additionally, core testing dependencies have been updated, and build plugin configurations adjusted to support these changes.

Highlights

  • Java Version Update: The CI pipeline has been updated to remove Java 20 and add Java 25, aligning with the strategy to primarily test against LTS (Long Term Support) versions.
  • Certificate Abstraction for Java 21+ Compatibility: An abstraction layer (CertificateInfo interface and X509CertificateInfo adapter) has been introduced for certificate handling. This decouples the validation logic from specific JDK certificate classes, improving testability and ensuring compatibility with Java 21+ where certain certificate classes are sealed.
  • Dependency Updates: Mockito dependencies (mockito-junit-jupiter and mockito-core) have been upgraded from version 5.15.2 to 5.16.0.
  • Build Tool Configuration: The maven-surefire-plugin has been explicitly added to the pom.xml, and Mockito has been configured to use the ByteBuddyMockMaker for enhanced mocking capabilities.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • pom.xml
    • Added maven-surefire-plugin with version 3.5.2.
    • Updated mockito-junit-jupiter and mockito-core versions from 5.15.2 to 5.16.0.
  • src/main/java/com/adyen/terminal/security/CertificateInfo.java
    • New interface CertificateInfo introduced to provide an abstraction for certificate details, specifically getSubjectName().
  • src/main/java/com/adyen/terminal/security/TerminalCommonNameValidator.java
    • Modified validateCertificate to accept CertificateInfo and added an overload that wraps X509Certificate into X509CertificateInfo.
  • src/main/java/com/adyen/terminal/security/X509CertificateInfo.java
    • New class X509CertificateInfo created as an adapter for X509Certificate to implement CertificateInfo.
  • src/test/java/com/adyen/terminal/security/TerminalCommonNameValidatorTest.java
    • Updated test to mock CertificateInfo instead of X509Certificate and X500Principal.
    • Renamed test method testSerialize to testValidateCertificate.
  • src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker
    • New file added to specify org.mockito.internal.creation.bytebuddy.ByteBuddyMockMaker for Mockito.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/javaci.yml
Activity
  • A bot initially failed to generate a summary for this pull request due to unsupported file types.
  • The author, thomasc-adyen, explicitly requested a summary from the bot.

@thomasc-adyen
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the CI to add Java 25 and removes Java 20, which involves refactoring certificate validation logic for better testability and compatibility. The Java code changes are well-executed and improve the codebase. However, I've identified critical issues in the pom.xml where non-existent versions for maven-surefire-plugin and Mockito dependencies are specified, which will cause the build to fail. Additionally, an unnecessary and incorrectly configured Mockito extension file has been added. My review includes suggestions to correct these issues.

… 21+ compatibility

**CI and Dependency Updates:**
- Update GitHub Actions workflow to test Java 25 instead of Java 20
- Only test against LTS versions (11, 17, 21, 25) as recommended by Java community
- Update Mockito to 5.21.0 for better Java 25 support
- Explicitly configure maven-surefire-plugin (3.5.2) for test compatibility
- Enable ByteBuddy inline mock maker via mockito.properties

**Test Refactoring for Sealed Classes:**
Refactor TerminalCommonNameValidator to work with Java 21+ by introducing an
abstraction layer for certificate information. This fixes compatibility issues
with sealed JDK classes (X509Certificate, X500Principal) that cannot be mocked
directly in Java 21+.

Changes:
- Add CertificateInfo interface: Simple abstraction providing only subject name,
  decoupling validator from JDK certificate classes

- Add X509CertificateInfo adapter: Wraps X509Certificate to implement
  CertificateInfo, usable in production without mocking

- Refactor TerminalCommonNameValidator: Add overloaded validateCertificate
  method accepting CertificateInfo. Original method delegates via adapter for
  100% backwards compatibility

- Refactor TerminalCommonNameValidatorTest: Mock the simple CertificateInfo
  interface instead of sealed JDK classes. Removes @DisabledIf annotation,
  allowing all 27 test cases to run on Java 25 without skipping

**Benefits:**
- Tests pass on Java 21 and 25 without being disabled
- Cleaner design using Adapter pattern instead of test skipping
- Full backwards compatibility - existing SDK users see no breaking changes
- Future-proof for Java versions with stricter sealing restrictions
@thomasc-adyen thomasc-adyen force-pushed the feature/update-Java-CI-versions branch from 514f02e to 4322ad9 Compare February 6, 2026 14:27
@thomasc-adyen
Copy link
Contributor Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively updates the project's pom.xml to include a new Mockito version property and the maven-surefire-plugin, aligning with the goal of supporting newer Java versions. The core change introduces a CertificateInfo interface and an X509CertificateInfo adapter, which is a robust architectural improvement. This abstraction decouples the TerminalCommonNameValidator from direct X509Certificate usage, enhancing testability and ensuring compatibility with future Java versions, particularly concerning sealed classes. The test suite has been appropriately updated to reflect these changes, demonstrating a thorough approach to maintaining code quality and future-proofing the library.

- Update spotless-maven-plugin from 2.46.1 to 3.2.1
- Update google-java-format from 1.19.2 to 1.34.1

These newer versions are compatible with Java 25 and resolve the previous
API incompatibility issues with sun.tools.javac.util.Log internal APIs
that have been removed or changed in Java 25.
Copy link
Contributor

@galesky-a galesky-a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@thomasc-adyen thomasc-adyen merged commit 833bf49 into main Feb 9, 2026
5 checks passed
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.

3 participants