Interesting enough, with Java >=9 the length is reported correctly, so in the case of:
var bb = java.nio.ByteBuffer.allocateDirect(12) var ab = new ArrayBuffer(bb) var ia = new Int8Array(ab) ia.length // prints 12 ab.byteLength // prints 12 This fails now on JDK8 and Graal.js (is Graal.js supposed to allow this? (setting a ByteBuffer as the underlying buffer of a js ArrayBuffer?) I can imagine that for embedded applications this could make sense...