// INVOKEVIRTUAL is a LoadClass; the Class where the referenced method is declared in,
// is therefore resolved/verified.
// INVOKEVIRTUAL is an InvokeInstruction, the argument and return types are resolved/verified,
// too. So are the allowed method names.
String classname = o.getClassName(cpg);
JavaClass jc = Repository.lookupClass(classname);
Method[] ms = jc.getMethods();
Method m = null;
for (int i=0; i<ms.length; i++){
if ( (ms[i].getName().equals(o.getMethodName(cpg))) &&
(Type.getReturnType(ms[i].getSignature()).equals(o.getReturnType(cpg))) &&
(objarrayequals(Type.getArgumentTypes(ms[i].getSignature()), o.getArgumentTypes(cpg))) ){
m = ms[i];
break;
}
}
if (m == null){
constraintViolated(o, "Referenced method '"+o.getMethodName(cpg)+"' with expected signature not found in class '"+jc.getClassName()+"'. The native verfier does allow the method to be declared in some superclass or implemented interface, which the Java Virtual Machine Specification, Second Edition does not.");
}
if (! (jc.isClass())){
constraintViolated(o, "Referenced class '"+jc.getClassName()+"' is an interface, but not a class as expected.");
}
}