I face similar problem, trying to use ArrayBuffer and Uint8Array. JDK 17,
GWT 2.12.1, Windows workstation
My original intent was to return bytes of user-selected file from JSNI to
GWT code. But now I see even simplest pure GWT java code doesn't work.
I create ArrayBuffer, then create Uint8Array from it.
Any Uint8Array methods except toString() fail with ReferenceError. I see
"devirtual" there, may it give a clue...
I probably do something wrong but I cannot find any example in the internet.
ArrayBuffer arrayBuffer = TypedArrays.createArrayBuffer(20);
GWT.log("ab.length = " + arrayBuffer.byteLength());
Uint8Array uintArray = TypedArrays.createUint8Array(arrayBuffer);
GWT.log("uintArray = " + uintArray);
// ---------- THE CALL BELOW FAILS ---------
GWT.log("uintArray[0] " + uintArray.get(0));
ab.length = 20
uintArray = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
SEVERE ****MYAPP**** Exception:
com.google.gwt.core.client.JavaScriptException: (ReferenceError) :
com_google_gwt_typedarrays_client_Uint8ArrayNative_*get*_1I_1S_1_1devirtual$__Lcom_google_gwt_typedarrays_shared_Uint8Array_2IS
is not defined
at Unknown. ***MYAPP*** _testArrayBuffer__V(***MYAPP***-0.js@3:260605)
at ....
--------------
JDK 17
GWT 2.12.1
Code server Command line:
Run GWT Code Server: [-launcherDir,
C:\home\ws\MYAPP\.metadata\.plugins\org.eclipse.wst.server.core\tmp0/wtpwebapps/MYAPP,
-workDir, MYTMPDIR, -logLevel, INFO, -style, DETAILED, -sourceLevel, 17,
-port, 9876, -generateJsInteropExports, MYAPPNAME]
On Saturday, November 11, 2017 at 8:11:08 PM UTC+1 Colin Alworth wrote:
> Can you run super dev mode with `-style PRETTY`? The line you are pointing
> at should only error out like that if createUint8Array returned null, but
> it would be good to confirm that in PRETTY you see the name of the local
> variable.
>
> .byteLength() in the native code is just defined as access on the
> .byteLength field of the view, so that seems sane enough - should only
> error out of there is no Uint8Array. But createUint8Array should just
> delegate to Uint8ArrayNative.create(buffer, 0, buffer.byteLength()) anyway,
> which just calls the JS constructor, so that doesn't make a ton of sense
> either...
>
> Try PRETTY, and maybe turn off sourcemaps so you can see what is generated
> - perhaps there is a bug and SDM is making a mistake, or maybe something
> else will be clear to you once you see the sources (probably in your own
> JSNI).
>
> Finally, which version of GWT are you using?
>
>
> On Wednesday, November 8, 2017 at 7:58:09 PM UTC-6, TimOnGmail wrote:
>>
>> Hmmm, nope - even if I make a copy of the buffer, I still get the above
>> error in Super Dev mode.
>>
>> Any ideas, anyone?
>>
>> - Tim
>>
>>
>
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/google-web-toolkit/834cbe43-1d08-47b4-b36e-2575b6b149bdn%40googlegroups.com.