Class InnerClassAccessMap.InstructionCallback

java.lang.Object
edu.umd.cs.findbugs.ba.InnerClassAccessMap.InstructionCallback
All Implemented Interfaces:
BytecodeScanner.Callback
Enclosing class:
InnerClassAccessMap

private static class InnerClassAccessMap.InstructionCallback extends Object implements BytecodeScanner.Callback
Callback to scan an access method to determine what field it accesses, and whether the field is loaded or stored.
  • Field Details

    • javaClass

      private final org.apache.bcel.classfile.JavaClass javaClass
    • methodName

      private final String methodName
    • methodSig

      private final String methodSig
    • instructionList

      private final byte[] instructionList
    • access

      private InnerClassAccess access
    • accessCount

      private int accessCount
  • Constructor Details

    • InstructionCallback

      public InstructionCallback(org.apache.bcel.classfile.JavaClass javaClass, String methodName, String methodSig, byte[] instructionList)
      Constructor.
      Parameters:
      javaClass - the class containing the access method
      methodName - the name of the access method
      methodSig - the signature of the access method
      instructionList - the bytecode of the method
  • Method Details

    • handleInstruction

      public void handleInstruction(int opcode, int index)
      Description copied from interface: BytecodeScanner.Callback
      Called to indicate that a particular bytecode has been scanned.
      Specified by:
      handleInstruction in interface BytecodeScanner.Callback
      Parameters:
      opcode - the opcode of the instruction
      index - the bytecode offset of the instruction
    • getAccess

      public InnerClassAccess getAccess()
      Get the InnerClassAccess object representing the method.
      Returns:
      the InnerClassAccess, or null if the method was not found to be a simple load or store in the expected form
    • setField

      private void setField(int cpIndex, boolean isStatic, boolean isLoad)
      Called to indicate that a field load or store was encountered.
      Parameters:
      cpIndex - the constant pool index of the fieldref
      isStatic - true if it is a static field access
      isLoad - true if the access is a load
    • isValidAccessMethod

      private boolean isValidAccessMethod(String methodSig, XField field, boolean isLoad)
      Determine if the method appears to be an accessor of the expected form. This has only been tested with the Sun JDK 1.4 javac (definitely) and jikes 1.18 (I think).
      Parameters:
      methodSig - the method's signature
      field - the field accessed by the method
      isLoad - true if the access is a load