edu.umd.cs.findbugs.ba
Class InnerClassAccessMap.InstructionCallback

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

private static class InnerClassAccessMap.InstructionCallback
extends java.lang.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 Summary
private  InnerClassAccess access
           
private  int accessCount
           
private  byte[] instructionList
           
private  org.apache.bcel.classfile.JavaClass javaClass
           
private  java.lang.String methodName
           
private  java.lang.String methodSig
           
 
Constructor Summary
InnerClassAccessMap.InstructionCallback(org.apache.bcel.classfile.JavaClass javaClass, java.lang.String methodName, java.lang.String methodSig, byte[] instructionList)
          Constructor.
 
Method Summary
 InnerClassAccess getAccess()
          Get the InnerClassAccess object representing the method.
 void handleInstruction(int opcode, int index)
          Called to indicate that a particular bytecode has been scanned.
private  boolean isValidAccessMethod(java.lang.String methodSig, XField field, boolean isLoad)
          Determine if the method appears to be an accessor of the expected form.
private  void setField(int cpIndex, boolean isStatic, boolean isLoad)
          Called to indicate that a field load or store was encountered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

javaClass

private org.apache.bcel.classfile.JavaClass javaClass

methodName

private java.lang.String methodName

methodSig

private java.lang.String methodSig

instructionList

private byte[] instructionList

access

private InnerClassAccess access

accessCount

private int accessCount
Constructor Detail

InnerClassAccessMap.InstructionCallback

public InnerClassAccessMap.InstructionCallback(org.apache.bcel.classfile.JavaClass javaClass,
                                               java.lang.String methodName,
                                               java.lang.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 Detail

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(java.lang.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