Package edu.umd.cs.findbugs.props
Class WarningPropertyUtil
java.lang.Object
edu.umd.cs.findbugs.props.WarningPropertyUtil
Utility methods for creating general warning properties.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final BitSet
Set of instructions which operate on a receiver object. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addPropertiesForDataMining
(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, Location location) Add all relevant general warning properties to the given property set for the given Location.static void
addPropertiesForLocation
(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, int pc) Add all relevant general warning properties to the given property set for the given Location.private static void
addReceiverObjectType
(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, Location location) Add a RECEIVER_OBJECT_TYPE warning property for a particular location in a method to given warning property set.private static void
addRecentlyCalledMethods
(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, Location location) Add CALLED_METHOD_n warning properties based on methods which have been called and returned normally at given Location.private static Location
pcToLocation
(ClassContext classContext, org.apache.bcel.classfile.Method method, int pc) Get a Location matching the given PC value.
-
Field Details
-
receiverObjectInstructionSet
Set of instructions which operate on a receiver object.
-
-
Constructor Details
-
WarningPropertyUtil
public WarningPropertyUtil()
-
-
Method Details
-
pcToLocation
private static Location pcToLocation(ClassContext classContext, org.apache.bcel.classfile.Method method, int pc) throws CFGBuilderException Get a Location matching the given PC value. Because of JSR subroutines, there may be multiple Locations referring to the given instruction. This method simply returns one of them arbitrarily.- Parameters:
classContext
- the ClassContext containing the methodmethod
- the methodpc
- a PC value of an instruction in the method- Returns:
- a Location corresponding to the PC value, or null if no such Location can be found
- Throws:
CFGBuilderException
-
addReceiverObjectType
private static void addReceiverObjectType(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, Location location) Add a RECEIVER_OBJECT_TYPE warning property for a particular location in a method to given warning property set.- Parameters:
propertySet
- the property setclassContext
- ClassContext of the class containing the methodmethod
- the methodlocation
- Location within the method
-
addRecentlyCalledMethods
private static void addRecentlyCalledMethods(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, Location location) Add CALLED_METHOD_n warning properties based on methods which have been called and returned normally at given Location.- Parameters:
propertySet
- the WarningPropertySetclassContext
- the ClassContextmethod
- the Methodlocation
- the Location
-
addPropertiesForDataMining
public static void addPropertiesForDataMining(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, Location location) Add all relevant general warning properties to the given property set for the given Location.- Parameters:
propertySet
- the WarningPropertySetclassContext
- the ClassContextmethod
- the Methodlocation
- the Location
-
addPropertiesForLocation
public static void addPropertiesForLocation(WarningPropertySet<WarningProperty> propertySet, ClassContext classContext, org.apache.bcel.classfile.Method method, int pc) Add all relevant general warning properties to the given property set for the given Location.- Parameters:
propertySet
- the WarningPropertySetclassContext
- the ClassContextmethod
- the Methodpc
- the bytecode offset of an instruction to get properties for
-