Package edu.umd.cs.findbugs.detect
Class ReflectiveInvocation
- java.lang.Object
-
- edu.umd.cs.findbugs.detect.ReflectiveInvocation
-
class ReflectiveInvocation extends java.lang.ObjectA single invocation of a reflective field accessor (MethodHandle, VarHandle or AtomicFieldUpdater). TheReflectiveInvocation.Kindpassed tocreate(edu.umd.cs.findbugs.detect.ReflectiveInvocation.Kind, edu.umd.cs.findbugs.ba.XField, java.lang.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
accessTypeisnullhere 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 Modifier and Type Class Description (package private) static classReflectiveInvocation.Kind
-
Field Summary
Fields Modifier and Type Field Description private XFieldaccessorFieldThe field holding the accessor handle.private ReflectiveAccessTracker.AccessTypeaccessTypeGETTER/SETTER/BOTH, ornullwhen the type comes from the accessor (MethodHandle).private static java.util.Set<java.lang.String>METHOD_HANDLE_INVOCATIONS
-
Constructor Summary
Constructors Modifier Constructor Description privateReflectiveInvocation(XField accessorField, ReflectiveAccessTracker.AccessType accessType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) XFieldaccessorField()(package private) ReflectiveAccessTracker.AccessTypeaccessType()(package private) static ReflectiveInvocationcreate(ReflectiveInvocation.Kind kind, XField accessorField, java.lang.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(java.lang.String invokedMethodName)private static ReflectiveAccessTracker.AccessTyperesolveVarHandleType(java.lang.String invokedMethodName)
-
-
-
Field Detail
-
METHOD_HANDLE_INVOCATIONS
private static final java.util.Set<java.lang.String> METHOD_HANDLE_INVOCATIONS
-
accessorField
private final XField accessorField
The field holding the accessor handle.
-
accessType
private final ReflectiveAccessTracker.AccessType accessType
GETTER/SETTER/BOTH, ornullwhen the type comes from the accessor (MethodHandle).
-
-
Constructor Detail
-
ReflectiveInvocation
private ReflectiveInvocation(XField accessorField, ReflectiveAccessTracker.AccessType accessType)
-
-
Method Detail
-
accessorField
XField accessorField()
-
accessType
ReflectiveAccessTracker.AccessType accessType()
-
create
static ReflectiveInvocation create(ReflectiveInvocation.Kind kind, XField accessorField, java.lang.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
private static ReflectiveAccessTracker.AccessType resolveVarHandleType(java.lang.String invokedMethodName)
-
resolveAtomicUpdaterType
private static ReflectiveAccessTracker.AccessType resolveAtomicUpdaterType(java.lang.String invokedMethodName)
-
-