Skip to content

Upgrade Java version references from Java 8/17 to Java 21#22

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1771903094-upgrade-java-21-references
Open

Upgrade Java version references from Java 8/17 to Java 21#22
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1771903094-upgrade-java-21-references

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Feb 24, 2026

Copy link
Copy Markdown

Description of what I changed

Updates all outdated Java version references across the codebase to reflect that Java 21 is the minimum required version:

  • OpenmrsUtil.validateJavaVersion(): Rewrote the validation logic to properly enforce Java 21 as the minimum. The old implementation used a regex (1\\.[0-7]\\.(.*)) that only caught Java 7 and earlier, which was ineffective even for Java 8 enforcement. The new implementation parses the major version number from java.version, handling both the legacy 1.x.y scheme (Java 8 and earlier) and the modern x.y.z scheme (Java 9+), and rejects anything below 21.
  • README.md: Updated the documented minimum JDK requirement from version 8 to version 21.
  • pom.xml: Removed the java17 Maven profile. Since Java 21 is now the minimum, the Java 17 compatibility profile for Mockito/ByteBuddy is no longer needed. The java21 and java24 profiles are retained.
  • JavaVersionTest.java: Renamed test method to reflect the Java 21 requirement.

Important items for review

  1. Version parsing logic in validateJavaVersion() — Verify the parsing handles edge cases correctly (e.g., 21.0.1, 21-ea, 1.8.0_292). There are no unit tests for specific version string formats; the existing test only validates the happy path on the current JVM.
  2. Removal of Java 17 Maven profile — This is a breaking change for anyone building on Java 17. Confirm no CI pipelines or downstream consumers still rely on Java 17 builds.
  3. Test was not run locally — The dev environment only has Java 17, so JavaVersionTest would fail locally (expected, since 17 < 21). CI must run on Java 21+ for the test suite to pass.

Issue I worked on

see https://issues.openmrs.org/browse/TRUNK-

Checklist: I completed these to help reviewers :)

  • My IDE is configured to follow the code style of this project.
  • I have added tests to cover my changes. (If you refactored existing code that was well tested you do not have to add tests)
  • I ran mvn clean package right before creating this pull request and added all formatting changes to my commit.
  • All new and existing tests passed.
  • My pull request is based on the latest changes of the master branch.

Note: mvn clean package was not run locally because the dev environment only has Java 17. The updated validateJavaVersion() will correctly reject Java 17, so the test suite requires Java 21+ to pass. CI should validate this.


Link to Devin run: https://app.devin.ai/sessions/e7f727e392644473ab6aaf56e4456fab
Requested by: @dillonvargo


Open with Devin

- Update validateJavaVersion() to properly check for Java 21 minimum
- Update README.md to state Java 21 as minimum JDK requirement
- Remove obsolete Java 17 Maven profile (Java 21 is now minimum)
- Update test method name to reflect Java 21 requirement

Co-Authored-By: unknown <>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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