Interface ReflectionModel

All Known Implementing Classes:
AbstractReflectionModel, TamiflexReflectionModel
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 ReflectionModel
Makes reflective calls (Method.invoke, Class.newInstance, ...) explicit: returns a body in which each resolved reflective call is preceded by plain Jimple stmts (allocations, direct invokes, field accesses) modeling its effect. Consulted once per method whose body a call graph algorithm inspects - pluggable like CallResolver.

Implementations must be deterministic per method: CHA, RTA, Spark and Qilin may ask for the same method repeatedly (and Spark reuses a CHA graph built from the same model), so repeated calls should return the same Body instance - see AbstractReflectionModel.

  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Whether this model is none().
    static @NonNull ReflectionModel
    Model that resolves nothing - the default everywhere.
    @NonNull Body
    resolve(@NonNull SootMethod method, @NonNull Body body)
     
  • Method Details

    • resolve

      @NonNull Body resolve(@NonNull SootMethod method, @NonNull Body body)
      Parameters:
      method - the method owning body
      body - the body to rewrite (not modified)
      Returns:
      body itself if nothing reflective was resolved, else a rewritten copy
    • none

      static @NonNull ReflectionModel none()
      Model that resolves nothing - the default everywhere.
    • isNone

      default boolean isNone()
      Whether this model is none().