Skip to content

Update all Java version references to align with Java 21 target#30

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

Update all Java version references to align with Java 21 target#30
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1774371426-update-java-21-references

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown

Description of what I changed

Updates all outdated Java version references across the codebase to align with the project's Java 21 target (already set in the root pom.xml as javaCompilerVersion=21).

Changes:

  1. test-module/pom.xml — Updated javaCompilerVersion from 1.8 to 21 so the test module compiles with the same target as the rest of the project.

  2. OpenmrsUtil.javavalidateJavaVersion() — Replaced the old regex-based check (1\\.[0-7]\\.(.*)) with Runtime.version().feature() < 21. The old regex only rejected Java 1.0–1.7 using the legacy 1.x naming scheme and could never reject Java 8–20 (which use the modern naming scheme like 21.0.1). The new implementation correctly enforces a minimum of Java 21. Updated Javadoc and error message accordingly.

  3. README.md — Updated minimum Java version from 8 to 21 in the build prerequisites.

  4. tools/pom.xml — Removed both default-tools.jar and mac-tools.jar profiles. These referenced com.sun:tools / tools.jar, which was removed from the JDK in Java 9 (Project Jigsaw). On Java 21 these profiles are dead code — the activation file-exists conditions can never be true.

  5. pom.xml — Updated the stale comment on the Java 17 mockito profile that incorrectly referenced Java 8 compatibility. The new comment accurately describes the NullPointerException issue with mockito-core:3.12.4 on Java 17.

Key review points

  • validateJavaVersion() rewrite: Uses Runtime.version().feature() (available since Java 10) instead of regex parsing. Verify this is the desired approach vs. other alternatives.
  • tools/pom.xml profile removal: Confirm no other module or build step depends on the com.sun:tools artifact declaration.

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.

Link to Devin session: https://app.devin.ai/sessions/362a17cce8394d50b8e5afdbbc7a9507
Requested by: @dillonvargo


Open with Devin

- test-module/pom.xml: Update javaCompilerVersion from 1.8 to 21
- OpenmrsUtil.java: Rewrite validateJavaVersion() to use Runtime.version().feature() and require Java 21+
- README.md: Update minimum Java version from 8 to 21
- tools/pom.xml: Remove obsolete com.sun:tools profiles (dead code since Java 9)
- pom.xml: Update stale Java 8 comment in the Java 17 mockito profile

Co-Authored-By: Dillon Vargo <dillonvargo@gmail.com>
@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 4 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