Skip to content

Commit

Permalink
GH-38051: [Java] Remove Java 8 support (#43139)
Browse files Browse the repository at this point in the history
### What changes are included in this PR?

* Remove support for Java 8 in Github actions and other CI/CD tasks and make Java 11 now the default version
* Make Java 11 the minimum version required to build and run Arrow by changing the Maven project configuration:
  - Change minimum java version and source/target/release compiler properties to 11
  - Remove `maven` modules
  - Remove jdk11+ profiles and integrate their content into the main section
  - Let maven-compiler-plugin process `module-info.java` files and address several declaration issues
  - Exclude non modularized modules from javadoc aggregate tasks
  - Exclude module-info.class files from shaded jars as it is not representative of the whole content and may actually directly coming from a 3rd party dependency.
* Update documentation

### Are these changes tested?

Through CI/CD.

### Are there any user-facing changes?

Yes. Java 11 is now required to run any Arrow code

**This PR includes breaking changes to public APIs.**

* GitHub Issue: #38051

Authored-by: Laurent Goujon <[email protected]>
Signed-off-by: Dane Pitkin <[email protected]>
  • Loading branch information
laurentgo authored Jul 17, 2024
1 parent a137687 commit 4161898
Show file tree
Hide file tree
Showing 37 changed files with 136 additions and 1,033 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ GCC_VERSION=""
GO=1.21.8
STATICCHECK=v0.4.7
HDFS=3.2.1
JDK=8
JDK=11
KARTOTHEK=latest
# LLVM 12 and GCC 11 reports -Wmismatched-new-delete.
LLVM=14
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
strategy:
fail-fast: false
matrix:
jdk: [8, 11, 17, 21, 22]
jdk: [11, 17, 21, 22]
maven: [3.9.6]
image: [java]
env:
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/conda-integration.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ARG arch=amd64
ARG maven=3.8.7
ARG node=16
ARG yarn=1.22
ARG jdk=8
ARG jdk=11
ARG go=1.21.8

# Install Archery and integration dependencies
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/conda-python-hdfs.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARG arch=amd64
ARG python=3.8
FROM ${repo}:${arch}-conda-python-${python}

ARG jdk=8
ARG jdk=11
ARG maven=3.8.7
RUN mamba install -q -y \
maven=${maven} \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/conda-python-spark.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ARG arch=amd64
ARG python=3.8
FROM ${repo}:${arch}-conda-python-${python}

ARG jdk=8
ARG jdk=11
ARG maven=3.8.7

ARG numpy=latest
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/java-jni-manylinux-201x.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ RUN vcpkg install \
--x-feature=s3

# Install Java
ARG java=1.8.0
ARG java=11
ARG maven=3.9.3
RUN yum install -y java-$java-openjdk-devel && \
yum clean all && \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/linux-apt-docs.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ARG base
FROM ${base}

ARG r=4.4
ARG jdk=8
ARG jdk=11

ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

Expand Down
6 changes: 3 additions & 3 deletions dev/conbench_envs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ Here are steps how `@ursabot` benchmark builds use `benchmarks.env` and `hooks.s

### 2. Install Arrow dependencies for Java
sudo su
apt-get install openjdk-8-jdk
apt-get install openjdk-11-jdk
apt-get install maven

Verify that you have at least these versions of `java`, `javac` and `maven`:

# java -version
openjdk version "1.8.0_292"
openjdk version "11.0.22" 2024-01-16
..
# javac -version
javac 1.8.0_292
javac 11.0.22
...
# mvn -version
Apache Maven 3.6.3
Expand Down
4 changes: 3 additions & 1 deletion dev/release/setup-rhel-rebuilds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dnf -y install \
cmake \
git \
gobject-introspection-devel \
java-1.8.0-openjdk-devel \
java-11-openjdk-devel \
libcurl-devel \
llvm-devel \
llvm-toolset \
Expand All @@ -55,3 +55,5 @@ npm install -g yarn

python3 -m ensurepip --upgrade
alternatives --set python /usr/bin/python3
alternatives --set java java-11-openjdk.$(uname -i)
alternatives --set javac java-11-openjdk.$(uname -i)
2 changes: 1 addition & 1 deletion dev/release/verify-release-candidate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Requirements
# - Ruby >= 2.3
# - Maven >= 3.8.7
# - JDK >=8
# - JDK >= 11
# - gcc >= 4.8
# - Node.js >= 18
# - Go >= 1.21
Expand Down
13 changes: 1 addition & 12 deletions dev/tasks/tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,6 @@ tasks:
- arrow-jdbc-{no_rc_snapshot_version}-tests.jar
- arrow-jdbc-{no_rc_snapshot_version}.jar
- arrow-jdbc-{no_rc_snapshot_version}.pom
- arrow-maven-plugins-{no_rc_snapshot_version}-cyclonedx.json
- arrow-maven-plugins-{no_rc_snapshot_version}-cyclonedx.xml
- arrow-maven-plugins-{no_rc_snapshot_version}.pom
- arrow-memory-core-{no_rc_snapshot_version}-cyclonedx.json
- arrow-memory-core-{no_rc_snapshot_version}-cyclonedx.xml
- arrow-memory-core-{no_rc_snapshot_version}-javadoc.jar
Expand Down Expand Up @@ -843,12 +840,6 @@ tasks:
- flight-sql-jdbc-driver-{no_rc_snapshot_version}-tests.jar
- flight-sql-jdbc-driver-{no_rc_snapshot_version}.jar
- flight-sql-jdbc-driver-{no_rc_snapshot_version}.pom
- module-info-compiler-maven-plugin-{no_rc_snapshot_version}-cyclonedx.json
- module-info-compiler-maven-plugin-{no_rc_snapshot_version}-cyclonedx.xml
- module-info-compiler-maven-plugin-{no_rc_snapshot_version}-javadoc.jar
- module-info-compiler-maven-plugin-{no_rc_snapshot_version}-sources.jar
- module-info-compiler-maven-plugin-{no_rc_snapshot_version}.jar
- module-info-compiler-maven-plugin-{no_rc_snapshot_version}.pom

############################## NuGet packages ###############################

Expand Down Expand Up @@ -1549,9 +1540,7 @@ tasks:
image: conda-python-hdfs
{% endfor %}

{% for python_version, spark_version, test_pyarrow_only, numpy_version, jdk_version in [("3.8", "v3.5.0", "false", "latest", "8"),
("3.10", "v3.5.0", "false", "1.23", "8"),
("3.11", "master", "false", "latest", "17")] %}
{% for python_version, spark_version, test_pyarrow_only, numpy_version, jdk_version in [("3.11", "master", "false", "latest", "17")] %}
test-conda-python-{{ python_version }}-spark-{{ spark_version }}:
ci: github
template: docker-tests/github.linux.yml
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ services:
build:
args:
base: ${REPO}:${ARCH}-python-${PYTHON}-wheel-manylinux-2014-vcpkg-${VCPKG}
java: 1.8.0
java: 11
context: .
dockerfile: ci/docker/java-jni-manylinux-201x.dockerfile
cache_from:
Expand Down Expand Up @@ -1747,7 +1747,7 @@ services:
# docker-compose run java
# Parameters:
# MAVEN: 3.9.5
# JDK: 8, 11, 17, 21
# JDK: 11, 17, 21
image: ${ARCH}/maven:${MAVEN}-eclipse-temurin-${JDK}
shm_size: *shm-size
volumes: &java-volumes
Expand Down
2 changes: 1 addition & 1 deletion docs/source/developers/java/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Arrow Java uses the `Maven <https://maven.apache.org/>`_ build system.

Building requires:

* JDK 8+
* JDK 11+
* Maven 3+

.. note::
Expand Down
2 changes: 1 addition & 1 deletion docs/source/java/flight_sql_jdbc_driver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This driver can be used with any database that implements Flight SQL.
Installation and Requirements
=============================

The driver is compatible with JDK 8+. On JDK 9+, the following JVM
The driver is compatible with JDK 11+. Note that the following JVM
parameter is required:

.. code-block:: shell
Expand Down
4 changes: 2 additions & 2 deletions docs/source/java/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ Java Compatibility
==================

Java modules are compatible with JDK 8 and above. Currently, JDK versions
8, 11, 17, and 21 are tested in CI. The latest JDK is also tested in CI.
11, 17, and 21 are tested in CI. The latest JDK is also tested in CI.

When using Java 9 or later, some JDK internals must be exposed by
Note that some JDK internals must be exposed by
adding ``--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`` to the ``java`` command:

.. code-block:: shell
Expand Down
2 changes: 1 addition & 1 deletion java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ variable are set, the system property takes precedence.

## Java Properties

* For Java 9 or later, should set `-Dio.netty.tryReflectionSetAccessible=true`.
* `-Dio.netty.tryReflectionSetAccessible=true` should be set.
This fixes `java.lang.UnsupportedOperationException: sun.misc.Unsafe or java.nio.DirectByteBuffer.(long, int) not available`. thrown by Netty.
* To support duplicate fields in a `StructVector` enable `-Darrow.struct.conflict.policy=CONFLICT_APPEND`.
Duplicate fields are ignored (`CONFLICT_REPLACE`) by default and overwritten. To support different policies for
Expand Down
45 changes: 25 additions & 20 deletions java/adapter/jdbc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ under the License.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>test</scope>
</dependency>

<dependency>
Expand All @@ -93,24 +92,30 @@ under the License.

</dependencies>

<profiles>
<profile>
<id>jdk11+</id>
<activation>
<jdk>[11,]</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.self="override">
<argLine>--add-reads=org.apache.arrow.adapter.jdbc=com.fasterxml.jackson.dataformat.yaml --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED -Duser.timezone=UTC</argLine>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>analyze</id>
<phase>verify</phase>
<configuration>
<ignoredNonTestScopedDependencies>
<ignoredNonTestScopedDependency>com.fasterxml.jackson.core:jackson-annotations</ignoredNonTestScopedDependency>
</ignoredNonTestScopedDependencies>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration combine.self="override">
<argLine>--add-reads=org.apache.arrow.adapter.jdbc=com.fasterxml.jackson.dataformat.yaml --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED -Duser.timezone=UTC</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions java/adapter/jdbc/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
exports org.apache.arrow.adapter.jdbc;
exports org.apache.arrow.adapter.jdbc.binder;

requires com.fasterxml.jackson.annotation;
requires com.fasterxml.jackson.databind;
requires java.sql;
requires jdk.unsupported;
Expand Down
6 changes: 4 additions & 2 deletions java/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ under the License.
<properties>
<arrow.vector.classifier></arrow.vector.classifier>
<!-- org.apache:apache overrides -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<minimalJavaBuildVersion>11</minimalJavaBuildVersion>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<maven.plugin.tools.version>3.12.0</maven.plugin.tools.version>
<surefire.version>3.2.5</surefire.version>
<version.apache-rat-plugin>0.16.1</version.apache-rat-plugin>
Expand Down
22 changes: 2 additions & 20 deletions java/dataset/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ under the License.
<scope>test</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
Expand All @@ -179,6 +180,7 @@ under the License.
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine combine.self="override">--add-reads=org.apache.arrow.dataset=com.fasterxml.jackson.databind --add-opens=java.base/java.nio=org.apache.arrow.dataset,org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
<enableAssertions>false</enableAssertions>
<systemPropertyVariables>
<arrow.test.dataRoot>${project.basedir}/../../testing/data</arrow.test.dataRoot>
Expand All @@ -202,24 +204,4 @@ under the License.
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jdk11+</id>
<activation>
<jdk>[11,]</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine combine.self="override">--add-reads=org.apache.arrow.dataset=com.fasterxml.jackson.databind --add-opens=java.base/java.nio=org.apache.arrow.dataset,org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
25 changes: 2 additions & 23 deletions java/flight/flight-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@ under the License.
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine combine.self="override">--add-opens=org.apache.arrow.flight.core/org.apache.arrow.flight.perf.impl=protobuf.java --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
<enableAssertions>false</enableAssertions>
<systemPropertyVariables>
<arrow.test.dataRoot>${project.basedir}/../../../testing/data</arrow.test.dataRoot>
Expand Down Expand Up @@ -198,27 +200,4 @@ under the License.
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jdk11+</id>
<activation>
<jdk>[11,]</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine combine.self="override">--add-opens=org.apache.arrow.flight.core/org.apache.arrow.flight.perf.impl=protobuf.java --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
<systemPropertyVariables>
<arrow.test.dataRoot>${project.basedir}/../../../testing/data</arrow.test.dataRoot>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
3 changes: 3 additions & 0 deletions java/flight/flight-core/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@
requires io.grpc.netty;
requires io.grpc.protobuf;
requires io.grpc.stub;
requires io.netty.buffer;
requires io.netty.common;
requires io.netty.handler;
requires io.netty.transport;
requires jsr305;
requires org.apache.arrow.format;
requires org.apache.arrow.memory.core;
requires org.apache.arrow.vector;
requires protobuf.java;
requires protobuf.java.util;
requires org.slf4j;
}
Loading

0 comments on commit 4161898

Please sign in to comment.