public void visitInvokeInstruction(InvokeInstruction o){
indexValid(o, o.getIndex());
if ( (o instanceof INVOKEVIRTUAL) ||
(o instanceof INVOKESPECIAL) ||
(o instanceof INVOKESTATIC) ){
Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantMethodref)){
constraintViolated(o, "Indexing a constant that's not a CONSTANT_Methodref but a '"+c+"'.");
}
else{
// Constants are okay due to pass2.
ConstantNameAndType cnat = (ConstantNameAndType) (cpg.getConstant(((ConstantMethodref) c).getNameAndTypeIndex()));
ConstantUtf8 cutf8 = (ConstantUtf8) (cpg.getConstant(cnat.getNameIndex()));
if (cutf8.getBytes().equals(Constants.CONSTRUCTOR_NAME) && (!(o instanceof INVOKESPECIAL)) ){
constraintViolated(o, "Only INVOKESPECIAL is allowed to invoke instance initialization methods.");
}
if ( (! (cutf8.getBytes().equals(Constants.CONSTRUCTOR_NAME)) ) && (cutf8.getBytes().startsWith("<")) ){
constraintViolated(o, "No method with a name beginning with '<' other than the instance initialization methods may be called by the method invocation instructions.");
}
}
}
else{ //if (o instanceof INVOKEINTERFACE){
Constant c = cpg.getConstant(o.getIndex());
if (! (c instanceof ConstantInterfaceMethodref)){
constraintViolated(o, "Indexing a constant that's not a CONSTANT_InterfaceMethodref but a '"+c+"'.");
}
// TODO: From time to time check if BCEL allows to detect if the
// 'count' operand is consistent with the information in the