Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
07da4b8
GEODE-10465: Migrate Apache Geode to Java 17 with comprehensive compa…
JinwooHwang Sep 18, 2025
ea64411
GEODE-10465: Fix JDK version in BUILDING.md
JinwooHwang Sep 19, 2025
b645c9b
GEODE-10465: Fix extra new line
JinwooHwang Sep 19, 2025
720895f
GEODE-10465: Upgrade to Java 17 in gradle.yml
JinwooHwang Sep 19, 2025
1878261
GEODE-10465: Fix error: package sun.security.x509 is not visible
JinwooHwang Sep 19, 2025
ac5f7a9
GEODE-10465: Fix the explicit export flag for the CI server
JinwooHwang Sep 19, 2025
ab90720
GEODE-10465: Fix the explicit export flag for javadoc
JinwooHwang Sep 19, 2025
179993d
GEODE-10465: Fix ClassCastException for CliFunctionResult
JinwooHwang Sep 19, 2025
1fbdad2
GEODE-10465: Update serialization analysis baselines for Java 17
JinwooHwang Sep 19, 2025
fe32358
GEODE-10465: Fix extra new line
JinwooHwang Sep 19, 2025
da0855d
GEODE-10465: Add exception handling for WAN acceptance test
JinwooHwang Sep 19, 2025
6a283ab
GEODE-10465: Add exception handling for WAN acceptance test
JinwooHwang Sep 19, 2025
faba36d
GEODE-10465: Add exception handling for WAN acceptance test
JinwooHwang Sep 20, 2025
89604c4
Revert "GEODE-10465: Add exception handling for WAN acceptance test"
JinwooHwang Sep 20, 2025
3dad40a
Revert "GEODE-10465: Add exception handling for WAN acceptance test"
JinwooHwang Sep 20, 2025
c91e2af
Revert "GEODE-10465: Add exception handling for WAN acceptance test"
JinwooHwang Sep 20, 2025
7dc4399
GEODE-10465: Groovy VM plugin cache corruption with the error Could n…
JinwooHwang Sep 20, 2025
4be2035
GEODE-10465: Groovy VM plugin cache corruption with the error Could n…
JinwooHwang Sep 20, 2025
58f0195
GEODE-10465: Add comprehensive diagnostic logging to failing acceptan…
JinwooHwang Sep 20, 2025
126854d
GEODE-10465: Replace System.out.println with Log4j logging in accepta…
JinwooHwang Sep 20, 2025
f96a745
Revert diagnostic logging changes from acceptance tests
JinwooHwang Sep 21, 2025
49af81b
GEODE-10465: Fix addIgnoredException
JinwooHwang Sep 21, 2025
5fc7c38
GEODE-10465: Fix addIgnoredException
JinwooHwang Sep 21, 2025
172176c
GEODE-10465: Java 17 migration
JinwooHwang Sep 21, 2025
e20ed7d
GEODE-10465: Add ignored exception for Gateway Sender remote locator …
JinwooHwang Sep 21, 2025
7362f67
GEODE-10465: Add ignored exception for Gateway Sender remote locator …
JinwooHwang Sep 21, 2025
5e87b47
GEODE-10465: Fix acceptance test failures due to Java 17 compatibilit…
JinwooHwang Sep 21, 2025
43ccf7d
GEODE-10465: Extra new line
JinwooHwang Sep 21, 2025
cda8f4f
GEODE-10465: Extra new line
JinwooHwang Sep 21, 2025
f64b8a5
GEODE-10465: Revert SeveralGatewayReceiversWithSamePortAndHostnameFor…
JinwooHwang Sep 21, 2025
ac51a7b
GEODE-10465: Fix Jetty 9 + Java 17 module system compatibility in dis…
JinwooHwang Sep 21, 2025
691a119
GEODE-10465: Fix Gradle compatibility and ArchUnit test failures for …
JinwooHwang Sep 21, 2025
f57db6b
GEODE-10465: Document Spotless exclusion for acceptance test gradle p…
JinwooHwang Sep 21, 2025
f511984
GEODE-10465: Update assembly content validation for Java 17 javadoc c…
JinwooHwang Sep 21, 2025
f783780
GEODE-10465: Fix java.lang.AssertionError: Suspicious strings were wr…
JinwooHwang Sep 22, 2025
f724ab9
Revert "GEODE-10465: Fix java.lang.AssertionError: Suspicious strings…
JinwooHwang Sep 22, 2025
49dd350
GEODE-10465: Fix SingleServerSNIAcceptanceTest Java version compatibi…
JinwooHwang Sep 22, 2025
191a28c
GEODE-10465: Remove extra new lines.
JinwooHwang Sep 22, 2025
ede537c
GEODE-10465: Remove architectual chage note. This test was updated to…
JinwooHwang Sep 23, 2025
c3c9322
GEODE-10465: Configure JDK compiler exports for Spotless and remove d…
JinwooHwang Sep 27, 2025
07c7825
GEODE-10465: Fix integration tests for javax.activation dependency ch…
JinwooHwang Sep 28, 2025
1052c4f
GEODE-10465: remove --add-exports
JinwooHwang Oct 1, 2025
1d4b939
Revert "GEODE-10465: remove --add-exports"
JinwooHwang Oct 1, 2025
3950d50
GEODE-10465: replace ALL-UNNAMED with com.diffplug.spotless
JinwooHwang Oct 1, 2025
2626d55
Revert "GEODE-10465: replace ALL-UNNAMED with com.diffplug.spotless"
JinwooHwang Oct 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Setup Java JDK
uses: actions/setup-java@v4.7.1
with:
java-version: 8
java-version: 17
distribution: temurin
cache: gradle

Expand Down
10 changes: 5 additions & 5 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Building this Release from Source

All platforms require a Java installation, with JDK 1.8 or more recent version.
All platforms require a Java installation, with JDK 17 or more recent version.

Set the JAVA\_HOME environment variable. For example:

| Platform | Command |
| :---: | --- |
| Unix | ``export JAVA_HOME=/usr/java/jdk1.8.0_121`` |
| OSX | ``export JAVA_HOME=`/usr/libexec/java_home -v 1.8` `` |
| Windows | ``set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_121"`` |
| Unix | ``export JAVA_HOME=/usr/java/jdk-17.0.16`` |
| OSX | ``export JAVA_HOME=`/usr/libexec/java_home -v 17.0.16` `` |
| Windows | ``set JAVA_HOME="C:\Program Files\Java\jdk-17.0.16"`` |

Download the project source from the Releases page at
[Apache Geode](http://geode.apache.org/releases/), and unpack the source code.
Expand Down Expand Up @@ -51,7 +51,7 @@ The following steps have been tested with **IntelliJ IDEA 2020.3.3**
* Set the Java SDK for the project.
1. Select **File -> Project Structure...** from the menu.
1. Open the **Project Settings -> Project** section.
1. Set **Project SDK** to your most recent Java 1.8 JDK.
1. Set **Project SDK** to your most recent Java 17 JDK.

* To automatically re-generate sources when needed (recommended).
1. Select **View -> Tool Windows -> Gradle** from the menu.
Expand Down
24 changes: 17 additions & 7 deletions build-tools/scripts/src/main/groovy/geode-java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ plugins {
id 'org.apache.geode.gradle.geode-dependency-constraints'
}

sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = 17
targetCompatibility = 17
compileJava.options.encoding = 'UTF-8'

dependencies {
Expand All @@ -31,17 +31,26 @@ dependencies {
}

String javaVersion = System.properties['java.version']
if (javaVersion.startsWith("1.8.0") && javaVersion.split("-")[0].split("_")[1].toInteger() < 121) {
throw new GradleException("Java version 1.8.0_121 or later required, but was " + javaVersion)
def versionMajor = JavaVersion.current().majorVersion.toInteger()
if (versionMajor < 17) {
throw new GradleException("Java version 17 or later required, but was " + javaVersion)
}

// apply compiler options
gradle.taskGraph.whenReady({ graph ->
tasks.withType(JavaCompile).each { javac ->
javac.configure {
sourceCompatibility '1.8'
targetCompatibility '1.8'
sourceCompatibility '17'
targetCompatibility '17'
Copy link
Member

Choose a reason for hiding this comment

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

sourceCompatibility = 17 is repeated again inside whenReady. May be we can use toolchains; it’s the canonical way for JDK 17?

diff --git a/build-tools/scripts/src/main/groovy/geode-java.gradle b/build-tools/scripts/src/main/groovy/geode-java.gradle
index bfd667d160a3..4bb2f5f3ce2e 100644
--- a/build-tools/scripts/src/main/groovy/geode-java.gradle
+++ b/build-tools/scripts/src/main/groovy/geode-java.gradle
@@ -20,12 +20,14 @@ plugins {
   id 'org.apache.geode.gradle.geode-dependency-constraints'
 }
 
-sourceCompatibility = 17
-targetCompatibility = 17
+// Prefer toolchains over hard-coding source/target; ensures reproducible builds on CI/dev
+java {
+  toolchain { languageVersion = JavaLanguageVersion.of(17) }
+}
 compileJava.options.encoding = 'UTF-8'
 
 dependencies {
   implementation(platform(project(':boms:geode-all-bom')))
   implementation('org.apache.logging.log4j:log4j-api')
 }
 
 String javaVersion = System.properties['java.version']
@@ -37,27 +39,13 @@ if (versionMajor < 17) {
   throw new GradleException("Java version 17 or later required, but was " + javaVersion)
 }
 
-// apply compiler options
-gradle.taskGraph.whenReady({ graph ->
-  tasks.withType(JavaCompile).each { javac ->
-    javac.configure {
-      sourceCompatibility '17'
-      targetCompatibility '17'
-      options.encoding = 'UTF-8'
-      options.compilerArgs.addAll([
-        '--add-exports=java.management/com.sun.jmx.remote.security=ALL-UNNAMED',
-        '--add-exports=java.base/sun.nio.ch=ALL-UNNAMED',
-        '--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED',
-        '--add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED',
-        '-Xlint:-removal',
-        '-Xlint:-deprecation'
-      ])
-    }
-    javac.options.incremental = true
-    javac.options.fork = true
-  }
-})
+// Apply modern, minimal compiler settings
+tasks.withType(JavaCompile).configureEach {
+  options.release = 17
+  options.encoding = 'UTF-8'
+  options.incremental = true
+  options.fork = true
+}
 
 // ... (rest of file unchanged)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent observation @sboorlagadda . Let me use toolchains instead. Thank you

options.encoding = 'UTF-8'
options.compilerArgs.addAll([
'--add-exports=java.management/com.sun.jmx.remote.security=ALL-UNNAMED',
'--add-exports=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED',
'--add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED',
'-Xlint:-removal',
'-Xlint:-deprecation'
])
}
javac.options.incremental = true
javac.options.fork = true
Expand Down Expand Up @@ -183,7 +192,8 @@ artifacts {

javadoc {
destinationDir = file("$buildDir/javadoc")
options.addStringOption('Xwerror', '-quiet')
// Disabled strict HTML checking for Java 17 compatibility
options.addStringOption('Xdoclint:none', '-quiet')
options.encoding = 'UTF-8'
exclude "**/internal/**"

Expand Down
4 changes: 2 additions & 2 deletions build-tools/scripts/src/main/groovy/warnings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
*/

tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked' << "-Werror"
options.deprecation = true
options.compilerArgs << '-Xlint:-unchecked' << "-Werror" << '-Xlint:-deprecation' << '-Xlint:-removal'
options.deprecation = false
}
10 changes: 8 additions & 2 deletions geode-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ dependencies {
distributedTestRuntimeOnly('io.swagger.core.v3:swagger-annotations')
distributedTestRuntimeOnly(project(':geode-wan'))

// JAXB dependencies for Java 11+ compatibility (removed from JDK)
distributedTestCompileOnly('javax.xml.bind:jaxb-api')
distributedTestImplementation('javax.xml.bind:jaxb-api')
distributedTestImplementation('com.sun.xml.bind:jaxb-impl')

acceptanceTestImplementation(project(':geode-server-all'))
acceptanceTestImplementation(project(':geode-dunit')) {
exclude module: 'geode-core'
Expand Down Expand Up @@ -389,8 +394,9 @@ tasks.register('gfshDepsJar', Jar) {

tasks.register('docs', Javadoc) {
def docsDir = file("$buildDir/javadocs")
options.addStringOption('Xwerror', '-quiet')
options.links("https://docs.oracle.com/javase/8/docs/api/")
// Removed -Xwerror to avoid treating HTML5 compatibility warnings as errors
options.addStringOption('Xdoclint:none', '-quiet')
options.links("https://docs.oracle.com/en/java/javase/17/docs/api/")
options.encoding = 'UTF-8'
title = "${productName} ${project.version}"
destinationDir = docsDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public void uncheckedCast_rawList_wrongTypes() {
rawList.add(2);
List<String> wrongType = uncheckedCast(rawList);

Throwable thrown = catchThrowable(() -> wrongType.get(0));
Throwable thrown = catchThrowable(() -> {
String str = wrongType.get(0); // This should throw ClassCastException
});

assertThat(thrown).isInstanceOf(ClassCastException.class);
}
Expand Down
5 changes: 5 additions & 0 deletions geode-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,11 @@ dependencies {
jmhImplementation('org.jctools:jctools-core')
}

// Exclude legacy doclet that uses removed com.sun.javadoc API (Java 9+)
compileTestJava {
exclude '**/UnitTestDoclet.java'
}

tasks.eclipse.dependsOn(generateGrammarSource)

distributedTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public void compileOrderByClause(final int numOfChildren) {
}

public void compileGroupByClause(final int numOfChildren) {
final List<CompiledPath> list = new ArrayList<>();
final List<CompiledValue> list = new ArrayList<>();
Copy link
Contributor

@leonfin leonfin Sep 19, 2025

Choose a reason for hiding this comment

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

just FYI with (3 different AI reviews and they all say the same)

  • Complexity: Repeatedly inserting at index 0 on an ArrayList is O(n) per insertion due to shifting elements. For n items, this becomes O(n^2).
 public void compileGroupByClause(final int numOfChildren) {
    final List<CompiledValue> list = new ArrayList<>();
    for (int i = 0; i < numOfChildren; i++) {
      list.add(TypeUtils.checkCast(pop(), CompiledValue.class));
    }
    // reverse to preserve original left-to-right order without O(n^2) insert-at-zero
    java.util.Collections.reverse(list);
    push(list);
  }

But this is just a 'group by' case so I don't think it matters since group by can't be big at all to matter

Copy link
Member

Choose a reason for hiding this comment

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

Question: does the evaluator elsewhere require CompiledPaths?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sboorlagadda , the evaluator components work entirely through the CompiledValue interface and don't need the specific CompiledPath type.

for (int i = 0; i < numOfChildren; i++) {
list.add(0, pop());
list.add(0, TypeUtils.checkCast(pop(), CompiledValue.class));
}
push(list);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public void getRebalanceWithOperationResultThatFailedCorrectlySetsStatusMessage(
OperationState operationState = mock(OperationState.class);
when(operationManager.get(any())).thenReturn(operationState);
when(operationState.getOperationEnd()).thenReturn(new Date());
OperationResult operationResult = mock(OperationResult.class);
RebalanceResult operationResult = mock(RebalanceResult.class);
when(operationResult.getSuccess()).thenReturn(false);
when(operationResult.getStatusMessage()).thenReturn("Failure status message.");
when(operationState.getResult()).thenReturn(operationResult);
Expand All @@ -601,7 +601,7 @@ public void getRebalanceWithOperationResultThatSucceededCorrectlySetsStatusMessa
OperationState operationState = mock(OperationState.class);
when(operationManager.get(any())).thenReturn(operationState);
when(operationState.getOperationEnd()).thenReturn(new Date());
OperationResult operationResult = mock(OperationResult.class);
RebalanceResult operationResult = mock(RebalanceResult.class);
when(operationResult.getSuccess()).thenReturn(true);
when(operationResult.getStatusMessage()).thenReturn("Success status message.");
when(operationState.getResult()).thenReturn(operationResult);
Expand Down
4 changes: 4 additions & 0 deletions geode-gfsh/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ dependencies {
implementation('com.fasterxml.jackson.core:jackson-databind')
implementation('io.swagger.core.v3:swagger-annotations')

// JAXB dependencies needed for Java 11+
implementation('javax.xml.bind:jaxb-api')
implementation('com.sun.xml.bind:jaxb-impl')
Copy link
Member

Choose a reason for hiding this comment

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

Should we also add activation? On Java 11+, JAXB is no longer in the JDK. This combo can work, but you often also need activation. Newer stacks prefer Jakarta (jakarta.xml.bind).

implementation 'javax.xml.bind:jaxb-api:2.3.1'
runtimeOnly    'com.sun.xml.bind:jaxb-impl:2.3.3'
runtimeOnly    'com.sun.activation:javax.activation:1.2.0'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sboorlagadda , Good point. I am migrating jaxb to jakarta in the next project. We will use jakarta activation. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sboorlagadda , the evaluator components work entirely through the CompiledValue interface and don't need the specific CompiledPath type.


// //Find bugs is used in multiple places in the code to suppress findbugs warnings
testImplementation('com.github.stephenc.findbugs:findbugs-annotations')
testImplementation('org.springframework:spring-test')
Expand Down
Loading
Loading