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 Google-Web-Toolkit@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---