Package org.apache.bcel.verifier.statics
Class Pass3aVerifier.InstOperandConstraintVisitor
- java.lang.Object
-
- org.apache.bcel.generic.EmptyVisitor
-
- org.apache.bcel.verifier.statics.Pass3aVerifier.InstOperandConstraintVisitor
-
- All Implemented Interfaces:
Visitor
- Enclosing class:
- Pass3aVerifier
private final class Pass3aVerifier.InstOperandConstraintVisitor extends EmptyVisitor
This visitor class does the actual checking for the instruction operand's constraints.
-
-
Field Summary
Fields Modifier and Type Field Description private ConstantPoolGen
constantPoolGen
The ConstantPoolGen instance this Visitor operates on.
-
Constructor Summary
Constructors Constructor Description InstOperandConstraintVisitor(ConstantPoolGen constantPoolGen)
The only Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
constraintViolated(Instruction i, java.lang.String message)
A utility method to always raise an exception.private Method
getMethod(JavaClass jc, InvokeInstruction invoke)
Looks for the method referenced by the given invoke instruction in the given class.private Method
getMethodRecursive(JavaClass jc, InvokeInstruction invoke)
Looks for the method referenced by the given invoke instruction in the given class or its super classes and super interfaces.private ObjectType
getObjectType(FieldInstruction o)
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
maxLocals()
Utility method to return the max_locals value of the method verified by the surrounding Pass3aVerifier instance.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
visitFieldInstruction(FieldInstruction 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
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
visitINVOKEDYNAMIC(INVOKEDYNAMIC 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
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
visitLDC(LDC ldc)
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
visitLoadClass(LoadClass loadClass)
Assures the generic preconditions of a LoadClass instance.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
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, visitAllocationInstruction, visitARETURN, visitArithmeticInstruction, visitArrayInstruction, visitARRAYLENGTH, visitATHROW, visitBALOAD, visitBASTORE, visitBIPUSH, visitBranchInstruction, visitBREAKPOINT, visitCALOAD, visitCASTORE, visitConstantPushInstruction, visitConversionInstruction, visitCPInstruction, visitD2F, visitD2I, visitD2L, visitDADD, visitDALOAD, visitDASTORE, visitDCMPG, visitDCMPL, visitDCONST, visitDDIV, visitDMUL, visitDNEG, visitDREM, visitDRETURN, visitDSUB, visitDUP, visitDUP_X1, visitDUP_X2, visitDUP2, visitDUP2_X1, visitDUP2_X2, visitExceptionThrower, visitF2D, visitF2I, visitF2L, visitFADD, visitFALOAD, visitFASTORE, visitFCMPG, visitFCMPL, visitFCONST, visitFDIV, visitFieldOrMethod, visitFMUL, visitFNEG, visitFREM, visitFRETURN, visitFSUB, visitGETFIELD, visitGOTO, visitGOTO_W, visitGotoInstruction, visitI2B, visitI2C, visitI2D, visitI2F, visitI2L, visitI2S, visitIADD, visitIALOAD, visitIAND, visitIASTORE, visitICONST, visitIDIV, visitIF_ACMPEQ, visitIF_ACMPNE, visitIF_ICMPEQ, visitIF_ICMPGE, visitIF_ICMPGT, visitIF_ICMPLE, visitIF_ICMPLT, visitIF_ICMPNE, visitIFEQ, visitIFGE, visitIFGT, visitIfInstruction, visitIFLE, visitIFLT, visitIFNE, visitIFNONNULL, visitIFNULL, visitIMPDEP1, visitIMPDEP2, visitIMUL, visitINEG, visitIOR, visitIREM, visitIRETURN, visitISHL, visitISHR, visitISUB, visitIUSHR, visitIXOR, visitJSR, visitJSR_W, visitJsrInstruction, visitL2D, visitL2F, visitL2I, visitLADD, visitLALOAD, visitLAND, visitLASTORE, visitLCMP, visitLCONST, visitLDIV, visitLMUL, visitLNEG, visitLoadInstruction, visitLocalVariableInstruction, visitLOR, visitLREM, visitLRETURN, visitLSHL, visitLSHR, visitLSUB, visitLUSHR, visitLXOR, visitMONITORENTER, visitMONITOREXIT, visitNOP, visitPOP, visitPOP2, visitPopInstruction, visitPushInstruction, visitPUTFIELD, visitRETURN, visitReturnInstruction, visitSALOAD, visitSASTORE, visitSelect, visitSIPUSH, visitStackConsumer, visitStackInstruction, visitStackProducer, visitStoreInstruction, visitSWAP, visitTypedInstruction, visitUnconditionalBranch, visitVariableLengthInstruction
-
-
-
-
Field Detail
-
constantPoolGen
private final ConstantPoolGen constantPoolGen
The ConstantPoolGen instance this Visitor operates on.
-
-
Constructor Detail
-
InstOperandConstraintVisitor
InstOperandConstraintVisitor(ConstantPoolGen constantPoolGen)
The only Constructor.
-
-
Method Detail
-
constraintViolated
private void constraintViolated(Instruction i, java.lang.String message)
A utility method to always raise an exception.
-
getMethod
private Method getMethod(JavaClass jc, InvokeInstruction invoke)
Looks for the method referenced by the given invoke instruction in the given class.- Parameters:
jc
- the class that defines the referenced methodinvoke
- the instruction that references the method- Returns:
- the referenced method or null if not found.
-
getMethodRecursive
private Method getMethodRecursive(JavaClass jc, InvokeInstruction invoke) throws java.lang.ClassNotFoundException
Looks for the method referenced by the given invoke instruction in the given class or its super classes and super interfaces.- Parameters:
jc
- the class that defines the referenced methodinvoke
- the instruction that references the method- Returns:
- the referenced method or null if not found.
- Throws:
java.lang.ClassNotFoundException
-
getObjectType
private ObjectType getObjectType(FieldInstruction o)
-
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.
-
maxLocals
private int maxLocals()
Utility method to return the max_locals value of the method verified by the surrounding Pass3aVerifier instance.
-
visitALOAD
public void visitALOAD(ALOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitALOAD
in interfaceVisitor
- Overrides:
visitALOAD
in classEmptyVisitor
-
visitANEWARRAY
public void visitANEWARRAY(ANEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitANEWARRAY
in interfaceVisitor
- Overrides:
visitANEWARRAY
in classEmptyVisitor
-
visitASTORE
public void visitASTORE(ASTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitASTORE
in interfaceVisitor
- Overrides:
visitASTORE
in classEmptyVisitor
-
visitCHECKCAST
public void visitCHECKCAST(CHECKCAST o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitCHECKCAST
in interfaceVisitor
- Overrides:
visitCHECKCAST
in classEmptyVisitor
-
visitDLOAD
public void visitDLOAD(DLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitDLOAD
in interfaceVisitor
- Overrides:
visitDLOAD
in classEmptyVisitor
-
visitDSTORE
public void visitDSTORE(DSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitDSTORE
in interfaceVisitor
- Overrides:
visitDSTORE
in classEmptyVisitor
-
visitFieldInstruction
public void visitFieldInstruction(FieldInstruction o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitFieldInstruction
in interfaceVisitor
- Overrides:
visitFieldInstruction
in classEmptyVisitor
-
visitFLOAD
public void visitFLOAD(FLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitFLOAD
in interfaceVisitor
- Overrides:
visitFLOAD
in classEmptyVisitor
-
visitFSTORE
public void visitFSTORE(FSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitFSTORE
in interfaceVisitor
- Overrides:
visitFSTORE
in classEmptyVisitor
-
visitGETSTATIC
public void visitGETSTATIC(GETSTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitGETSTATIC
in interfaceVisitor
- Overrides:
visitGETSTATIC
in classEmptyVisitor
-
visitIINC
public void visitIINC(IINC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitIINC
in interfaceVisitor
- Overrides:
visitIINC
in classEmptyVisitor
-
visitILOAD
public void visitILOAD(ILOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitILOAD
in interfaceVisitor
- Overrides:
visitILOAD
in classEmptyVisitor
-
visitINSTANCEOF
public void visitINSTANCEOF(INSTANCEOF o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitINSTANCEOF
in interfaceVisitor
- Overrides:
visitINSTANCEOF
in classEmptyVisitor
-
visitINVOKEDYNAMIC
public void visitINVOKEDYNAMIC(INVOKEDYNAMIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitINVOKEDYNAMIC
in interfaceVisitor
- Overrides:
visitINVOKEDYNAMIC
in classEmptyVisitor
-
visitInvokeInstruction
public void visitInvokeInstruction(InvokeInstruction o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitInvokeInstruction
in interfaceVisitor
- Overrides:
visitInvokeInstruction
in classEmptyVisitor
-
visitINVOKEINTERFACE
public void visitINVOKEINTERFACE(INVOKEINTERFACE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitINVOKEINTERFACE
in interfaceVisitor
- Overrides:
visitINVOKEINTERFACE
in classEmptyVisitor
-
visitINVOKESPECIAL
public void visitINVOKESPECIAL(INVOKESPECIAL o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitINVOKESPECIAL
in interfaceVisitor
- Overrides:
visitINVOKESPECIAL
in classEmptyVisitor
-
visitINVOKESTATIC
public void visitINVOKESTATIC(INVOKESTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitINVOKESTATIC
in interfaceVisitor
- Overrides:
visitINVOKESTATIC
in classEmptyVisitor
-
visitINVOKEVIRTUAL
public void visitINVOKEVIRTUAL(INVOKEVIRTUAL o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitINVOKEVIRTUAL
in interfaceVisitor
- Overrides:
visitINVOKEVIRTUAL
in classEmptyVisitor
-
visitISTORE
public void visitISTORE(ISTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitISTORE
in interfaceVisitor
- Overrides:
visitISTORE
in classEmptyVisitor
-
visitLDC
public void visitLDC(LDC ldc)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitLDC
in interfaceVisitor
- Overrides:
visitLDC
in classEmptyVisitor
-
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 interfaceVisitor
- Overrides:
visitLDC2_W
in classEmptyVisitor
-
visitLLOAD
public void visitLLOAD(LLOAD o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitLLOAD
in interfaceVisitor
- Overrides:
visitLLOAD
in classEmptyVisitor
-
visitLoadClass
public void visitLoadClass(LoadClass loadClass)
Assures the generic preconditions of a LoadClass instance. The referenced class is loaded and pass2-verified.- Specified by:
visitLoadClass
in interfaceVisitor
- Overrides:
visitLoadClass
in classEmptyVisitor
-
visitLOOKUPSWITCH
public void visitLOOKUPSWITCH(LOOKUPSWITCH o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitLOOKUPSWITCH
in interfaceVisitor
- Overrides:
visitLOOKUPSWITCH
in classEmptyVisitor
-
visitLSTORE
public void visitLSTORE(LSTORE o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitLSTORE
in interfaceVisitor
- Overrides:
visitLSTORE
in classEmptyVisitor
-
visitMULTIANEWARRAY
public void visitMULTIANEWARRAY(MULTIANEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitMULTIANEWARRAY
in interfaceVisitor
- Overrides:
visitMULTIANEWARRAY
in classEmptyVisitor
-
visitNEW
public void visitNEW(NEW o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitNEW
in interfaceVisitor
- Overrides:
visitNEW
in classEmptyVisitor
-
visitNEWARRAY
public void visitNEWARRAY(NEWARRAY o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitNEWARRAY
in interfaceVisitor
- Overrides:
visitNEWARRAY
in classEmptyVisitor
-
visitPUTSTATIC
public void visitPUTSTATIC(PUTSTATIC o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitPUTSTATIC
in interfaceVisitor
- Overrides:
visitPUTSTATIC
in classEmptyVisitor
-
visitRET
public void visitRET(RET o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitRET
in interfaceVisitor
- Overrides:
visitRET
in classEmptyVisitor
-
visitTABLESWITCH
public void visitTABLESWITCH(TABLESWITCH o)
Checks if the constraints of operands of the said instruction(s) are satisfied.- Specified by:
visitTABLESWITCH
in interfaceVisitor
- Overrides:
visitTABLESWITCH
in classEmptyVisitor
-
-