int jsval = jsValue.getJsValue();
// Native code will eat an extra ref.
LowLevelSaf.gcProtect(jsContext, jsval);
return jsval;
} else {
MethodAdaptor method = javaDispatch.getMethod(dispId);
AccessibleObject obj = method.getUnderlyingObject();
DispatchMethod dispMethod = (DispatchMethod) classLoader.getWrapperForObject(obj);
if (dispMethod == null) {
dispMethod = new MethodDispatch(classLoader, method);
classLoader.putWrapperForObject(obj, dispMethod);
}
// Native code eats the same ref it gave us.
return LowLevelSaf.wrapDispatchMethod(jsContext, method.toString(),
dispMethod);
}
} finally {
LowLevelSaf.popJsContext(jsContext);
}