{
int param;
String[] expectedTypes = methodParameterTypes;
ClassInspector classInspector = getClassFactory().getClassInspector();
/* Generate the code for each user parameter, generating the appropriate
* cast when the passed type needs to get widened to the expected type.
*/
for (param = 0; param < methodParms.length; param++)
{
generateOneParameter( acb, mb, param );
// type from the SQL-J expression
String argumentType = getParameterTypeName( methodParms[param] );
// type of the method
String parameterType = expectedTypes[param];
if (!parameterType.equals(argumentType))
{
// since we reached here through method resolution
// casts are only required for primitive types.
// In any other case the expression type must be assignable
// to the parameter type.
if (ClassInspector.primitiveType(parameterType)) {
mb.cast(parameterType);
} else {
// for a prodcedure
if (routineInfo != null) {
continue; // probably should be only for INOUT/OUT parameters.
}
if (SanityManager.DEBUG) {
SanityManager.ASSERT(classInspector.assignableTo(argumentType, parameterType),
"Argument type " + argumentType + " is not assignable to parameter " + parameterType);
}
/*
** Set the parameter type in case the argument type is narrower