Community
Participate
Working Groups
For example, instead of generating code like public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((this.o== null) ? 0 : this.o.hashCode()); return result; } use com.google.common.base.Objects.hashCode(Object...) There are similar utility methods for generating compact and GWT compatible equals() and toString() as well. See: https://code.google.com/p/guava-libraries/wiki/CommonObjectUtilitiesExplained Furthermore in my case the generated toString() method is not GWT compatible: public String toString() { String result = new ToStringBuilder(this) .addAllFields() // not supported by GWT .toString(); return result; }
We don't use Guava API directly in our generated code, because otherwise the xbase.lib.slim would not work (it has an inlinded and renamed version of Guava) toString uses reflection when your class has a superclass, because there is no other way to get all the fields. I'm not a huge fan of this mechanism, but this is how it worked before and we needed to be backwards compatible. We may introduce something like "callSuper", which would nest the superclass toString inside the subclass.