Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apacheGH-35053: [Java] Fix MemoryUtil to support Java 21 (apache#36370)
### Rationale for this change Java 21 switched `DirectByteBuffer(long,int)` constructor to `DirectByteBuffer(long,long)` via openjdk/jdk@a56598f ### What changes are included in this PR? In order to avoid `NoSuchMethodException` error in Java 21 environment, this PR aims to choose one of constructors based on the Java version like netty/netty#13366 . ### Are these changes tested? ``` $ java -version openjdk version "21-ea" 2023-09-19 OpenJDK Runtime Environment (build 21-ea+28-2377) OpenJDK 64-Bit Server VM (build 21-ea+28-2377, mixed mode, sharing) $ cd java $ mvn clean package --am --pl memory/memory-core ... [INFO] Apache Arrow Java Root POM ......................... SUCCESS [ 5.693 s] [INFO] Arrow Memory ....................................... SUCCESS [ 1.703 s] [INFO] Arrow Memory - Core ................................ SUCCESS [ 7.050 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.630 s [INFO] Finished at: 2023-06-28T20:43:29-07:00 [INFO] ------------------------------------------------------------------------ ``` ### Are there any user-facing changes? * Closes: apache#35053 Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: David Li <li.davidm96@gmail.com>
- Loading branch information