Skip to content

Beware collections with GWT 1.4 Final

I just upgraded our application to GWT 1.4.60, aka 1.4 Final. The upgrade was for the most part, pretty smooth. Only one issue reared its head. I have a number of objects that are Serializable that contain other Serializable objects. I had not marked them with the @gwt.typeArgs javadoc metadata, and things had worked just fine in GWT 1.4.10 (RC1). However, with 1.4 Final, I kept getting an InvocationException.

These tend to be real pains, because I’ve never seen them raised in code I write. Instead, they seem to arise from misconfiguration. Last time I saw one, I was compiling against the wrong version of gwt-servlet.jar.

This time, I hadn’t marked the contents of various Sets and Maps with the contents (using the aforementioned @gwt.typeArgs markup). I received warnings at compile time about that, but had received warnings with RC1 as well. I had, in typical developer fashion, noticed that the code still worked and thus ignored the warnings.Putting that markup in my code seemed to solve the problem.

There’s one thread on the groups about something similar to this. Here’s the tracking issue.

GWT 1.4 thoughts

I’ve been working with GWT 1.4 RC1 for the past few months. I’ve really enjoyed a number of things about this release, including some of the new widgets (the auto suggest box is pretty cool), and the size decrease (we saw size decreases of 20% without changing a bit of code). More on the release in the release announcement.

However, the number one reason you should upgrade to 1.4 is that it allows you to share value objects between the GWT view throughout the entire Java stack, all the way down to Hibernate (or whatever other data access layer you use). The reason is that java.io.Serializable is now a synonym for IsSerializable, the marker interface for Java objects that can be sent to the client. Obviously, if you are not using the RPC mechanism, this is much less important.

There is still some doubt about the GWT 1.4 release date, but you can check out the auto suggest box in action at Colorado HomeFinder (the browse homes link in the nav bar). I think this will be a killer release when it finally happens.