Skip to content

Commit 3a1498b

Browse files
authored
MINOR: Update google-java-format and test Java 25 in CI (#1265)
## What's Changed - Test Java 25 (LTS) instead of Java 23 - Update google-java-format since it broke on Java 25 - Reformat code - Deduplicate/make argLine config consistent - Update flags and docs for Java 25
1 parent ec6eb67 commit 3a1498b

11 files changed

Lines changed: 99 additions & 77 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
strategy:
4646
fail-fast: false
4747
matrix:
48-
jdk: [17, 21, 23]
49-
maven: [3.9.9]
48+
jdk: [17, 21, 25]
49+
maven: [3.9.16]
5050
image: [ubuntu, conda-jni-cdata]
5151
include:
5252
- image: ubuntu

adapter/avro/src/main/java/org/apache/arrow/adapter/avro/ArrowToAvroUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ private static BaseAvroProducer<?> createProducer(
601601
case VARCHAR:
602602
return new AvroStringProducer((VarCharVector) vector);
603603

604-
// Logical types
604+
// Logical types
605605

606606
case DECIMAL:
607607
return new AvroDecimalProducer((DecimalVector) vector);
@@ -636,7 +636,7 @@ private static BaseAvroProducer<?> createProducer(
636636
case TIMESTAMPNANOTZ:
637637
return new AvroTimestampNanoTzProducer((TimeStampNanoTZVector) vector);
638638

639-
// Complex types
639+
// Complex types
640640

641641
case STRUCT:
642642
StructVector structVector = (StructVector) vector;
@@ -679,9 +679,9 @@ private static BaseAvroProducer<?> createProducer(
679679
new AvroStructProducer(entryVector, new Producer<?>[] {keyProducer, valueProducer});
680680
return new AvroMapProducer(mapVector, entryProducer);
681681

682-
// Support for UNION and DENSEUNION is not currently available
683-
// This is pending fixes in the implementation of the union vectors themselves
684-
// https://github.com/apache/arrow-java/issues/108
682+
// Support for UNION and DENSEUNION is not currently available
683+
// This is pending fixes in the implementation of the union vectors themselves
684+
// https://github.com/apache/arrow-java/issues/108
685685

686686
default:
687687
// Not all Arrow types are supported for encoding (yet)!

adapter/jdbc/pom.xml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ under the License.
3232
<description>(Contrib/Experimental)A library for converting JDBC data to Arrow data.</description>
3333
<url>http://maven.apache.org</url>
3434

35+
<properties>
36+
<surefire.argLine.extend>--add-reads=org.apache.arrow.adapter.jdbc=com.fasterxml.jackson.dataformat.yaml</surefire.argLine.extend>
37+
</properties>
38+
3539
<dependencies>
3640

3741
<dependency>
@@ -109,13 +113,6 @@ under the License.
109113
</execution>
110114
</executions>
111115
</plugin>
112-
<plugin>
113-
<groupId>org.apache.maven.plugins</groupId>
114-
<artifactId>maven-surefire-plugin</artifactId>
115-
<configuration combine.self="override">
116-
<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>
117-
</configuration>
118-
</plugin>
119116
<plugin>
120117
<groupId>org.apache.maven.plugins</groupId>
121118
<artifactId>maven-compiler-plugin</artifactId>

dataset/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ under the License.
3131
<description>Java implementation of Arrow Dataset API/Framework</description>
3232

3333
<properties>
34+
<surefire.argLine.extend>--add-reads=org.apache.arrow.dataset=com.fasterxml.jackson.databind --add-opens=java.base/java.nio=org.apache.arrow.dataset</surefire.argLine.extend>
3435
<arrow.cpp.build.dir>../../../cpp/release-build/</arrow.cpp.build.dir>
3536
<parquet.version>1.17.1</parquet.version>
3637
<avro.version>1.12.1</avro.version>
@@ -180,7 +181,6 @@ under the License.
180181
<plugin>
181182
<artifactId>maven-surefire-plugin</artifactId>
182183
<configuration>
183-
<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>
184184
<enableAssertions>false</enableAssertions>
185185
<systemPropertyVariables>
186186
<arrow.test.dataRoot>${project.basedir}/../testing/data</arrow.test.dataRoot>

docs/source/install.rst

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ Java Compatibility
2828
==================
2929

3030
Java modules are compatible with JDK 17 and above. Currently, JDK versions
31-
17, 21, and latest are tested in CI.
31+
17, 21, and 25 are tested in CI.
3232

33-
Note that some JDK internals must be exposed by
34-
adding ``--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`` to the ``java`` command:
33+
Note that some JDK internals must be exposed by adding these flags to the ``java`` command:
34+
35+
- ``--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED`` (always required)
36+
- ``--enable-native-access=io.netty.common`` (Java 25+, when using ``arrow-memory-netty``)
37+
- ``--sun-misc-unsafe-memory-access=allow`` (Java 25+; not stricly necessary, but suppresses certain warnings)
3538

3639
.. code-block:: shell
3740
@@ -40,14 +43,19 @@ adding ``--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED
4043
# Indirectly via environment variables
4144
$ env JDK_JAVA_OPTIONS="--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED" java -jar ...
4245
43-
Otherwise, you may see errors like ``module java.base does not "opens
44-
java.nio" to unnamed module`` or ``module java.base does not "opens
45-
java.nio" to org.apache.arrow.memory.core``
46+
Otherwise, you may see errors and/or warnings like these:
47+
- ``module java.base does not "opens java.nio" to unnamed module``
48+
- ``module java.base does not "opens java.nio" to org.apache.arrow.memory.core``
49+
- ``Native access (restricted methods) is not enabled for the io.netty.common module.``
50+
- ``A terminally deprecated method in sun.misc.Unsafe has been called``
4651

4752
Note that the command has changed from Arrow 15 and earlier. If you are still using the flags from that version
4853
(``--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED``) you will see the
4954
``module java.base does not "opens java.nio" to org.apache.arrow.memory.core`` error.
5055

56+
For more information on these flags, see the `Netty documentation
57+
<https://netty.io/wiki/java-24-and-sun.misc.unsafe.html>`_.
58+
5159
If you are using flight-core or dependent modules, you will need to mark that flight-core can read unnamed modules.
5260
Modifying the command above for Flight:
5361

flight/flight-core/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ under the License.
3232

3333
<properties>
3434
<forkCount>1</forkCount>
35-
<!-- List of add-opens arg line arguments for this module's tests -->
36-
<surefire.add-opens.argLine>--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</surefire.add-opens.argLine>
35+
<surefire.argLine.extend>--add-opens=org.apache.arrow.flight.core/org.apache.arrow.flight.perf.impl=protobuf.java</surefire.argLine.extend>
3736
</properties>
3837

3938
<dependencies>
@@ -152,7 +151,6 @@ under the License.
152151
<plugin>
153152
<artifactId>maven-surefire-plugin</artifactId>
154153
<configuration>
155-
<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>
156154
<enableAssertions>false</enableAssertions>
157155
<systemPropertyVariables>
158156
<arrow.test.dataRoot>${project.basedir}/../../testing/data</arrow.test.dataRoot>

flight/flight-sql/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ under the License.
3232

3333
<properties>
3434
<forkCount>1</forkCount>
35-
<!-- List of add-opens arg line arguments for this module's tests -->
36-
<surefire.add-opens.argLine>--add-reads=org.apache.arrow.flight.sql=org.slf4j --add-reads=org.apache.arrow.flight.core=ALL-UNNAMED --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</surefire.add-opens.argLine>
35+
<surefire.argLine.extend>--add-reads=org.apache.arrow.flight.sql=org.slf4j --add-reads=org.apache.arrow.flight.core=ALL-UNNAMED</surefire.argLine.extend>
3736
</properties>
3837

3938
<dependencies>

memory/memory-core/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ under the License.
3131
<description>Core off-heap memory management libraries for Arrow ValueVectors.</description>
3232

3333
<properties>
34-
<!-- List of add-opens arg line arguments for this module's tests -->
35-
<surefire.add-opens.argLine>--add-reads=org.apache.arrow.memory.core=ch.qos.logback.classic --add-opens=java.base/java.lang.reflect=org.apache.arrow.memory.core --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</surefire.add-opens.argLine>
34+
<surefire.argLine.extend>--add-reads=org.apache.arrow.memory.core=ch.qos.logback.classic --add-opens=java.base/java.lang.reflect=org.apache.arrow.memory.core</surefire.argLine.extend>
3635
</properties>
3736

3837
<dependencies>
@@ -84,7 +83,6 @@ under the License.
8483
<groupId>org.apache.maven.plugins</groupId>
8584
<artifactId>maven-surefire-plugin</artifactId>
8685
<configuration>
87-
<argLine>--add-reads=org.apache.arrow.memory.core=ch.qos.logback.classic --add-opens=java.base/java.lang.reflect=org.apache.arrow.memory.core --add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</argLine>
8886
<excludes>
8987
<!-- Test is only useful when NOT running with add-opens -->
9088
<exclude>**/TestOpens.java</exclude>

pom.xml

Lines changed: 64 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,9 @@ under the License.
116116
<logback.version>1.6.3</logback.version>
117117
<doclint>none</doclint>
118118
<additionalparam>-Xdoclint:none</additionalparam>
119-
<!-- List of add-opens arg line arguments for tests -->
120-
<surefire.add-opens.argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED</surefire.add-opens.argLine>
119+
<surefire.argLine.extend/>
120+
<surefire.argLine.jdkSpecific/>
121+
<surefire.argLine>--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED --enable-native-access=io.netty.common ${surefire.argLine.extend} ${surefire.argLine.jdkSpecific}</surefire.argLine>
121122
<!-- org.apache:apache overrides -->
122123
<minimalJavaBuildVersion>17</minimalJavaBuildVersion>
123124
<maven.compiler.source>17</maven.compiler.source>
@@ -322,7 +323,7 @@ under the License.
322323
<plugin>
323324
<artifactId>maven-surefire-plugin</artifactId>
324325
<configuration>
325-
<argLine>${surefire.add-opens.argLine}</argLine>
326+
<argLine>${surefire.argLine}</argLine>
326327
<enableAssertions>true</enableAssertions>
327328
<childDelegation>true</childDelegation>
328329
<forkCount>${forkCount}</forkCount>
@@ -341,7 +342,7 @@ under the License.
341342
<plugin>
342343
<artifactId>maven-failsafe-plugin</artifactId>
343344
<configuration>
344-
<argLine>${surefire.add-opens.argLine}</argLine>
345+
<argLine>${surefire.argLine}</argLine>
345346
<systemPropertyVariables>
346347
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
347348
<io.netty.tryReflectionSetAccessible>true</io.netty.tryReflectionSetAccessible>
@@ -725,42 +726,6 @@ under the License.
725726
<groupId>org.apache.maven.plugins</groupId>
726727
<artifactId>maven-site-plugin</artifactId>
727728
</plugin>
728-
<plugin>
729-
<groupId>com.diffplug.spotless</groupId>
730-
<artifactId>spotless-maven-plugin</artifactId>
731-
<configuration>
732-
<pom>
733-
<licenseHeader>
734-
<file>${maven.multiModuleProjectDirectory}/dev/license/asf-xml.license</file>
735-
<delimiter>(&lt;configuration|&lt;project)</delimiter>
736-
</licenseHeader>
737-
<sortPom/>
738-
</pom>
739-
<java>
740-
<googleJavaFormat>
741-
<version>1.17.0</version>
742-
<style>GOOGLE</style>
743-
</googleJavaFormat>
744-
<licenseHeader>
745-
<file>${maven.multiModuleProjectDirectory}/dev/license/asf-java.license</file>
746-
<delimiter>package</delimiter>
747-
</licenseHeader>
748-
<excludes>
749-
<exclude>**/Preconditions.java</exclude>
750-
<exclude>**/IntObjectMap.java</exclude>
751-
<exclude>**/IntObjectHashMap.java</exclude>
752-
</excludes>
753-
</java>
754-
</configuration>
755-
<executions>
756-
<execution>
757-
<id>spotless-check</id>
758-
<goals>
759-
<goal>check</goal>
760-
</goals>
761-
</execution>
762-
</executions>
763-
</plugin>
764729
</plugins>
765730
<extensions>
766731
<!-- provides os.detected.classifier (i.e. linux-x86_64, osx-x86_64) property -->
@@ -814,6 +779,17 @@ under the License.
814779
</reporting>
815780

816781
<profiles>
782+
<profile>
783+
<!-- Certain flags are required on newer JDK but not recognized on earlier JDK -->
784+
<id>jdk24</id>
785+
<activation>
786+
<jdk>[24,)</jdk>
787+
</activation>
788+
<properties>
789+
<surefire.argLine.jdkSpecific>--sun-misc-unsafe-memory-access=allow</surefire.argLine.jdkSpecific>
790+
</properties>
791+
</profile>
792+
817793
<profile>
818794
<!-- C data interface depends on building a native library -->
819795
<id>arrow-c-data</id>
@@ -842,6 +818,54 @@ under the License.
842818
</properties>
843819
</profile>
844820

821+
<profile>
822+
<!-- google-java-format now requires Java 21+ -->
823+
<id>spotless</id>
824+
<activation>
825+
<jdk>[21,)</jdk>
826+
</activation>
827+
<build>
828+
<plugins>
829+
<plugin>
830+
<groupId>com.diffplug.spotless</groupId>
831+
<artifactId>spotless-maven-plugin</artifactId>
832+
<configuration>
833+
<pom>
834+
<licenseHeader>
835+
<file>${maven.multiModuleProjectDirectory}/dev/license/asf-xml.license</file>
836+
<delimiter>(&lt;configuration|&lt;project)</delimiter>
837+
</licenseHeader>
838+
<sortPom/>
839+
</pom>
840+
<java>
841+
<googleJavaFormat>
842+
<version>1.36.1</version>
843+
<style>GOOGLE</style>
844+
</googleJavaFormat>
845+
<licenseHeader>
846+
<file>${maven.multiModuleProjectDirectory}/dev/license/asf-java.license</file>
847+
<delimiter>package</delimiter>
848+
</licenseHeader>
849+
<excludes>
850+
<exclude>**/Preconditions.java</exclude>
851+
<exclude>**/IntObjectMap.java</exclude>
852+
<exclude>**/IntObjectHashMap.java</exclude>
853+
</excludes>
854+
</java>
855+
</configuration>
856+
<executions>
857+
<execution>
858+
<id>spotless-check</id>
859+
<goals>
860+
<goal>check</goal>
861+
</goals>
862+
</execution>
863+
</executions>
864+
</plugin>
865+
</plugins>
866+
</build>
867+
</profile>
868+
845869
<profile>
846870
<!--
847871
Do not activate Error Prone while running with Eclipse/M2E as it causes incompatibilities

vector/src/main/java/org/apache/arrow/vector/ValueVector.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@
5353
* <p>This interface "should" strive to guarantee this order of operation:
5454
*
5555
* <blockquote>
56-
*
5756
* allocate &gt; mutate &gt; setvaluecount &gt; access &gt; clear (or allocate to start the process
5857
* over).
59-
*
6058
* </blockquote>
6159
*/
6260
public interface ValueVector extends Closeable, Iterable<ValueVector> {

0 commit comments

Comments
 (0)