org.apache.bcel.verifier.statics

Class Pass3aVerifier.InstOperandConstraintVisitor

Enclosing Class:
Pass3aVerifier
Implemented Interfaces:
Visitor

private class Pass3aVerifier.InstOperandConstraintVisitor
extends EmptyVisitor

This visitor class does the actual checking for the instruction operand's constraints.

Field Summary

private ConstantPoolGen
cpg
The ConstantPoolGen instance this Visitor operates on.

Constructor Summary

InstOperandConstraintVisitor(ConstantPoolGen cpg)
The only Constructor.

Method Summary

private void
constraintViolated(Instruction i, String message)
A utility method to always raise an exeption.
private void
indexValid(Instruction i, int idx)
A utility method to raise an exception if the index is not a valid constant pool index.
private int
max_locals()
Utility method to return the max_locals value of the method verified by the surrounding Pass3aVerifier instance.
private boolean
objarrayequals(Object[] o, Object[] p)
A utility method like equals(Object) for arrays.
void
visitALOAD(ALOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitANEWARRAY(ANEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitASTORE(ASTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitCHECKCAST(CHECKCAST o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitDLOAD(DLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitDSTORE(DSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitFLOAD(FLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitFSTORE(FSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitFieldInstruction(FieldInstruction o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitGETSTATIC(GETSTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitIINC(IINC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitILOAD(ILOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitINSTANCEOF(INSTANCEOF o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitINVOKEINTERFACE(INVOKEINTERFACE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitINVOKESPECIAL(INVOKESPECIAL o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitINVOKESTATIC(INVOKESTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitINVOKEVIRTUAL(INVOKEVIRTUAL o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitISTORE(ISTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitInvokeInstruction(InvokeInstruction o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitLDC(LDC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitLDC2_W(LDC2_W o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitLLOAD(LLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitLOOKUPSWITCH(LOOKUPSWITCH o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitLSTORE(LSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitLoadClass(LoadClass o)
Assures the generic preconditions of a LoadClass instance.
void
visitMULTIANEWARRAY(MULTIANEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitNEW(NEW o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitNEWARRAY(NEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitPUTSTATIC(PUTSTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitRET(RET o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
void
visitTABLESWITCH(TABLESWITCH o)
Checks if the constraints of operands of the said instruction(s) are satisfied.

Methods inherited from class org.apache.bcel.generic.EmptyVisitor

visitAALOAD, visitAASTORE, visitACONST_NULL, visitALOAD, visitANEWARRAY, visitARETURN, visitARRAYLENGTH, visitASTORE, visitATHROW, visitAllocationInstruction, visitArithmeticInstruction, visitArrayInstruction, visitBALOAD, visitBASTORE, visitBIPUSH, visitBREAKPOINT, visitBranchInstruction, visitCALOAD, visitCASTORE, visitCHECKCAST, visitCPInstruction, visitConstantPushInstruction, visitConversionInstruction, visitD2F, visitD2I, visitD2L, visitDADD, visitDALOAD, visitDASTORE, visitDCMPG, visitDCMPL, visitDCONST, visitDDIV, visitDLOAD, visitDMUL, visitDNEG, visitDREM, visitDRETURN, visitDSTORE, visitDSUB, visitDUP, visitDUP2, visitDUP2_X1, visitDUP2_X2, visitDUP_X1, visitDUP_X2, visitExceptionThrower, visitF2D, visitF2I, visitF2L, visitFADD, visitFALOAD, visitFASTORE, visitFCMPG, visitFCMPL, visitFCONST, visitFDIV, visitFLOAD, visitFMUL, visitFNEG, visitFREM, visitFRETURN, visitFSTORE, visitFSUB, visitFieldInstruction, visitFieldOrMethod, visitGETFIELD, visitGETSTATIC, visitGOTO, visitGOTO_W, visitGotoInstruction, visitI2B, visitI2C, visitI2D, visitI2F, visitI2L, visitI2S, visitIADD, visitIALOAD, visitIAND, visitIASTORE, visitICONST, visitIDIV, visitIFEQ, visitIFGE, visitIFGT, visitIFLE, visitIFLT, visitIFNE, visitIFNONNULL, visitIFNULL, visitIF_ACMPEQ, visitIF_ACMPNE, visitIF_ICMPEQ, visitIF_ICMPGE, visitIF_ICMPGT, visitIF_ICMPLE, visitIF_ICMPLT, visitIF_ICMPNE, visitIINC, visitILOAD, visitIMPDEP1, visitIMPDEP2, visitIMUL, visitINEG, visitINSTANCEOF, visitINVOKEINTERFACE, visitINVOKESPECIAL, visitINVOKESTATIC, visitINVOKEVIRTUAL, visitIOR, visitIREM, visitIRETURN, visitISHL, visitISHR, visitISTORE, visitISUB, visitIUSHR, visitIXOR, visitIfInstruction, visitInvokeInstruction, visitJSR, visitJSR_W, visitJsrInstruction, visitL2D, visitL2F, visitL2I, visitLADD, visitLALOAD, visitLAND, visitLASTORE, visitLCMP, visitLCONST, visitLDC, visitLDC2_W, visitLDIV, visitLLOAD, visitLMUL, visitLNEG, visitLOOKUPSWITCH, visitLOR, visitLREM, visitLRETURN, visitLSHL, visitLSHR, visitLSTORE, visitLSUB, visitLUSHR, visitLXOR, visitLoadClass, visitLoadInstruction, visitLocalVariableInstruction, visitMONITORENTER, visitMONITOREXIT, visitMULTIANEWARRAY, visitNEW, visitNEWARRAY, visitNOP, visitPOP, visitPOP2, visitPUTFIELD, visitPUTSTATIC, visitPopInstruction, visitPushInstruction, visitRET, visitRETURN, visitReturnInstruction, visitSALOAD, visitSASTORE, visitSIPUSH, visitSWAP, visitSelect, visitStackConsumer, visitStackInstruction, visitStackProducer, visitStoreInstruction, visitTABLESWITCH, visitTypedInstruction, visitUnconditionalBranch, visitVariableLengthInstruction

Field Details

cpg

private ConstantPoolGen cpg
The ConstantPoolGen instance this Visitor operates on.

Constructor Details

InstOperandConstraintVisitor

(package private)  InstOperandConstraintVisitor(ConstantPoolGen cpg)
The only Constructor.

Method Details

constraintViolated

private void constraintViolated(Instruction i,
                                String message)
A utility method to always raise an exeption.

indexValid

private void indexValid(Instruction i,
                        int idx)
A utility method to raise an exception if the index is not a valid constant pool index.

max_locals

private int max_locals()
Utility method to return the max_locals value of the method verified by the surrounding Pass3aVerifier instance.

objarrayequals

private boolean objarrayequals(Object[] o,
                               Object[] p)
A utility method like equals(Object) for arrays. The equality of the elements is based on their equals(Object) method instead of their object identity.

visitALOAD

public void visitALOAD(ALOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitALOAD in interface Visitor
Overrides:
visitALOAD in interface EmptyVisitor

visitANEWARRAY

public void visitANEWARRAY(ANEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitANEWARRAY in interface Visitor
Overrides:
visitANEWARRAY in interface EmptyVisitor

visitASTORE

public void visitASTORE(ASTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitASTORE in interface Visitor
Overrides:
visitASTORE in interface EmptyVisitor

visitCHECKCAST

public void visitCHECKCAST(CHECKCAST o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitCHECKCAST in interface Visitor
Overrides:
visitCHECKCAST in interface EmptyVisitor

visitDLOAD

public void visitDLOAD(DLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitDLOAD in interface Visitor
Overrides:
visitDLOAD in interface EmptyVisitor

visitDSTORE

public void visitDSTORE(DSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitDSTORE in interface Visitor
Overrides:
visitDSTORE in interface EmptyVisitor

visitFLOAD

public void visitFLOAD(FLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitFLOAD in interface Visitor
Overrides:
visitFLOAD in interface EmptyVisitor

visitFSTORE

public void visitFSTORE(FSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitFSTORE in interface Visitor
Overrides:
visitFSTORE in interface EmptyVisitor

visitFieldInstruction

public void visitFieldInstruction(FieldInstruction o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitFieldInstruction in interface Visitor
Overrides:
visitFieldInstruction in interface EmptyVisitor

visitGETSTATIC

public void visitGETSTATIC(GETSTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitGETSTATIC in interface Visitor
Overrides:
visitGETSTATIC in interface EmptyVisitor

visitIINC

public void visitIINC(IINC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitIINC in interface Visitor
Overrides:
visitIINC in interface EmptyVisitor

visitILOAD

public void visitILOAD(ILOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitILOAD in interface Visitor
Overrides:
visitILOAD in interface EmptyVisitor

visitINSTANCEOF

public void visitINSTANCEOF(INSTANCEOF o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitINSTANCEOF in interface Visitor
Overrides:
visitINSTANCEOF in interface EmptyVisitor

visitINVOKEINTERFACE

public void visitINVOKEINTERFACE(INVOKEINTERFACE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitINVOKEINTERFACE in interface Visitor
Overrides:
visitINVOKEINTERFACE in interface EmptyVisitor

visitINVOKESPECIAL

public void visitINVOKESPECIAL(INVOKESPECIAL o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitINVOKESPECIAL in interface Visitor
Overrides:
visitINVOKESPECIAL in interface EmptyVisitor

visitINVOKESTATIC

public void visitINVOKESTATIC(INVOKESTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitINVOKESTATIC in interface Visitor
Overrides:
visitINVOKESTATIC in interface EmptyVisitor

visitINVOKEVIRTUAL

public void visitINVOKEVIRTUAL(INVOKEVIRTUAL o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitINVOKEVIRTUAL in interface Visitor
Overrides:
visitINVOKEVIRTUAL in interface EmptyVisitor

visitISTORE

public void visitISTORE(ISTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitISTORE in interface Visitor
Overrides:
visitISTORE in interface EmptyVisitor

visitInvokeInstruction

public void visitInvokeInstruction(InvokeInstruction o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitInvokeInstruction in interface Visitor
Overrides:
visitInvokeInstruction in interface EmptyVisitor

visitLDC

public void visitLDC(LDC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitLDC in interface Visitor
Overrides:
visitLDC in interface EmptyVisitor

visitLDC2_W

public void visitLDC2_W(LDC2_W o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitLDC2_W in interface Visitor
Overrides:
visitLDC2_W in interface EmptyVisitor

visitLLOAD

public void visitLLOAD(LLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitLLOAD in interface Visitor
Overrides:
visitLLOAD in interface EmptyVisitor

visitLOOKUPSWITCH

public void visitLOOKUPSWITCH(LOOKUPSWITCH o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitLOOKUPSWITCH in interface Visitor
Overrides:
visitLOOKUPSWITCH in interface EmptyVisitor

visitLSTORE

public void visitLSTORE(LSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitLSTORE in interface Visitor
Overrides:
visitLSTORE in interface EmptyVisitor

visitLoadClass

public void visitLoadClass(LoadClass o)
Assures the generic preconditions of a LoadClass instance. The referenced class is loaded and pass2-verified.
Specified by:
visitLoadClass in interface Visitor
Overrides:
visitLoadClass in interface EmptyVisitor

visitMULTIANEWARRAY

public void visitMULTIANEWARRAY(MULTIANEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitMULTIANEWARRAY in interface Visitor
Overrides:
visitMULTIANEWARRAY in interface EmptyVisitor

visitNEW

public void visitNEW(NEW o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitNEW in interface Visitor
Overrides:
visitNEW in interface EmptyVisitor

visitNEWARRAY

public void visitNEWARRAY(NEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitNEWARRAY in interface Visitor
Overrides:
visitNEWARRAY in interface EmptyVisitor

visitPUTSTATIC

public void visitPUTSTATIC(PUTSTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitPUTSTATIC in interface Visitor
Overrides:
visitPUTSTATIC in interface EmptyVisitor

visitRET

public void visitRET(RET o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitRET in interface Visitor
Overrides:
visitRET in interface EmptyVisitor

visitTABLESWITCH

public void visitTABLESWITCH(TABLESWITCH o)
Checks if the constraints of operands of the said instruction(s) are satisfied.
Specified by:
visitTABLESWITCH in interface Visitor
Overrides:
visitTABLESWITCH in interface EmptyVisitor