Skip to content

Update minimum Java version requirement from 8 to 21#13

Open
dillonvargo wants to merge 1 commit into
masterfrom
devin/1771358987-update-java-version-requirements
Open

Update minimum Java version requirement from 8 to 21#13
dillonvargo wants to merge 1 commit into
masterfrom
devin/1771358987-update-java-version-requirements

Conversation

@dillonvargo

Copy link
Copy Markdown
Owner

Description of what I changed

Updated the minimum Java version requirement throughout the codebase to align with the compiler version (javaCompilerVersion=21 already set in the root pom.xml).

Changes:

  1. OpenmrsUtil.validateJavaVersion() — Replaced the old regex (rejected only Java ≤7) with a new pattern (1\..*)|(9|1[0-9]|20)(\...*)? that rejects all versions below 21 (both old 1.x format and modern 920 format). Updated Javadoc and error message.

  2. README.md — Updated documented minimum JDK from 8 to 21.

  3. test-module/pom.xml — Changed javaCompilerVersion from 1.8 to 21 to match the parent POM.

  4. pom.xml — Removed the java17, java21, and java24 Maven profiles. All three declared identical Mockito 5.19.0 / ByteBuddy 1.17.7 dependency versions and existed only because Mockito 5.x didn't support Java 8. Since Java 8 is no longer supported, the profiles are unnecessary. Moved byte-buddy and byte-buddy-agent declarations into the main <dependencyManagement> section (mockito-core was already there).

  5. startup.sh — Removed the now-dead Java 8 debug address code path (address=PORT without *: prefix). Since minimum is Java 21, only the address=*:PORT format is needed.

Issue I worked on

Aligns runtime validation with the compiler target. The project already compiles with Java 21 (root POM, Dockerfile) but was still validating for Java 8 at runtime.

⚠️ Key areas for reviewer attention

  • Regex correctness in validateJavaVersion(): The new pattern must correctly reject versions 1.x through 20.x while allowing 21+. Edge cases to consider: bare version numbers without dots (e.g., "21"), early-access strings (e.g., "21-ea"), and future high version numbers.

  • Maven profile removal: Verify that removing the JDK-specific profiles doesn't break dependency resolution. All three profiles had identical versions, but confirm no subtle activation logic was lost.

  • Hardcoded ByteBuddy version: The byte-buddy and byte-buddy-agent dependencies now use hardcoded 1.17.7 instead of a property. Consider whether this should reference a ${byteBuddyVersion} property for consistency.

  • No test coverage for new regex: The existing JavaVersionTest only verifies that the current JVM passes validation. There are no unit tests for the regex edge cases (e.g., does it correctly reject "20.0.1" and accept "21.0.1"?).

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.
  • 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 run: https://app.devin.ai/sessions/dca9d2f75b2a4e2aa3dcfff50502c5c6
Requested by: @dillonvargo

- Update validateJavaVersion() regex to reject Java versions below 21
- Update README.md to reflect Java 21 minimum
- Update test-module/pom.xml compiler version from 1.8 to 21
- Consolidate Java version profiles in pom.xml (java17/java21/java24 all had identical deps, moved byte-buddy to main dependencyManagement)
- Simplify startup.sh debug config (remove dead Java 8 code path)

Co-Authored-By: Dillon Vargo <dillonvargo@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown

🤖 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

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