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 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
Fields Modifier and Type Field Description private InnerClassAccessaccessprivate intaccessCountprivate byte[]instructionListprivate org.apache.bcel.classfile.JavaClassjavaClassprivate java.lang.StringmethodNameprivate java.lang.StringmethodSig
-
Constructor Summary
Constructors Constructor Description InstructionCallback(org.apache.bcel.classfile.JavaClass javaClass, java.lang.String methodName, java.lang.String methodSig, byte[] instructionList)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InnerClassAccessgetAccess()Get the InnerClassAccess object representing the method.voidhandleInstruction(int opcode, int index)Called to indicate that a particular bytecode has been scanned.private booleanisValidAccessMethod(java.lang.String methodSig, XField field, boolean isLoad)Determine if the method appears to be an accessor of the expected form.private voidsetField(int cpIndex, boolean isStatic, boolean isLoad)Called to indicate that a field load or store was encountered.
-
-
-
Field Detail
-
javaClass
private final org.apache.bcel.classfile.JavaClass javaClass
-
methodName
private final java.lang.String methodName
-
methodSig
private final java.lang.String methodSig
-
instructionList
private final byte[] instructionList
-
access
private InnerClassAccess access
-
accessCount
private int accessCount
-
-
Constructor Detail
-
InstructionCallback
public 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 methodmethodName- the name of the access methodmethodSig- the signature of the access methodinstructionList- the bytecode of the method
-
-
Method Detail
-
handleInstruction
public void handleInstruction(int opcode, int index)Description copied from interface:BytecodeScanner.CallbackCalled to indicate that a particular bytecode has been scanned.- Specified by:
handleInstructionin interfaceBytecodeScanner.Callback- Parameters:
opcode- the opcode of the instructionindex- 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 fieldrefisStatic- true if it is a static field accessisLoad- 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 signaturefield- the field accessed by the methodisLoad- true if the access is a load
-
-