Package edu.umd.cs.findbugs.ba.bcp
Class FieldAccess
java.lang.Object
edu.umd.cs.findbugs.ba.bcp.PatternElement
edu.umd.cs.findbugs.ba.bcp.SingleInstruction
edu.umd.cs.findbugs.ba.bcp.FieldAccess
Base class for Load and Store PatternElements. Handles some of the grunt work
of representing fields and extracting field values from the stack frame.
- Author:
- David Hovemeyer
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected MatchResult
checkConsistent
(Variable field, Variable value, BindingSet bindingSet) Check that the Variables determined for the field and the value loaded/stored are consistent with previous variable definitions.protected static boolean
isLongOrDouble
(org.apache.bcel.generic.FieldInstruction fieldIns, org.apache.bcel.generic.ConstantPoolGen cpg) Return whether the given FieldInstruction accesses a long or double field.protected static Variable
snarfFieldValue
(org.apache.bcel.generic.FieldInstruction fieldIns, org.apache.bcel.generic.ConstantPoolGen cpg, ValueNumberFrame frame) Get a Variable representing the stack value which will either be stored into or loaded from a field.Methods inherited from class edu.umd.cs.findbugs.ba.bcp.SingleInstruction
acceptBranch, maxOccur, minOccur
Methods inherited from class edu.umd.cs.findbugs.ba.bcp.PatternElement
addOrCheckDefinition, allowTrailingEdges, dominatedBy, getDominatedBy, getLabel, getNext, label, lookup, match, setAllowTrailingEdges, setIndex, setNext, toString
-
Constructor Details
-
FieldAccess
Constructor.- Parameters:
fieldVarName
- name of the variable to bind to the fieldvalueVarName
- name of the variable to bind to the value store in or loaded from the field
-
-
Method Details
-
checkConsistent
Check that the Variables determined for the field and the value loaded/stored are consistent with previous variable definitions.- Parameters:
field
- Variable representing the fieldvalue
- Variable representing the value loaded/storedbindingSet
- previous definitions- Returns:
- a MatchResult containing an updated BindingSet if successful, or null if unsuccessful
-
isLongOrDouble
protected static boolean isLongOrDouble(org.apache.bcel.generic.FieldInstruction fieldIns, org.apache.bcel.generic.ConstantPoolGen cpg) Return whether the given FieldInstruction accesses a long or double field.- Parameters:
fieldIns
- the FieldInstructioncpg
- the ConstantPoolGen for the method
-
snarfFieldValue
protected static Variable snarfFieldValue(org.apache.bcel.generic.FieldInstruction fieldIns, org.apache.bcel.generic.ConstantPoolGen cpg, ValueNumberFrame frame) throws DataflowAnalysisException Get a Variable representing the stack value which will either be stored into or loaded from a field.- Parameters:
fieldIns
- the FieldInstruction accessing the fieldcpg
- the ConstantPoolGen for the methodframe
- the ValueNumberFrame containing the value to be stored or the value loaded- Throws:
DataflowAnalysisException
-