Class WarningPropertyUtil


  • public abstract class WarningPropertyUtil
    extends java.lang.Object
    Utility methods for creating general warning properties.
    • Field Detail

      • receiverObjectInstructionSet

        private static final java.util.BitSet receiverObjectInstructionSet
        Set of instructions which operate on a receiver object.
    • Constructor Detail

      • WarningPropertyUtil

        public WarningPropertyUtil()
    • Method Detail

      • 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 method
        method - the method
        pc - 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 set
        classContext - ClassContext of the class containing the method
        method - the method
        location - 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 WarningPropertySet
        classContext - the ClassContext
        method - the Method
        location - 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 WarningPropertySet
        classContext - the ClassContext
        method - the Method
        location - 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 WarningPropertySet
        classContext - the ClassContext
        method - the Method
        pc - the bytecode offset of an instruction to get properties for