I came across an old design doc on the google code site discussing overlay types along with the following todo:
I've looked through the GWT jjs compiler source and it doesn't look this or anything else is implemented; the compiler will replace any instanceof's on JSO's with a cast without any further ado.
This would be a super useful feature for our project because we have modeled our app's data as set of interfaces that each have a simple bean implementation for the JVM and
JSO-based implementation for translatable code.
Polymorphism is difficult there though because it's syntically legal to use instanceof to check for a subtype in both gwt and jvm code, it will fail silently on the client because all
overlay types can be cast to another.
We resolve this by storing our "type" property, but it would be great to be able to provide an allowCast() method so that instanceof can be used everywhere.
I'd like to implement this, for our own project if nothing else, but was wondering if there had ever been a discussion about this or a deliberate decision against a "magic" allowCast.
(or if anyone else has thought about implementing it?)
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
To post to this group, send email to email@example.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.