Skip to content

Upgrade to JDK 17#13

Merged
tdcmeehan merged 2 commits into
prestodb:masterfrom
imjalpreet:java17Upgrade
Apr 22, 2026
Merged

Upgrade to JDK 17#13
tdcmeehan merged 2 commits into
prestodb:masterfrom
imjalpreet:java17Upgrade

Conversation

@imjalpreet
Copy link
Copy Markdown
Member

@imjalpreet imjalpreet commented Apr 20, 2026

Required for prestodb/presto#24571

The changes have already been tested with CI in the above-linked PR.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 20, 2026

Reviewer's Guide

Upgrades the project to Java 17 by updating the Airlift parent, Maven plugins, Mockito, adding Maven wrapper support, and making small source/test adjustments for JDK 17 and newer Mockito APIs.

Flow diagram for Maven wrapper bootstrap and execution

flowchart TD
  A["Start mvnw"] --> B["Read .mvn/wrapper/maven-wrapper.properties"]
  B --> C{"Existing MAVEN_HOME for configured distribution?"}
  C -->|"Yes"| D["Use existing Maven distribution"]
  C -->|"No"| E["Create temp download directory"]
  E --> F{"unzip available?"}
  F -->|"Yes"| G["Download Maven .zip via wget/curl/Java"]
  F -->|"No"| H["Download Maven .tar.gz via wget/curl/Java"]
  G --> I["(Optional) Validate SHA-256 checksum"]
  H --> I
  I --> J{"Checksum valid or not configured?"}
  J -->|"No"| Z["Fail with error"]
  J -->|"Yes"| K["Extract Maven distribution"]
  K --> L["Locate extracted Maven bin directory"]
  L --> M["Move distribution to MAVEN_HOME"]
  D --> N["Set JAVA_HOME / detect java and javac"]
  M --> N
  N --> O["Execute mvn or mvnd from MAVEN_HOME with project pom.xml"]
  O --> P["Compile with source/target/release 17"]
  P --> Q["Run tests via maven-surefire-plugin (with add-opens)"]
  Q --> R["End mvnw run"]
Loading

File-Level Changes

Change Details Files
Update build configuration and dependencies for Java 17 compatibility.
  • Bump airbase parent POM from 97 to 108 to inherit newer plugin and dependency management suitable for JDK 17.
  • Set compiler source/target/release and targetJdk properties to 17.
  • Upgrade mockito-core test dependency to 4.11.0 for compatibility with newer JDKs.
  • Upgrade maven-shade-plugin from 2.4.3 to 3.6.0 to support modern Java versions.
  • Configure maven-surefire-plugin with --add-opens options for java.base internals and set a test.tmp.dir system property.
pom.xml
Introduce Maven Wrapper to standardize build tooling.
  • Add mvnw shell script (Maven Wrapper 3.3.4) to download and run a fixed Maven version.
  • Add .mvn/wrapper/maven-wrapper.properties pinning Maven 3.8.8 and script-only distribution.
mvnw
.mvn/wrapper/maven-wrapper.properties
Adjust tests to align with updated Mockito APIs and Java 17 requirements.
  • Replace custom Hamcrest BaseMatcher-based DoubleMatcher with a Mockito ArgumentMatcher and improve null-safety and description.
  • Change verify(checkMemory(...)) to use a lambda-based doubleThat matcher instead of the removed helper.
  • Modernize use of boxed primitive constructors to valueOf to avoid deprecated/new JDK warnings.
src/test/java/com/facebook/hive/orc/TestMemoryManager.java
src/test/java/com/facebook/hive/orc/TestOrcFile.java
Replace deprecated boxed primitive constructors with valueOf for JDK 17 compatibility in main code.
  • Use Long.valueOf instead of new Long when writing primitive numeric values into the buffer.
  • Use Integer.valueOf instead of new Integer when populating index maps and Text values.
src/main/java/com/facebook/hive/orc/WriterImpl.java
src/test/java/com/facebook/hive/orc/TestOrcFile.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In TestMemoryManager, the new closeTo helper returns an ArgumentMatcher but the call sites now use an inline lambda instead; either switch verify(...).checkMemory(...) back to using closeTo or remove the unused helper to avoid dead code.
  • The maven-surefire-plugin <argLine> configuration in pom.xml overwrites any existing argLine instead of appending, which can break other JVM args; consider using <argLine>${argLine} --add-opens ...</argLine> to preserve externally provided options.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `TestMemoryManager`, the new `closeTo` helper returns an `ArgumentMatcher` but the call sites now use an inline lambda instead; either switch `verify(...).checkMemory(...)` back to using `closeTo` or remove the unused helper to avoid dead code.
- The `maven-surefire-plugin` `<argLine>` configuration in `pom.xml` overwrites any existing `argLine` instead of appending, which can break other JVM args; consider using `<argLine>${argLine} --add-opens ...</argLine>` to preserve externally provided options.

## Individual Comments

### Comment 1
<location path="pom.xml" line_range="159-165" />
<code_context>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
</code_context>
<issue_to_address>
**issue:** Pin an explicit version for the maven-surefire-plugin to keep builds reproducible

This surefire config omits a `<version>`, so the actual version will depend on Maven defaults/parents and may change with tooling updates. Since you’re adding Java 17–specific flags, please pin a known Java 17–compatible surefire version (e.g. a 3.x release) to keep builds reproducible and avoid unexpected behavior changes.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread pom.xml
@tdcmeehan tdcmeehan merged commit 812ec6d into prestodb:master Apr 22, 2026
2 checks passed
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.

2 participants