Skip to content

fix: reject JDK < 11 early with clear error message#2066

Open
mashraf-222 wants to merge 1 commit intomainfrom
fix/early-jdk-version-check
Open

fix: reject JDK < 11 early with clear error message#2066
mashraf-222 wants to merge 1 commit intomainfrom
fix/early-jdk-version-check

Conversation

@mashraf-222
Copy link
Copy Markdown
Contributor

Problem

When running codeflash with JDK 8, the pipeline fails late with a cryptic UnsupportedClassVersionError from 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() in support.py detects 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 False
  • test_jdk11_accepted: JDK 11 returns True
  • test_jdk21_accepted: JDK 21 returns True

Testing

$ uv run pytest tests/test_languages/test_java/test_support.py::TestJdkVersionCheck -v
3 passed

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>
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