Class ReflectiveFieldAccessor

java.lang.Object
edu.umd.cs.findbugs.detect.ReflectiveFieldAccessor

class ReflectiveFieldAccessor extends Object
A reflective field accessor (VarHandle, MethodHandle or AtomicFieldUpdater).

A plain mutable value class. It is created when the accessor handle is obtained (findGetter, findVarHandle, newUpdater, ...) and completed once the handle is stored into a field, at which point accessorField is filled in. For a MethodHandle the accessType is fixed at creation (GETTER or SETTER); for VarHandle/AtomicFieldUpdater it is ReflectiveAccessTracker.AccessType.BOTH because the actual access type is only known at invocation time.

expectedAssignmentPC is scanning-phase state: it tells the detector at which PC the handle is expected to be stored into its field, and is meaningless once the accessor has been registered.

  • Field Details

    • actualField

      private final XField actualField
      The field the accessor reads or writes.
    • accessType

      private final ReflectiveAccessTracker.AccessType accessType
      GETTER/SETTER for MethodHandle, BOTH for VarHandle/AtomicFieldUpdater.
    • declarationSourceLine

      private final SourceLineAnnotation declarationSourceLine
      Source line where the accessor was declared.
    • expectedAssignmentPC

      private final int expectedAssignmentPC
      PC at which the handle is expected to be stored into its field.
    • accessorField

      private XField accessorField
      The field holding the handle; set once the handle is stored.
    • wasUsed

      private boolean wasUsed
      Set during resolution if the accessor is actually invoked.
  • Constructor Details

  • Method Details