Class ReflectiveFieldAccessor


  • class ReflectiveFieldAccessor
    extends java.lang.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 Detail

      • actualField

        private final XField actualField
        The field the accessor reads or writes.
      • 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.