The implementations of the java.nio.Buffer classes are incompatible between java 8 and java 9. The following methods are now overridden in each implementing class and override the return type with the implementing class type instead of java.nio.Buffer.
clear()
flip()
limit(int)
mark()
position(int)
reset()
rewind()
The implementing classes are: java.nio.ByteBuffer, java.nio.CharBuffer, java.nio.DoubleBuffer, java.nio.FloatBuffer, java.nio.IntBuffer, java.nio.LongBuffer, java.nio.ShortBuffer and java.nio.MappedByteBuffer.
This causes issues when compiling classes with java 9 while setting java 8 as the compile target. Running the compiled classes in a java 8 runtime will throw the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;
The implementations of the java.nio.Buffer classes are incompatible between java 8 and java 9. The following methods are now overridden in each implementing class and override the return type with the implementing class type instead of java.nio.Buffer.
The implementing classes are:
java.nio.ByteBuffer
,java.nio.CharBuffer
,java.nio.DoubleBuffer
,java.nio.FloatBuffer
,java.nio.IntBuffer
,java.nio.LongBuffer
,java.nio.ShortBuffer
andjava.nio.MappedByteBuffer
.This causes issues when compiling classes with java 9 while setting java 8 as the compile target. Running the compiled classes in a java 8 runtime will throw the following exception: