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 Details

    • constantPoolGen

      private final ConstantPoolGen constantPoolGen
      The ConstantPoolGen instance this Visitor operates on.
  • Constructor Details

    • InstOperandConstraintVisitor

      InstOperandConstraintVisitor(ConstantPoolGen constantPoolGen)
      Constructs a new instance.
  • Method Details

    • constraintViolated

      private void constraintViolated(Instruction i, 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 method.
      invoke - The instruction that references the method.
      Returns:
      The referenced method or null if not found.
    • getMethodRecursive

      private Method getMethodRecursive(JavaClass jc, InvokeInstruction invoke) throws 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 method.
      invoke - The instruction that references the method.
      Returns:
      The referenced method or null if not found.
      Throws:
      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 interface Visitor
      Overrides:
      visitALOAD in class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • visitINVOKEDYNAMIC

      public void visitINVOKEDYNAMIC(INVOKEDYNAMIC o)
      Checks if the constraints of operands of the said instruction(s) are satisfied.
      Specified by:
      visitINVOKEDYNAMIC in interface Visitor
      Overrides:
      visitINVOKEDYNAMIC in class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • visitLDC

      public void visitLDC(LDC ldc)
      Checks if the constraints of operands of the said instruction(s) are satisfied.
      Specified by:
      visitLDC in interface Visitor
      Overrides:
      visitLDC in class EmptyVisitor
      Parameters:
      ldc - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 interface Visitor
      Overrides:
      visitLoadClass in class EmptyVisitor
      Parameters:
      loadClass - The load class.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.
    • 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 class EmptyVisitor
      Parameters:
      o - The instruction.