Class LocalFlowSpec<Source extends org.openrewrite.java.tree.Expression,Sink extends org.openrewrite.java.tree.J>

java.lang.Object
org.openrewrite.analysis.dataflow.LocalFlowSpec<Source,Sink>
Direct Known Subclasses:
LocalTaintFlowSpec

@Incubating(since="7.24.0") public abstract class LocalFlowSpec<Source extends org.openrewrite.java.tree.Expression,Sink extends org.openrewrite.java.tree.J> extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Type
     
    protected final Type
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
    boolean
    isAdditionalFlowStep(org.openrewrite.java.tree.Expression srcExpression, org.openrewrite.Cursor srcCursor, org.openrewrite.java.tree.Expression sinkExpression, org.openrewrite.Cursor sinkCursor)
    takes an existing flow-step in the graph and offers a potential next flow step.
    boolean
    isBarrier(org.openrewrite.java.tree.Expression expression, org.openrewrite.Cursor cursor)
    Holds if flow through `expression` is prohibited.
    boolean
    isBarrierGuard(Guard guard, boolean branch)
     
    final boolean
    isFlowStep(org.openrewrite.java.tree.Expression srcExpression, org.openrewrite.Cursor srcCursor, org.openrewrite.java.tree.Expression sinkExpression, org.openrewrite.Cursor sinkCursor)
     
    abstract boolean
    isSink(Sink sink, org.openrewrite.Cursor cursor)
    The following is always true: sink == cursor.getValue().
    abstract boolean
    isSource(Source source, org.openrewrite.Cursor cursor)
    The following is always true: source == cursor.getValue().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • sourceType

      protected final Type sourceType
    • sinkType

      protected final Type sinkType
  • Constructor Details

    • LocalFlowSpec

      protected LocalFlowSpec()
  • Method Details

    • getSourceType

      public Class<?> getSourceType()
    • getSinkType

      public Class<?> getSinkType()
    • isSource

      public abstract boolean isSource(Source source, org.openrewrite.Cursor cursor)
      The following is always true: source == cursor.getValue().
      Parameters:
      source - The Expression to check to determine if it should be considered flow-graph source.
      cursor - The current cursor position of the source.
      Returns:
      true if source and cursor should be considered the source or root of a flow graph.
    • isSink

      public abstract boolean isSink(Sink sink, org.openrewrite.Cursor cursor)
      The following is always true: sink == cursor.getValue().
      Parameters:
      sink - The Expression to check to determine if it should be considered a flow-graph sink.
      cursor - The current cursor position of the sink.
      Returns:
      true if sink and cursor should be considered the sink or leaf of a flow graph.
    • isFlowStep

      public final boolean isFlowStep(org.openrewrite.java.tree.Expression srcExpression, org.openrewrite.Cursor srcCursor, org.openrewrite.java.tree.Expression sinkExpression, org.openrewrite.Cursor sinkCursor)
    • isAdditionalFlowStep

      public boolean isAdditionalFlowStep(org.openrewrite.java.tree.Expression srcExpression, org.openrewrite.Cursor srcCursor, org.openrewrite.java.tree.Expression sinkExpression, org.openrewrite.Cursor sinkCursor)
      takes an existing flow-step in the graph and offers a potential next flow step. The method can then decide if the offered potential next flow step should be considered a valid next flow step in the graph. Allows for ad-hoc taint tracking by allowing for additional, non-default flow steps to be added to the flow graph. The following is always true: srcExpression == srcCursor.getValue() && sinkExpression == sinkCursor.getValue().
    • isBarrierGuard

      public boolean isBarrierGuard(Guard guard, boolean branch)
    • isBarrier

      public boolean isBarrier(org.openrewrite.java.tree.Expression expression, org.openrewrite.Cursor cursor)
      Holds if flow through `expression` is prohibited.