Package edu.umd.cs.findbugs.ba
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 Summary
FieldsModifier and TypeFieldDescriptionprivate InnerClassAccess
private int
private final byte[]
private final org.apache.bcel.classfile.JavaClass
private final String
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionInstructionCallback
(org.apache.bcel.classfile.JavaClass javaClass, String methodName, String methodSig, byte[] instructionList) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGet 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
(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.
-
Field Details
-
javaClass
private final org.apache.bcel.classfile.JavaClass javaClass -
methodName
-
methodSig
-
instructionList
private final byte[] instructionList -
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 methodmethodName
- the name of the access methodmethodSig
- the signature of the access methodinstructionList
- 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 interfaceBytecodeScanner.Callback
- Parameters:
opcode
- the opcode of the instructionindex
- the bytecode offset of the instruction
-
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 fieldrefisStatic
- true if it is a static field accessisLoad
- true if the access is a load
-
isValidAccessMethod
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 signaturefield
- the field accessed by the methodisLoad
- true if the access is a load
-