Interface DynamicInvokeResolver

All Known Implementing Classes:
BootstrapMethodHandleResolver
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DynamicInvokeResolver
Decides which methods an invokedynamic call site transfers control to. Shared by CHA, RTA, Spark and Qilin (configured via CallGraphConfigBuilder.dynamicInvokeResolver(...)), so all algorithms agree on which lambda bodies / method references are reachable.

A LambdaMetafactory implementation is reached through the FunctionalObject the call site creates: calls on that object dispatch to it, with arguments and return value. Only with withCreationSiteEdges() is it additionally called from the invokedynamic statement itself (for views that lack the code calling the lambda). All other targets are called from the invokedynamic statement, see creationSiteTargets(sootup.core.jimple.common.expr.JDynamicInvokeExpr).

  • Method Details

    • resolve

      @NonNull List<DynamicInvokeTarget> resolve(@NonNull JDynamicInvokeExpr expr)
      Parameters:
      expr - the invokedynamic expression
      Returns:
      the methods expr may transfer control to; empty if unresolved
    • none

      static @NonNull DynamicInvokeResolver none()
      Resolves nothing: invokedynamic call sites get no call targets.
    • bootstrapMethodHandles

      static @NonNull DynamicInvokeResolver bootstrapMethodHandles()
      Every method referenced by a MethodHandle bootstrap argument is a target, e.g. the synthetic lambda body passed to LambdaMetafactory. The default everywhere.
    • isNone

      default boolean isNone()
      Whether this resolver is none().
    • creationSiteEdges

      default boolean creationSiteEdges()
      Whether lambda implementations are also called from their invokedynamic statement.
    • withCreationSiteEdges

      default @NonNull DynamicInvokeResolver withCreationSiteEdges()
      This resolver, plus edges from each invokedynamic statement to its lambda implementation.
    • creationSiteTargets

      default @NonNull List<DynamicInvokeTarget> creationSiteTargets(@NonNull JDynamicInvokeExpr expr)
      Targets called from the invokedynamic statement itself (see class doc).
    • desugar

      default @NonNull Body desugar(@NonNull SootMethod method, @NonNull Body body, @NonNull View view)
      Makes the implicit calls of other invokedynamics explicit (string concatenation's toString(), records' equals/hashCode/toString). Identity by default.
      Returns:
      body itself if nothing changed, else a rewritten copy - the same one on each call, so statements of call graph edges and of later passes over the body match