Is the underlying object actually an ArrayBuffer? The return value is
supposed to be either an ArrayBuffer or a String depending on how you
invoke the reader API.
It seems to me that any methods which might throw CCE because of this
should actually return null, e.g.
class FileReader {
public @JsOverlay ArrayBuffer getArrayBufferResult() {
Object result = getResult();
return result instanceof ArrayBuffer ? (ArrayBuffer) result : null;
}
public native Object getResult();
}
On Sat, Aug 6, 2016 at 7:08 PM, Luke Last <[email protected]> wrote:
> What's the best way to type cast objects? I get a ClassCastException in
> super dev mode with the following.
>
> ArrayBuffer ab = (ArrayBuffer) fileReader.result;
>
> The exception stems from com.google.gwt.lang.Cast#castToNative
>
> If I use JSNI to perform the cast it works fine.
>
> Thanks for working on Elemental2. I think it's super important for GWT.
> -Luke
>
>
> On Wednesday, June 29, 2016 at 8:23:51 PM UTC-4, Julien Dramaix wrote:
>>
>> A new experimental version of Elemental2 using the new JsInterop
>> specification has been pushed on Sonatype today.
>>
>>
>> You can try it by downloading the jar file or adding this following maven
>> dependency:
>>
>>
>> <dependency>
>>
>> <groupId>com.google.gwt</groupId>
>>
>> <artifactId>elemental2-experimental</artifactId>
>>
>> <version>16-06-30</version>
>>
>> </dependency>
>>
>>
>> Then, inherits the elemental2 module:
>>
>>
>> <inherits name="elemental2" />
>>
>>
>> This experimental version works only with the last 2.8-snapshot release of
>> GWT.
>>
>>
>> The goal of this release is to get feedback so don’t hesitate to report
>> any bugs, issues, concerns you have on this mailing list.
>>
>>
>> Important note: This is an experimental release and without doubt the
>> future updates until the final release are going to break code!
>>
>>
>> - Julien
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/e0b5ae3d-e987-40e4-9d70-dfde08f1ffc2%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7ekncp%2Bkd1dqnzf5%3DedFyxm5XMTFw32wa7Qh7Fu2%2BaUKw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.