I have been playing around with GWT, and I seem to have the bad habit of creating classes that don't meet the rule for GWT serializable objects:
A user-defined class is serializable if all of the following apply:
- 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
- All non-final, non-transient instance fields are themselves serializable, and
- As of GWT 1.5, it must have a default (zero argument) constructor (with any access modifier) or no constructor at all.
Usually I forget to include a default constructor. I normally find out about this when I get aa serialization exception at runtime. This strikes me as unnecessary. Surely there is some way that Eclipse (or the Google Plugin) can statically analyze my GWT code and discover this screw up at compile time? Seeing a little red squiggly somewhere is infinitely nicer than getting a runtime exception.
I am hoping for a solution like one of the following, in increasing order of desire:
Don't know exact answer but I would try to see if checkstyle can do that. It can be invoked from build (ant/maven) and there is also Eclipse plugin. If there are no default check like this I think it could be added reasonably easy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.