Class DefaultReflectionResolver
- java.lang.Object
-
- org.checkerframework.common.reflection.DefaultReflectionResolver
-
- All Implemented Interfaces:
ReflectionResolver
public class DefaultReflectionResolver extends java.lang.Object implements ReflectionResolver
Default implementation ofReflectionResolver
. It resolves calls to:Method.invoke(Object, Object...)
Constructor.newInstance(Object...)
- See the Checker Framework Manual:
- Reflection resolution
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MSG_PREFEX_REFLECTION
Message prefix added to verbose reflection messages.-
Fields inherited from interface org.checkerframework.common.reflection.ReflectionResolver
INIT, INIT_LIST
-
-
Constructor Summary
Constructors Constructor Description DefaultReflectionResolver(BaseTypeChecker checker, MethodValAnnotatedTypeFactory methodValProvider, boolean debug)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isReflectiveMethodInvocation(com.sun.source.tree.MethodInvocationTree tree)
Returns true if the given tree represents a reflective method or constructor call.AnnotatedTypeFactory.ParameterizedExecutableType
resolveReflectiveCall(AnnotatedTypeFactory factory, com.sun.source.tree.MethodInvocationTree tree, AnnotatedTypeFactory.ParameterizedExecutableType origResult)
Resolve reflection and return the result offactory.methodFromUse
for the actual, resolved method or constructor call.
-
-
-
Field Detail
-
MSG_PREFEX_REFLECTION
public static final java.lang.String MSG_PREFEX_REFLECTION
Message prefix added to verbose reflection messages.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultReflectionResolver
public DefaultReflectionResolver(BaseTypeChecker checker, MethodValAnnotatedTypeFactory methodValProvider, boolean debug)
-
-
Method Detail
-
isReflectiveMethodInvocation
public boolean isReflectiveMethodInvocation(com.sun.source.tree.MethodInvocationTree tree)
Description copied from interface:ReflectionResolver
Returns true if the given tree represents a reflective method or constructor call.- Specified by:
isReflectiveMethodInvocation
in interfaceReflectionResolver
- Returns:
true
iff tree is a reflective method invocation,false
otherwise
-
resolveReflectiveCall
public AnnotatedTypeFactory.ParameterizedExecutableType resolveReflectiveCall(AnnotatedTypeFactory factory, com.sun.source.tree.MethodInvocationTree tree, AnnotatedTypeFactory.ParameterizedExecutableType origResult)
Description copied from interface:ReflectionResolver
Resolve reflection and return the result offactory.methodFromUse
for the actual, resolved method or constructor call. If the reflective method cannot be resolved the original result (origResult
) is returned.- Specified by:
resolveReflectiveCall
in interfaceReflectionResolver
- Parameters:
factory
- the currently used AnnotatedTypeFactorytree
- the reflective invocation tree (m.invoke or c.newInstance)origResult
- the original result for the unresolved, reflective method call
-
-