Skip to content

fix: use the JDK version from the JAR when no language version is recorded - #1466

Open
lenamonj wants to merge 1 commit into
oracle:mainfrom
lenamonj:1464-maven-spec-jdk-version
Open

fix: use the JDK version from the JAR when no language version is recorded#1466
lenamonj wants to merge 1 commit into
oracle:mainfrom
lenamonj:1464-maven-spec-jdk-version

Conversation

@lenamonj

@lenamonj lenamonj commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Use the JDK version read from the Maven Central JAR when the database has no recorded language version.

Description of changes

selected_jdk_version = jdk_from_jar or existing if existing else "8" parses as (jdk_from_jar or existing) if existing else "8", so with no existing language_version the JAR's JDK version was discarded and the spec defaulted to 8. The expression is now jdk_from_jar or existing or "8", the order the comment above it describes. A parametrized test covers the four combinations.

Validate: pytest tests/build_spec_generator/common_spec/test_maven_spec.py fails on main for the JAR-without-existing case and passes with this change; make check and make test pass.

Related issues

Closes #1464

Checklist

  • I have reviewed the contribution guide.
  • My PR title and commits follow the Conventional Commits convention.
  • My commits include the "Signed-off-by" line.
  • I have signed my commits following the instructions provided by GitHub.
  • I have updated the relevant documentation, if applicable.
  • I have tested my changes and verified they work as expected.

…orded

The expression jdk_from_jar or existing if existing else "8" parses as (jdk_from_jar or existing) if existing else "8", so with no recorded language version the JDK version read from the Maven Central JAR was discarded and the spec defaulted to 8. The order is now JAR, then the existing value, then the default, as the comment above it describes.

Closes oracle#1464

Signed-off-by: Jeff Lenamon <jlenamon@gmail.com>
@lenamonj
lenamonj requested a review from behnazh-w as a code owner September 6, 2026 20:32
@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Sep 6, 2026

@behnazh-w behnazh-w left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for spotting this issue and creating the PR. To be able to merge it, could you please sign the Oracle Contributor Agreement (OCA)?

@lenamonj

lenamonj commented Sep 7, 2026

Copy link
Copy Markdown
Author

Thanks for the review. The OCA was submitted on 6 September and is under review on Oracle's side; the check should turn green once it is recorded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MavenBuildSpec discards the JDK version read from the JAR when no language version is recorded

2 participants