PDA

View Full Version : GWT shell barks at non-generic BaseTreeModel classes



Grandiosa
6 Jun 2008, 9:27 AM
There seems to be lots of new checking going on in newest GWT Shell runtime environment.

I haven't seen this earlier but now if you use the BaseTreeModel class without a type specifier, the GWT shell will throw a lot of warning messages at you, and RPC can stop working all together I noticed.

The source is the generic list children on the BaseTreeModel class. GWT informs that it won't be able to optimize your compiled collection unless its type is given, which is good.

The BaseTreeModel class unfortunately requires that its children also extends BaseTreeModel.
E.g. if you have

public class Department extends BaseTreeModel<Employee>

public class Employee extends BaseTreeModel


you will get lots of warnings. But if you do this instead

public class Employee extends BaseTreeModel<BaseTreeModel>

.. it works. Looks a bit awkward but ...

Based on this I propose an addendum to the JavaDoc for the BaseTreeModel class along these lines.


Note:
If you are sending BaseModelTree instances over RPC the class representing the lowest level of your BaseModelTree hiearchy must specify itself or the BaseTreeModel class as its generic type specifier. If not GWT optimizer will give warnings.