Interface ReflectionResolver

  • All Known Implementing Classes:
    DefaultReflectionResolver

    public interface ReflectionResolver
    Interface for reflection resolvers that handle reflective method calls such as Method.invoke(Object, Object...) or Constructor.newInstance(Object...).
    See the Checker Framework Manual:
    Reflection resolution
    • Field Detail

      • INIT

        static final java.lang.String INIT
        The "method name" of constructors.
        See Also:
        Constant Field Values
      • INIT_LIST

        static final java.util.List<java.lang.String> INIT_LIST
        A list containing just the "method name" of constructors. Clients must not modify this list.
    • Method Detail

      • isReflectiveMethodInvocation

        boolean isReflectiveMethodInvocation​(com.sun.source.tree.MethodInvocationTree tree)
        Returns true if the given tree represents a reflective method or constructor call.
        Returns:
        true iff tree is a reflective method invocation, false otherwise
      • resolveReflectiveCall

        AnnotatedTypeFactory.ParameterizedExecutableType resolveReflectiveCall​(AnnotatedTypeFactory factory,
                                                                               com.sun.source.tree.MethodInvocationTree tree,
                                                                               AnnotatedTypeFactory.ParameterizedExecutableType origResult)
        Resolve reflection and return the result of factory.methodFromUse for the actual, resolved method or constructor call. If the reflective method cannot be resolved the original result (origResult) is returned.
        Parameters:
        factory - the currently used AnnotatedTypeFactory
        tree - the reflective invocation tree (m.invoke or c.newInstance)
        origResult - the original result for the unresolved, reflective method call