Class CPGBuilder


  • public class CPGBuilder
    extends Object
    Builder that lifts every method in a class pool to SSA IR and assembles a CodePropertyGraph with optional call-graph, PDG, and SDG edge layers.
    • Constructor Detail

      • CPGBuilder

        public CPGBuilder​(ClassPool classPool)
        Creates a builder over the given class pool.
        Parameters:
        classPool - the classes whose methods populate the graph
    • Method Detail

      • getClassPool

        public ClassPool getClassPool()
        Returns:
        the class pool
      • getCallGraph

        public CallGraph getCallGraph()
        Returns:
        the call graph
      • isIncludeCallGraph

        public boolean isIncludeCallGraph()
        Returns:
        whether call-graph edges will be built
      • isIncludePDG

        public boolean isIncludePDG()
        Returns:
        whether PDG edges will be built
      • isIncludeSDG

        public boolean isIncludeSDG()
        Returns:
        whether SDG edges will be built
      • forClassPool

        public static CPGBuilder forClassPool​(ClassPool pool)
        Creates a builder over the given class pool.
        Parameters:
        pool - the classes whose methods populate the graph
        Returns:
        a new builder
      • withCallGraph

        public CPGBuilder withCallGraph​(CallGraph callGraph)
        Reuses a prebuilt call graph and enables call edges.
        Parameters:
        callGraph - the call graph to reuse
        Returns:
        this builder
      • withCallGraph

        public CPGBuilder withCallGraph()
        Builds a call graph from the class pool and enables call edges.
        Returns:
        this builder
      • withPDG

        public CPGBuilder withPDG()
        Enables intraprocedural dependence (PDG) edges.
        Returns:
        this builder
      • withSDG

        public CPGBuilder withSDG()
        Enables interprocedural (SDG) edges; implies PDG edges.
        Returns:
        this builder
      • withoutCallGraph

        public CPGBuilder withoutCallGraph()
        Disables call-graph edges.
        Returns:
        this builder
      • withoutPDG

        public CPGBuilder withoutPDG()
        Disables PDG edges.
        Returns:
        this builder
      • build

        public CodePropertyGraph build()
        Lifts all methods and assembles the graph with the configured edge layers.
        Returns:
        the completed code property graph