Re: Interface not RPC serializable
Nathan Wells wrote: I don't think so, as I believe that is how it's supposed to work. You're not supposed to have to put things in the same package to make serialization work. Can the OP put together a simple example that shows the error and post all the code? It could be that things that were missed out in the original post are important. --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Interface not RPC serializable
Nathan: The docs say: The type has at least one serializable subclass. I think that is my case - the type is an interface and it does have serializable subclasses, and only serializable subclasses. Paul: I've tried to replicate the problem in a dummy project, but was not able to. The project with the above problem results into a 900 kB script, so it would be a longer process to isolate. I'm 100% positive though, that in order to be able to declare a field of an interface type, for the interface to be accepted, I have to declare at least a single dummy type implementing that interface, and this type must reside in the same package/directory as the interface. Having other types implementing that interface, defined in other packages than the interface, doesn't help. The field then can be used by any other serializable type implementing that interface, no matter what package. The project this is occuring in (app-engine GWT app) consists of multiple modules, both defined in source (my own GWT libs being built) and also as a jar file (GXT). I plan to upgrade to GWT 2.0 soon, and compile GWT from sources so that I can be of more help solving things like this. I currently use GWT 1.6.4. J. On Jul 23, 10:22 am, Paul Robinson ukcue...@gmail.com wrote: Nathan Wells wrote: I don't think so, as I believe that is how it's supposed to work. You're not supposed to have to put things in the same package to make serialization work. Can the OP put together a simple example that shows the error and post all the code? It could be that things that were missed out in the original post are important. --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Interface not RPC serializable
I don't think so, as I believe that is how it's supposed to work. From the docs (http://code.google.com/webtoolkit/doc/1.6/ DevGuideServerCommunication.html#DevGuideSerializableTypes): A type is serializable and can be used in a service interface if one of the following is true: The type is primitive, such as char, byte, short, int, long, boolean, float, or double. The type an instance of the String, Date, or a primitive wrapper such as Character, Byte, Short, Integer, Long, Boolean, Float, or Double. The type is an enumeration. Enumeration constants are serialized as a name only; none of the field values are serialized. The type is an array of serializable types (including other serializable arrays). The type is a serializable user-defined class. The type has at least one serializable subclass. ... and ... A user-defined class is serializable if all of the following apply: 1. It is assignable to IsSerializable or Serializable, either because it directly implements one of these interfaces or because it derives from a superclass that does 2. All non-final, non-transient instance fields are themselves serializable, and 3. Prior to GWT 1.5, it must have a public default (zero argument) constructor or no constructor at all. 4. As of GWT 1.5, it must have a default (zero argument) constructor (with any access modifier) or no constructor at all. On Jul 21, 1:56 pm, Juraj Vitko juraj.vi...@gmail.com wrote: Yeah I've left that out in the example, it of course is marked with IsSerializable. However! - I've found a solution (just needed to recall that I've had similar problem with Interfaces+Classes already): A Class (or Enum) type extending the said non-serializable interface (MyIface in the above example) needs to be defined in the same package as the interface. The compiler warning is then not produced. I've scanned GWT-Issues (and GWT docs) for this, haven't exactly found it - should I fill this as an Issue? On Jul 21, 9:49 pm, Nuno brun...@gmail.com wrote: Don't you also need to do: class POJO extends Serializable ? I got many alerts about this in my classes. On Tue, Jul 21, 2009 at 3:51 PM, Juraj Vitko juraj.vi...@gmail.com wrote: I'm trying to RPC-send an interface member in a POJO - all types implementing this interface are Enums (see the example below please). Now, the application works 100% in both hosted and web modes, but the Java to JavaScript compiler complains about the POJO object, that the MyIFace is not RPC-serializable. (was not serializable and has no concrete serializable subtypes) Any ideas how to get rid of that compiler warning? I'm using GWT 1.6 for the time being. class POJO { //this object is sent via the RPC MyIface iface; } interface MyIface extends IsSerializable { MyIface[] getVals(String param); } enum MyEnum implements MyIface { one(1), two(2); private MyEnum(String s) { this.s = s; } private MyEnum() { } private String s; MyIface[] getVals(String param) { return MyEnum.values(); } } -- Quer aprender a programar? acompanhe: Wants to learn GWT? Follow this blog - http://tcninja.blogspot.com --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Interface not RPC serializable
I'm trying to RPC-send an interface member in a POJO - all types implementing this interface are Enums (see the example below please). Now, the application works 100% in both hosted and web modes, but the Java to JavaScript compiler complains about the POJO object, that the MyIFace is not RPC-serializable. (was not serializable and has no concrete serializable subtypes) Any ideas how to get rid of that compiler warning? I'm using GWT 1.6 for the time being. class POJO { //this object is sent via the RPC MyIface iface; } interface MyIface extends IsSerializable { MyIface[] getVals(String param); } enum MyEnum implements MyIface { one(1), two(2); private MyEnum(String s) { this.s = s; } private MyEnum() { } private String s; MyIface[] getVals(String param) { return MyEnum.values(); } } --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Interface not RPC serializable
changing the POJO.iface field to: Enum? extends MyIface iface; doesn't help either. On Jul 21, 8:51 pm, Juraj Vitko juraj.vi...@gmail.com wrote: I'm trying to RPC-send an interface member in a POJO - all types implementing this interface are Enums (see the example below please). Now, the application works 100% in both hosted and web modes, but the Java to JavaScript compiler complains about the POJO object, that the MyIFace is not RPC-serializable. (was not serializable and has no concrete serializable subtypes) Any ideas how to get rid of that compiler warning? I'm using GWT 1.6 for the time being. class POJO { //this object is sent via the RPC MyIface iface; } interface MyIface extends IsSerializable { MyIface[] getVals(String param); } enum MyEnum implements MyIface { one(1), two(2); private MyEnum(String s) { this.s = s; } private MyEnum() { } private String s; MyIface[] getVals(String param) { return MyEnum.values(); } } --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Interface not RPC serializable
Don't you also need to do: class POJO extends Serializable ? I got many alerts about this in my classes. On Tue, Jul 21, 2009 at 3:51 PM, Juraj Vitko juraj.vi...@gmail.com wrote: I'm trying to RPC-send an interface member in a POJO - all types implementing this interface are Enums (see the example below please). Now, the application works 100% in both hosted and web modes, but the Java to JavaScript compiler complains about the POJO object, that the MyIFace is not RPC-serializable. (was not serializable and has no concrete serializable subtypes) Any ideas how to get rid of that compiler warning? I'm using GWT 1.6 for the time being. class POJO { //this object is sent via the RPC MyIface iface; } interface MyIface extends IsSerializable { MyIface[] getVals(String param); } enum MyEnum implements MyIface { one(1), two(2); private MyEnum(String s) { this.s = s; } private MyEnum() { } private String s; MyIface[] getVals(String param) { return MyEnum.values(); } } -- Quer aprender a programar? acompanhe: Wants to learn GWT? Follow this blog - http://tcninja.blogspot.com --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---
Re: Interface not RPC serializable
Yeah I've left that out in the example, it of course is marked with IsSerializable. However! - I've found a solution (just needed to recall that I've had similar problem with Interfaces+Classes already): A Class (or Enum) type extending the said non-serializable interface (MyIface in the above example) needs to be defined in the same package as the interface. The compiler warning is then not produced. I've scanned GWT-Issues (and GWT docs) for this, haven't exactly found it - should I fill this as an Issue? On Jul 21, 9:49 pm, Nuno brun...@gmail.com wrote: Don't you also need to do: class POJO extends Serializable ? I got many alerts about this in my classes. On Tue, Jul 21, 2009 at 3:51 PM, Juraj Vitko juraj.vi...@gmail.com wrote: I'm trying to RPC-send an interface member in a POJO - all types implementing this interface are Enums (see the example below please). Now, the application works 100% in both hosted and web modes, but the Java to JavaScript compiler complains about the POJO object, that the MyIFace is not RPC-serializable. (was not serializable and has no concrete serializable subtypes) Any ideas how to get rid of that compiler warning? I'm using GWT 1.6 for the time being. class POJO { //this object is sent via the RPC MyIface iface; } interface MyIface extends IsSerializable { MyIface[] getVals(String param); } enum MyEnum implements MyIface { one(1), two(2); private MyEnum(String s) { this.s = s; } private MyEnum() { } private String s; MyIface[] getVals(String param) { return MyEnum.values(); } } -- Quer aprender a programar? acompanhe: Wants to learn GWT? Follow this blog - http://tcninja.blogspot.com --~--~-~--~~~---~--~~ 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 google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~--~~~~--~~--~--~---