See here:
http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/ReleaseNotes_1_5_Rpc
and here:
http://code.google.com/p/google-web-toolkit-doc-1-5/wiki/ReleaseNotes_1_5_ImportantNotes
If you just have "ArrayList bar", then it doesn't know anything about the class of things that will be in the list, and so GWT would have to search for every possible serializable class and generate javascript for handling the serialization of them. So the compiler makes you specify a supertype of the elements in the collection to narrow down the type of object in there. You should be as specific as possible.
HTH
Paul
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/dRy1nVVulPgJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
It's well worth taking the time to do the conversion to generics.
Paul
public interface State {}
public class StringState implements Serializable, State { String state; }
and then you have:
Map<String, List<State>> filterStates = new HashMap<String, List<State>>();
(2) Create a class that holds an instance of each type you might want to send, and give it an extra property that says what type of thing it contains:
public enum MyType {STRING, FOO, BAR }
public class State implements Serializable {
MyType type;
String string;
FOO foo;
BAR bar;
}
If you really don't know whether there's a String or some other object in your list, then it may be that you object model should be changed anyway. Otherwise you'll probably end up with lots of code like:
List list = ...;
for (Object o : list) {
if (o instanceof String) {
// do something with String
} else if (o instanceof Foo) {
// do something with Foo
}
}
HTH
Paul
I think support for implementing Serializable was added in GWT 1.4. It means you don't have to have GWT classes (ie IsSerializable) in classes that are otherwise GWT-free and so helps support code sharing with non-GWT code/libraries.
See the GWT docs on serialization:
http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunication.html#DevGuideSerializableTypes
Paul
You haven't said what exception you get
On 19/08/11 16:27, David wrote:
> I can't find any exception beside the warning message "In order to
> produce smaller client-side code, 'Object' is not allowed; consider
> using a more specific type Options " in hosted mode console.
>
> On Aug 19, 11:24 pm, Paul Robinson<ukcue...@gmail.com> wrote:
>> Copy& paste the exception and stack trace. It could well be nothing to do with the things we've been talking about.