Why use GWT.create() instead of new?

GWT.create is used by the GWT compiler for deferred binding. Deferred binding is a feature of the GWT compiler that works by generating many versions of code at compile time, only one of which needs to be loaded by a particular client during bootstrapping at runtime.

You should only use the GWT.create for those cases that depend on this specific use case. For example when creating a RPC class: (MyServiceAsync)GWT.create(MyService.class). In all other cases use new.

For more information check the GWT page on Deferred binding: http://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsDeferred.html

Leave a Comment