In this case, no. The GWT.create
method must always be called with an actual class literal, never with a variable/field/parameter. This is because GWT.create
is actually a special sort of new
with no arguments, and that won't work with a variable either (without reflection):
Class<? extends Bar> clazz = ...;
Bar instance = new clazz;//nope
The method GWT.create
looks like a method call, and in Java it really is, but when you compile to JS, it must turn into a constructor call, following the specific deferred binding rules of the given permutation.