Class TypeAnalysis

  • All Implemented Interfaces:
    DataflowAnalysis<TypeFrame>, EdgeTypes

    public class TypeAnalysis
    extends FrameDataflowAnalysis<org.apache.bcel.generic.Type,​TypeFrame>
    implements EdgeTypes
    A forward dataflow analysis to determine the types of all values in the Java stack frame at all points in a Java method. The values include local variables and values on the Java operand stack.

    As a side effect, the analysis computes the exception set throwable on each exception edge in the CFG. This information can be used to prune infeasible exception edges, and mark exception edges which propagate only implicit exceptions.

    Author:
    David Hovemeyer
    See Also:
    Dataflow, DataflowAnalysis, TypeFrame
    • Field Detail

      • DEBUG

        public static final boolean DEBUG
      • FORCE_ACCURATE_EXCEPTIONS

        public static final boolean FORCE_ACCURATE_EXCEPTIONS
        Force computation of accurate exceptions.
      • methodGen

        protected org.apache.bcel.generic.MethodGen methodGen
      • cfg

        protected CFG cfg
    • Constructor Detail

      • TypeAnalysis

        public TypeAnalysis​(org.apache.bcel.classfile.Method method,
                            org.apache.bcel.generic.MethodGen methodGen,
                            CFG cfg,
                            DepthFirstSearch dfs,
                            TypeMerger typeMerger,
                            TypeFrameModelingVisitor visitor,
                            RepositoryLookupFailureCallback lookupFailureCallback,
                            ExceptionSetFactory exceptionSetFactory)
        Constructor.
        Parameters:
        method - TODO
        methodGen - the MethodGen whose CFG we'll be analyzing
        cfg - the control flow graph
        dfs - DepthFirstSearch of the method
        typeMerger - object to merge types
        visitor - a TypeFrameModelingVisitor to use to model the effect of instructions
        lookupFailureCallback - lookup failure callback
        exceptionSetFactory - factory for creating ExceptionSet objects
      • TypeAnalysis

        public TypeAnalysis​(org.apache.bcel.classfile.Method method,
                            org.apache.bcel.generic.MethodGen methodGen,
                            CFG cfg,
                            DepthFirstSearch dfs,
                            TypeMerger typeMerger,
                            RepositoryLookupFailureCallback lookupFailureCallback,
                            ExceptionSetFactory exceptionSetFactory)
        Constructor.
        Parameters:
        method - TODO
        methodGen - the MethodGen whose CFG we'll be analyzing
        cfg - the control flow graph
        dfs - DepthFirstSearch of the method
        typeMerger - object to merge types
        lookupFailureCallback - lookup failure callback
        exceptionSetFactory - factory for creating ExceptionSet objects
      • TypeAnalysis

        public TypeAnalysis​(org.apache.bcel.classfile.Method method,
                            org.apache.bcel.generic.MethodGen methodGen,
                            CFG cfg,
                            DepthFirstSearch dfs,
                            RepositoryLookupFailureCallback lookupFailureCallback,
                            ExceptionSetFactory exceptionSetFactory)
        Constructor which uses StandardTypeMerger.
        Parameters:
        method - TODO
        methodGen - the MethodGen whose CFG we'll be analyzing
        cfg - the control flow graph
        dfs - DepthFirstSearch of the method
        lookupFailureCallback - callback for Repository lookup failures
        exceptionSetFactory - factory for creating ExceptionSet objects