Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility with java 9+ (#43)
Java 9 introduced something called "covariant return types". This gets used in java.nio.ByteBuffer: overriden methods from java.nio.Buffer now return ByteBuffer instead of more general Buffer. Unfortunately this breaks bytecode generation for the memory: ByteBuffer::limit cannot be casted to ByteBuffer.(Int) -> Buffer. It can be casted to ByteBuffer.(Int) -> ByteBuffer, but not in java 8. The fix is easy enough: upcast the object to Buffer before calling the method. In bytecode this corresponds to using Buffer::limit method instead of ByteBuffer::limit. This works both with older and newer java. The same applies to Buffer::position
- Loading branch information