fix: reject JDK < 11 early with clear error message#2066
Open
mashraf-222 wants to merge 1 commit intomainfrom
Open
fix: reject JDK < 11 early with clear error message#2066mashraf-222 wants to merge 1 commit intomainfrom
mashraf-222 wants to merge 1 commit intomainfrom
Conversation
When running with JDK 8, the pipeline would fail late with a cryptic UnsupportedClassVersionError from the runtime JAR. Now checks the detected Java version in ensure_runtime_environment() and returns False with a clear error message explaining that JDK 11+ is required. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Problem
When running codeflash with JDK 8, the pipeline fails late with a cryptic
UnsupportedClassVersionErrorfrom the runtime JAR (class version 55.0 requires JDK 11+). The error gives no guidance about what version is needed.Root Cause
ensure_runtime_environment()insupport.pydetects the Java version via_detect_java_version()but never validates it meets the minimum requirement (JDK 11). The version is stored for API payloads but not checked.Fix
Added a version check immediately after
_detect_java_version(): if major version < 11, logs a clear error message explaining that JDK 11+ is required and returns False. This stops the pipeline before it hits the cryptic class version error.Test Coverage
3 new tests in
TestJdkVersionCheck:test_jdk8_rejected: JDK 8 returns Falsetest_jdk11_accepted: JDK 11 returns Truetest_jdk21_accepted: JDK 21 returns TrueTesting