class InstConstraintVisitor {
/**
* Ensures the specific preconditions of the said instruction.
*/
@Override
public void visitARRAYLENGTH(ARRAYLENGTH o){
Type arrayref = stack().peek(0);
arrayrefOfArrayType(o, arrayref);
}
}
class InstConstraintVisitor {
/**
* Ensures the specific preconditions of the said instruction.
*/
@Override
public void visitLDC(LDC o){
// visitCPInstruction is called first.
Constant c = cpg.getConstant(o.getIndex());
if (! ( ( c instanceof ConstantInteger) ||
( c instanceof ConstantFloat ) ||
( c instanceof ConstantString ) ||
( c instanceof ConstantClass ) ) ){
constraintViolated(o,
"Referenced constant should be a CONSTANT_Integer, a CONSTANT_Float, a CONSTANT_String or a CONSTANT_Class, but is '"+
c + "'.");
}
}
}
|