String filename, int lineno) {
int j = clsnm.lastIndexOf('#');
if (j >= 0) {
mtdnm = clsnm.substring(j + 1);
if (mtdnm.length() == 0)
throw new ZussException("a method name required after #", filename, lineno);
clsnm = clsnm.substring(0, j);
if (clsnm.length() == 0)
throw new ZussException("a class name required before #", filename, lineno);
}
Class<?> cls = getClass(clsnm, filename, lineno);
Class<?>[] argTypes = new Class<?>[argc];
for (j = argTypes.length; --j >= 0;)
argTypes[j] = String.class;
try {
final Method m = getMethodInPublic(cls, mtdnm, argTypes, filename, lineno);
if ((m.getModifiers() & Modifier.STATIC) == 0)
throw new ZussException("not a static method: "+m, filename, lineno);
return m;
} catch (NoSuchMethodException ex) { //ignore
}
final Method[] ms = cls.getMethods();
for (j = ms.length; --j >= 0;)
if (mtdnm.equals(ms[j].getName())) {
argTypes = ms[j].getParameterTypes();
if (argTypes.length == argc)
try {
return getMethodInPublic(cls, mtdnm, argTypes, filename, lineno);
} catch (NoSuchMethodException ex) { //ignore
}
}
throw new ZussException("method not found, "+mtdnm+", in "+cls, filename, lineno);
}