Community
Participate
Working Groups
when trying to use the @Data annotation in a GWT project the resulting code generates a toString method which uses toStringHelper. ToStringHelper uses reflection to generate a string, and uses threadlocal, both which are unavailable in gwt. instead, tostring could manually list the fields -> the same way this is done in hashcode and equals; this would make it both slightly faster and GWT compatible. Workaround: use @Data, but write a manual toString method.
Another workaround would be to build your own GWT compatible version of @Data.
The new @ValueObject annotation will work without reflection in the toString method.
We can't change this for @Data, since reflection is the only way to get at the superclass fields and @Data allows inheritance. I have removed @GWTCompatible from @Data.
Is it supported that @Data classes are inherited from non-@Data classes? If not (which sounds logical) then a chainable toString() implementation may do the trick...