-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer; #117
Comments
java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer; |
According to Felix: Java 9 introduces overridden methods with covariant return types for the following methods in java.nio.ByteBuffer:
In Java 9 they all now return ByteBuffer, whereas the methods they override return Buffer, |
Also two abstract methods were added to Buffer in Java 9: slice() Which return Buffer, and are also implemented by ByteBuffer in previous versions of Java, but return ByteBuffer. The solution in this case is to cast to ByteBuffer before calling these two methods. |
It turns out that this is a suboptimal solution to this problem, the OpenJDK team created a new complier flag for later Java platforms, to generate Java 8 compatible bytecodes. We should use the release compiler flag, instead of the source target flags.
|
Covariant return breaks runtime compatibility with Java 8.
Adding casts to source code fixes this issue.
The text was updated successfully, but these errors were encountered: