You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "James Duong (Jira)" <ji...@apache.org> on 2022/03/10 19:29:00 UTC

[jira] [Updated] (ARROW-15913) [IPC][Java] JDK 8 incompatibility with ByteBuffer.clear()

     [ https://issues.apache.org/jira/browse/ARROW-15913?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Duong updated ARROW-15913:
--------------------------------
    Description: 
There is an incompatibility with JDK 8 when Arrow is compiled with JDK 9 or higher as described here:

[https://jira.mongodb.org/browse/JAVA-2559]

This pattern is used in at least MessageSerializer#readMessage(), but the codebase needs to be examined anywhere ByteBuffer is being used.

"Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer that are used by the driver:
 * position
 * limit
 * flip
 * clear

In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer,
resulting in exceptions like this when executing on Java 8 and lower:

java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer

This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist.

The solution is to cast ByteBuffer instances to Buffer before calling the method."

  was:
There is an incompatibility with JDK 8 when Arrow is compiled with JDK 9 or higher as described here:

[https://jira.mongodb.org/browse/JAVA-2559]

 

"Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer that are used by the driver:
 * position
 * limit
 * flip
 * clear

In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer,
resulting in exceptions like this when executing on Java 8 and lower:

java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer

This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist.

The solution is to cast ByteBuffer instances to Buffer before calling the method."


> [IPC][Java] JDK 8 incompatibility with ByteBuffer.clear()
> ---------------------------------------------------------
>
>                 Key: ARROW-15913
>                 URL: https://issues.apache.org/jira/browse/ARROW-15913
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Java
>            Reporter: James Duong
>            Priority: Major
>
> There is an incompatibility with JDK 8 when Arrow is compiled with JDK 9 or higher as described here:
> [https://jira.mongodb.org/browse/JAVA-2559]
> This pattern is used in at least MessageSerializer#readMessage(), but the codebase needs to be examined anywhere ByteBuffer is being used.
> "Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer that are used by the driver:
>  * position
>  * limit
>  * flip
>  * clear
> In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer,
> resulting in exceptions like this when executing on Java 8 and lower:
> java.lang.NoSuchMethodError: java.nio.ByteBuffer.limit(I)Ljava/nio/ByteBuffer
> This is because the generated byte code includes the static return type of the method, which is not found on Java 8 and lower because the overloaded methods with covariant return types don't exist.
> The solution is to cast ByteBuffer instances to Buffer before calling the method."



--
This message was sent by Atlassian Jira
(v8.20.1#820001)