edu.umd.cs.findbugs.ba.bcp

Class FieldAccess

public abstract class FieldAccess extends SingleInstruction implements Constants

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: Load Store

Constructor Summary
FieldAccess(String fieldVarName, String valueVarName)
Constructor.
Method Summary
protected MatchResultcheckConsistent(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 booleanisLongOrDouble(FieldInstruction fieldIns, ConstantPoolGen cpg)
Return whether the given FieldInstruction accesses a long or double field.
protected static VariablesnarfFieldValue(FieldInstruction fieldIns, ConstantPoolGen cpg, ValueNumberFrame frame)
Get a Variable representing the stack value which will either be stored into or loaded from a field.

Constructor Detail

FieldAccess

public FieldAccess(String fieldVarName, String valueVarName)
Constructor.

Parameters: fieldVarName name of the variable to bind to the field valueVarName name of the variable to bind to the value store in or loaded from the field

Method Detail

checkConsistent

protected 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.

Parameters: field Variable representing the field value Variable representing the value loaded/stored bindingSet previous definitions

Returns: a MatchResult containing an updated BindingSet if successful, or null if unsucessful

isLongOrDouble

protected static boolean isLongOrDouble(FieldInstruction fieldIns, ConstantPoolGen cpg)
Return whether the given FieldInstruction accesses a long or double field.

Parameters: fieldIns the FieldInstruction cpg the ConstantPoolGen for the method

snarfFieldValue

protected static Variable snarfFieldValue(FieldInstruction fieldIns, ConstantPoolGen cpg, ValueNumberFrame frame)
Get a Variable representing the stack value which will either be stored into or loaded from a field.

Parameters: fieldIns the FieldInstruction accessing the field cpg the ConstantPoolGen for the method frame the ValueNumberFrame containing the value to be stored or the value loaded

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.