casting typed array to java byte[] is it possible?
Sundararajan Athijegannathan
sundararajan.athijegannathan at oracle.com
Mon Oct 15 04:40:47 UTC 2018
Hi,
Yes, I reproduced the issue with jdk8 (haven't tried graal.js though).
Please file bug(s).
-Sundar
On 12/10/18, 7:29 PM, Paulo Lopes wrote:
> 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...
>
More information about the nashorn-dev
mailing list