Skip to content

Java 17 support#72

Open
ostinru wants to merge 12 commits intoapache:mainfrom
ostinru:java-17
Open

Java 17 support#72
ostinru wants to merge 12 commits intoapache:mainfrom
ostinru:java-17

Conversation

@ostinru
Copy link
Collaborator

@ostinru ostinru commented Mar 1, 2026

Add java 17 support to cloudberry-pxf:

  • Update gradle to 7.x:
    cd server && ./gradlew wrapper --gradle-version 7.6
  • Update gradle plugins to work with newer gradle
  • Add --add-options to jvmArgs to bypass JEP486 limitations
  • Add -Xlint:-removal - do not treat removal warnings as warnings (it breaks build when run with -Werror)
  • CI: add java version compatibility tests (run JUnit tests)
  • Automation: remove JUnit tests from automation tests - save a bit of developer's time


# Detect Java major version and add --add-opens flags for Java 11+
local java_major_version
java_major_version=$("$javaexe" -version 2>&1 | head -1 | sed -E 's/.*version "([0-9]+).*/\1/')
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Examples:

1.8.0_472 -> 1
11.0.30 -> 11
17.0.14 -> 17

Copy link
Collaborator

@MisterRaindrop MisterRaindrop Mar 5, 2026

Choose a reason for hiding this comment

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

if java9 java10 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. I have found out that java can print some garbage to stdout... should filter it before head -1.
  2. Java 9 and 10:
    openjdk version "9.0.4" -> 9
    openjdk version "10.0.2-adoptopenjdk" 2018-07-17 -> 10
    And more interesting java 9+ supports--add-opens (JEP 261). However it seems to be optional until Java 16/17 (not sure)(JEP 396/403)

PS: java8 - doesn't support --add-opens that why I have added this IF statement

java  --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED
Unrecognized option: --add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED

@ostinru
Copy link
Collaborator Author

ostinru commented Mar 1, 2026

The code is ready for review (any comments are welcomed). However I will keep it in draft for manual testing with java 8 / non-openJDK (testing doesn't covers server/pxf-service/src/scripts/pxf script).

UPD: tested bash with
openjdk version "17.0.18" 2026-01-20 LTS
OpenJDK Runtime Environment (Temurin)(build 1.8.0_482-b08)

@ostinru ostinru marked this pull request as ready for review March 3, 2026 17:35

# Detect Java major version and add --add-opens flags for Java 11+
local java_major_version
java_major_version=$("$javaexe" -version 2>&1 | head -1 | sed -E 's/.*version "([0-9]+).*/\1/')
Copy link
Collaborator

@MisterRaindrop MisterRaindrop Mar 5, 2026

Choose a reason for hiding this comment

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

if java9 java10 ?

"-Xlint:empty", "-Xlint:finally", "-Xlint:overrides", "-Xlint:path", "-Xlint:-processing", "-Xlint:static",
"-Xlint:try", "-Xlint:fallthrough", "-Xlint:unchecked", "-Xlint:-options", "-Werror"
]
options.compilerArgs += JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17) ? ["-Xlint:-removal"] : []
Copy link
Collaborator

Choose a reason for hiding this comment

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

-Xlint:-removal Should we document which APIs will be replaced in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently it complains about

/Users/ostinru/development/cloudberry-pxf/server/pxf-api/src/main/java/org/apache/cloudberry/pxf/api/security/GSSCredentialProvider.java:22: warning: [removal] AccessController in java.security has been deprecated and marked for removal
import java.security.AccessController;
                    ^

It is from JEP 411: Deprecate the Security Manager for Removal (Java 17).
And it will work up until JEP 486: Permanently Disable the Security Manager (Java 24). Probably, it will continue working.

It was added in 79be3d5 "Enabled Kerberos Constrained Delegation impersonation for secure clusters (#707)". And... it seems that we don't have these tests running.


Summary: I will add a comments about which warnings we should fix.


test {
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
jvmArgs = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

jvmArgs+ is better ?

runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '17' ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

{ matrix.Java } I see the task is already running, which means both uppercase and lowercase are fine. However, it seems like the inconsistency in capitalization might look better if unified. Of course, this is just a suggestion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thank you for thoughtful review!

@ostinru ostinru requested a review from MisterRaindrop March 9, 2026 11:47
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