class InstConstraintVisitor {
/**
* Ensures the specific preconditions of the said instruction.
*/
@Override
public void visitIFNONNULL(IFNONNULL o){
if (!(stack().peek() instanceof ReferenceType)){
constraintViolated(o, "The value at the stack top is not of a ReferenceType, but of type '"+stack().peek()+"'.");
}
referenceTypeIsInitialized(o, (ReferenceType) (stack().peek()) );
}
}
class InstConstraintVisitor {
/**
* Ensures the specific preconditions of the said instruction.
*/
public void visitLDC_W(LDC_W 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 + "'.");
}
}
}