Skip to content

Commit 39298fe

Browse files
authored
GH-36994: [Java] Use JDK 21 in CI (#38219)
### Rationale for this change Verify JDK 21 in CI in time for the Arrow v14 release. ### What changes are included in this PR? * Bump latest Java version from 20 -> 21 in CI ### Are these changes tested? Yes, via CI. ### Are there any user-facing changes? No. * Closes: #36994 Authored-by: Dane Pitkin <dane@voltrondata.com> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent 94ed8aa commit 39298fe

File tree

9 files changed

+32
-20
lines changed

9 files changed

+32
-20
lines changed

.github/workflows/java.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
strategy:
5858
fail-fast: false
5959
matrix:
60-
jdk: [8, 11, 17, 20]
60+
jdk: [8, 11, 17, 21]
6161
include:
6262
- jdk: 8
6363
title: AMD64 Debian 9 Java JDK 8 Maven 3.5.4
@@ -68,12 +68,12 @@ jobs:
6868
maven: 3.6.2
6969
image: debian-java
7070
- jdk: 17
71-
title: AMD64 Ubuntu 22.04 Java JDK 17 Maven 3.9.3
72-
maven: 3.9.3
71+
title: AMD64 Ubuntu 22.04 Java JDK 17 Maven 3.9.4
72+
maven: 3.9.4
7373
image: eclipse-java
74-
- jdk: 20
75-
title: AMD64 Ubuntu 22.04 Java JDK 20 Maven 3.9.3
76-
maven: 3.9.3
74+
- jdk: 21
75+
title: AMD64 Ubuntu 22.04 Java JDK 21 Maven 3.9.4
76+
maven: 3.9.4
7777
image: eclipse-java
7878
env:
7979
JDK: ${{ matrix.jdk }}

dev/release/verify-release-candidate.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,7 @@ maybe_setup_nodejs() {
565565
test_package_java() {
566566
show_header "Build and test Java libraries"
567567

568-
# Build and test Java (Requires newer Maven -- I used 3.3.9)
569-
# Pin OpenJDK 17 since OpenJDK 20 is incompatible with our versions
570-
# of things like Mockito, and we also can't update Mockito due to
571-
# not supporting Java 8 anymore
572-
maybe_setup_conda maven openjdk=17.0.3 || exit 1
568+
maybe_setup_conda maven openjdk || exit 1
573569

574570
pushd java
575571
if [ ${TEST_JAVA} -gt 0 ]; then

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,8 +1698,8 @@ services:
16981698
# docker-compose build eclipse-java
16991699
# docker-compose run eclipse-java
17001700
# Parameters:
1701-
# MAVEN: 3.9.3
1702-
# JDK: 17, 20
1701+
# MAVEN: 3.9.4
1702+
# JDK: 17, 21
17031703
image: ${ARCH}/maven:${MAVEN}-eclipse-temurin-${JDK}
17041704
shm_size: *shm-size
17051705
volumes: *java-volumes

docs/source/java/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Java Compatibility
3030
==================
3131

3232
Java modules are compatible with JDK 8 and above.
33-
Currently, JDK 8, 11, 17, and 18 are tested in CI.
33+
Currently, JDK 8, 11, 17, and 21 are tested in CI.
3434

3535
When using Java 9 or later, some JDK internals must be exposed by
3636
adding ``--add-opens=java.base/java.nio=ALL-UNNAMED`` to the ``java`` command:

java/flight/flight-sql-jdbc-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@
107107
<dependency>
108108
<groupId>org.mockito</groupId>
109109
<artifactId>mockito-core</artifactId>
110-
<version>4.11.0</version>
110+
<version>${mockito.core.version}</version>
111111
<scope>test</scope>
112112
</dependency>
113113

114114
<dependency>
115115
<groupId>org.mockito</groupId>
116116
<artifactId>mockito-inline</artifactId>
117-
<version>4.11.0</version>
117+
<version>${mockito.inline.version}</version>
118118
<scope>test</scope>
119119
</dependency>
120120

java/flight/flight-sql-jdbc-driver/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@
6868
<dependency>
6969
<groupId>org.mockito</groupId>
7070
<artifactId>mockito-core</artifactId>
71-
<version>4.11.0</version>
71+
<version>${mockito.core.version}</version>
7272
<scope>test</scope>
7373
</dependency>
7474

7575
<dependency>
7676
<groupId>org.mockito</groupId>
7777
<artifactId>mockito-inline</artifactId>
78-
<version>4.11.0</version>
78+
<version>${mockito.inline.version}</version>
7979
<scope>test</scope>
8080
</dependency>
8181

java/flight/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,17 @@
5252
</plugins>
5353
</pluginManagement>
5454
</build>
55+
56+
<profiles>
57+
<profile>
58+
<id>pin-mockito-jdk8</id>
59+
<activation>
60+
<jdk>1.8</jdk>
61+
</activation>
62+
<properties>
63+
<mockito.core.version>4.11.0</mockito.core.version>
64+
<mockito.inline.version>4.11.0</mockito.inline.version>
65+
</properties>
66+
</profile>
67+
</profiles>
5568
</project>

java/pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@
4444
<forkCount>2</forkCount>
4545
<checkstyle.failOnViolation>true</checkstyle.failOnViolation>
4646
<errorprone.javac.version>9+181-r4173-1</errorprone.javac.version>
47-
<error_prone_core.version>2.16</error_prone_core.version>
47+
<error_prone_core.version>2.22.0</error_prone_core.version>
4848
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
49+
<mockito.core.version>5.5.0</mockito.core.version>
50+
<mockito.inline.version>5.2.0</mockito.inline.version>
4951
</properties>
5052

5153
<scm>

java/vector/src/main/java/org/apache/arrow/vector/dictionary/DictionaryEncoder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,14 @@ public static ValueVector decode(ValueVector indices, Dictionary dictionary, Buf
112112
* @param valueCount dictionary vector valueCount.
113113
* @return index type.
114114
*/
115+
@SuppressWarnings("ComparisonOutOfRange")
115116
public static ArrowType.Int getIndexType(int valueCount) {
116117
Preconditions.checkArgument(valueCount >= 0);
117118
if (valueCount <= Byte.MAX_VALUE) {
118119
return new ArrowType.Int(8, true);
119120
} else if (valueCount <= Character.MAX_VALUE) {
120121
return new ArrowType.Int(16, true);
121-
} else if (valueCount <= Integer.MAX_VALUE) {
122+
} else if (valueCount <= Integer.MAX_VALUE) { //this comparison will always evaluate to true
122123
return new ArrowType.Int(32, true);
123124
} else {
124125
return new ArrowType.Int(64, true);

0 commit comments

Comments
 (0)