Skip to content

Fix JmsIO finalize removal warning and clean up stale Java version logic - #40595

Merged
Abacn merged 1 commit into
apache:masterfrom
Abacn:enable-errorprone
Oct 15, 2026
Merged

Abacn merged 1 commit into
apache:masterfrom
Abacn:enable-errorprone

Conversation

@Abacn

@Abacn Abacn commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
  • Replace -source/-target with --release as we no longer support Java8 (that did not recognize --release)

  • Enable ErrorProne and CheckerFramework in Java21 when fork compiler

  • Suppress removal in JmsIO

After #38729, JmsIO requires Java17+.

In Presubmit, we use Java21, and set --release 17 for JmsIO.

In Nightly Release, we set Java version to 11 and use -Pjava21Home=..., instructing jms component compiled with a forked compiler. JDK 21's javac is invoked with -source 17 -target 17 instead of --release 17, it compiles against JDK 21's java.base system classes (where Object.finalize() has forRemoval = true), triggering [removal].

The fix is to use --release everywhere. -source x -target x was due to Java8 not supporting --release flag and no longer needed.

- Replace `-source`/`-target` with `--release` as we no longer support Java8 (that did not recognize `--release`)

- Enable ErrorProne and CheckerFramework in Java21 when fork compiler

- Suppress `removal` in JmsIO
@Abacn

Abacn commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

cc: @damccorm @stankiewicz turns out we still need this change to bring Nightly snapshot release back

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📋 Review Summary

This PR cleanly resolves the JDK 21 [removal] warning on Object.finalize() in JmsIO during cross-compilation by switching setCompileAndRuntimeJavaVersion from -source/-target to --release and suppressing removal on UnboundedJmsReader.finalize(). It also re-enables ErrorProne and Checker Framework when forking compilation to JDK 17/21.

🔍 General Feedback

  • Switching setCompileAndRuntimeJavaVersion to --release is a solid improvement now that Java 8 is no longer supported, ensuring forked compilers check against the target JDK's symbol definitions rather than the forked JDK's runtime classes.
  • Enabling ErrorProne (for Java 17 and 21) and Checker Framework (for Java 21) when compiling with a forked JDK aligns forked builds with standard presubmit checks while appropriately keeping them disabled for Java 25.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@Abacn
Abacn merged commit b7907d7 into apache:master Oct 15, 2026
24 of 25 checks passed
@Abacn
Abacn deleted the enable-errorprone branch October 15, 2026 15:31
Abacn added a commit that referenced this pull request Oct 15, 2026
* Partly revert #40595: setCompileAndRuntimeJavaVersion logic wasn't stale
  it's needed to resolve errorprone x Gradle known issue compatibility

* Clean up Java8 leftovers in setJavaVerOptions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants