Thanks for the answer.

What I also considered was to create an javascript object manually
that had the correct structure so GWT was fooled, but this would
require knowledge of how GWT implements classes on the client side and
also it would be dependent on implementation specifics of the current
GWT version. Would that be possible(event thought I know it wouldn't
be sensible).

Niels

On Sep 4, 5:29 am, "Ian Petersen" <[EMAIL PROTECTED]> wrote:
> On Wed, Sep 3, 2008 at 1:45 PM, [EMAIL PROTECTED]
>
> <[EMAIL PROTECTED]> wrote:
> > Is there any way to get the following piece of code to work in script
> > mode:
>
> >                User u = (User)JavaScriptObject.createObject();
>
> > Where User is an interface I have defined. Currently I get an
> > classcast exception.
>
> I'm pretty sure that's impossible.  There are some pretty severe
> restrictions on JSO overlay types because all methods have to be
> devirtualizable (ie. JSO implementations can't be polymorphic).
> Theoretically, if your JSO is the only implementation of User in the
> entire system, then, after type tightening, the compiler should be
> able to generate code that does what you want, but it doesn't do that
> today.  There has been some chatter on the -Contributors list about
> maybe implementing it one day, but I think there's some hesitation
> because there's high potential for confusion.
>
> I think what you want is a wrapper type--a class that implements User
> and has a member of type JSO.  There'll be slightly more overhead than
> what you're trying to do, but at least it'll compile.
>
> Ian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to