Direct State Variable Access
Warns if a method directly references a state variable (instance, class or class instance variables).
Accessor methods are not flagged because they are expected to directly reference state variables. Delayed initialization accessors are not pure accessors (that is, they perform computation) and therefore are flagged. Instance methods acting as class variable accessors are also flagged because class-variable access is typically done using class methods.
Accessors can help preserve the encapsulation principle of objectoriented programming. Direct accesses can also increase maintenance or limit the ability of a subclass to extend or refine the class’s behavior.
Last modified date: 05/19/2020