Suppose I do:
VeryLargeObject o1 = GWT.create(VeryLargeObject.class();
VeryLargeObject o2 = GWT.create(VeryLargeObject.class();
...
VeryLargeObject o1000 = GWT.create(VeryLargeObject.class();
where VeryLargeObject
is a GWT resource interface which extends com.google.gwt.i18n.client.Messages
.
Will this code create 1000 new instances of the object in the browser? Or is GWT smart enough to detect that VeryLargeObject
is immutable and re-use it's 1 instance every time?
EDIT: I found this in docs but the behaviour is still not clear to me:
Using GWT.create(class) to "instantiate" an interface that extends Messages returns an instance of an automatically generated subclass that is implemented using message templates selected based on locale.