Take the object you get back from the file reader and run it through the
JSNI method below and GWT,log the result. .Let's see if it really is an
ArrayBuffer.(I would note the FileReader result is sometimes a String and
sometimes an ArrayBuffer).
private native String getType(Object x)/*-{
return Object.prototype.toString.call(x);
}-*/
On Mon, Aug 21, 2017 at 10:07 AM, Kirill Prazdnikov <[email protected]>
wrote:
> This is perfectly fine ArrayBuffer which I got from the system call to
> FileReader.onLoad callback.
> It correct, it loads and I finally read a 3d ojbect form it.
>
> What else can it be if not ArrayBuffer (hence the need of generic)? An
>> ArrayBuffer extension?
>
>
> I`m trying to generalize the drag-drop code across GWT and JVM clients.
> We have a portable UI code and it is fine to move as much code as possible
> to portable segment in order to reduce deplicates and bugs.
>
> And I think one expect native JsType`s to be working for generic
> arguments.
>
> These ought to work.
>>
>>> public abstract class ArrayBuffer { ... }
>>
>> @JsType(isNative = true, namespace = JsPackage.GLOBAL)
>>
>
>
> Yes and this is the problem I can not understand.
> With the default name and name=ArrayBuffer the generic crashes in
> generated call to castToNative.
> With name=Object the GWT does not generate type checking, instead it
> generates call to castToJsObject.
>
> What am I doing wrong ?
>
> And again, I hope using name=Object is not the best way to solve it. It
> looks like a hack to fool the GWT to avoid the crash.
>
> Any suggestions ?
>
> Thanks
>
>
> понедельник, 21 августа 2017 г., 17:06:26 UTC+3 пользователь Vassilis
> Virvilis написал:
>>
>> Oh I see. I forgot about that.
>>
>> These ought to work.
>>
>>> @JsType(isNative = true, namespace = JsPackage.GLOBAL)
>>> public abstract class ArrayBuffer { ... }
>>
>>
>>
>>
>>> @JsType(isNative = true, namespace = JsPackage.GLOBAL, name =
>>> "ArrayBuffer")
>>
>>
>> I don't know what else may be the problem.
>>
>> What else is it going on java side?
>> Maybe the instance you are trying to cast is null?
>> What else can it be if not ArrayBuffer (hence the need of generic)? An
>> ArrayBuffer extension?
>> If you print the variable you are trying to cast in the console? Does it
>> says that's an ArrayBuffer?
>>
>> I jave been fighting with jsinterop exceptions for some time and I know
>> that it can be very frustrating.
>>
>> Vassilis
>>
>>
>>
>> On Mon, Aug 21, 2017 at 4:52 PM, Kirill Prazdnikov <[email protected]>
>> wrote:
>>
>>> Im talking about standard ArrayBuffer
>>>
>>> https://developer.mozilla.org/en/docs/Web/JavaScript/Referen
>>> ce/Global_Objects/ArrayBuffer
>>>
>>> From the console of the web browser: What is it required to create a new
>>>> ArrayBuffer?
>>>>
>>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "GWT Users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/google-web-toolkit/jiHnLPfUQhc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/google-web-toolkit.
> For more options, visit https://groups.google.com/d/optout.
>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.