Class ReflectiveInvocation
java.lang.Object
edu.umd.cs.findbugs.detect.ReflectiveInvocation
A single invocation of a reflective field accessor (MethodHandle, VarHandle or
AtomicFieldUpdater). The
ReflectiveInvocation.Kind passed to create(ReflectiveInvocation.Kind, XField, String) selects the rules used to decide
whether the called method actually accesses a field and, if so, which access type it implies.
For a MethodHandle the access type is fixed at the accessor's declaration, so accessType
is null here and the accessor's own type is used during resolution. For VarHandle and
AtomicFieldUpdater the access type is derived from the invoked method name.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final XFieldThe field holding the accessor handle.private final ReflectiveAccessTracker.AccessTypeGETTER/SETTER/BOTH, ornullwhen the type comes from the accessor (MethodHandle). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateReflectiveInvocation(XField accessorField, ReflectiveAccessTracker.AccessType accessType) -
Method Summary
Modifier and TypeMethodDescription(package private) XField(package private) ReflectiveAccessTracker.AccessType(package private) static ReflectiveInvocationcreate(ReflectiveInvocation.Kind kind, XField accessorField, String invokedMethodName) Builds an invocation for a recognized accessor call, or returnsnullwhen the called method is not a field-accessing invocation for the given accessor kind.private static ReflectiveAccessTracker.AccessTyperesolveAtomicUpdaterType(String invokedMethodName) private static ReflectiveAccessTracker.AccessTyperesolveVarHandleType(String invokedMethodName)
-
Field Details
-
METHOD_HANDLE_INVOCATIONS
-
accessorField
The field holding the accessor handle. -
accessType
GETTER/SETTER/BOTH, ornullwhen the type comes from the accessor (MethodHandle).
-
-
Constructor Details
-
ReflectiveInvocation
-
-
Method Details
-
accessorField
XField accessorField() -
accessType
ReflectiveAccessTracker.AccessType accessType() -
create
static ReflectiveInvocation create(ReflectiveInvocation.Kind kind, XField accessorField, String invokedMethodName) Builds an invocation for a recognized accessor call, or returnsnullwhen the called method is not a field-accessing invocation for the given accessor kind. -
resolveVarHandleType
-
resolveAtomicUpdaterType
private static ReflectiveAccessTracker.AccessType resolveAtomicUpdaterType(String invokedMethodName)
-