One possibility is to use hidden method parameters.
Let L = {the set of all method parameters which are referenced by
GWT.isLiteral() in the body}
For each parameter P in L, add a new parameter to the method, PiL (P
is Literal).
that is, in Vitali's example:
void addParameter (HashMap h, int size, String key, Object value)
becomes
void addParameter (HashMap h, int size, String key, Object value,
boolean hIL, boolean sizeIL)
now for each GWT.isLiteral/isConstanValue call, replace with the
corresponding hidden parameter
void addParameter (HashMap h, int size, String key, Object value,
boolean hIL, boolean sizeIL) {
if(hIl) {
if(sizeIL) {
...
}
}
}
finally, for each callsite C that invokes the method, if any parameter
P evaluates to a literal, replace the callsite with the hidden
parameters statically evaluated
addParameter(h, size, value)
with
(e.g)
addParameter(h, size, value, true, false)
-Ray