Update minimum Java version requirement from 8 to 21#13
Open
dillonvargo wants to merge 1 commit into
Open
Conversation
- 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 EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of what I changed
Updated the minimum Java version requirement throughout the codebase to align with the compiler version (
javaCompilerVersion=21already set in the rootpom.xml).Changes:
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 old1.xformat and modern9–20format). Updated Javadoc and error message.README.md— Updated documented minimum JDK from 8 to 21.test-module/pom.xml— ChangedjavaCompilerVersionfrom1.8to21to match the parent POM.pom.xml— Removed thejava17,java21, andjava24Maven 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. Movedbyte-buddyandbyte-buddy-agentdeclarations into the main<dependencyManagement>section (mockito-corewas already there).startup.sh— Removed the now-dead Java 8 debug address code path (address=PORTwithout*:prefix). Since minimum is Java 21, only theaddress=*:PORTformat 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.
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-buddyandbyte-buddy-agentdependencies now use hardcoded1.17.7instead of a property. Consider whether this should reference a${byteBuddyVersion}property for consistency.No test coverage for new regex: The existing
JavaVersionTestonly 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 :)
mvn clean packageright before creating this pull request and added all formatting changes to my commit.Link to Devin run: https://app.devin.ai/sessions/dca9d2f75b2a4e2aa3dcfff50502c5c6
Requested by: @dillonvargo