Inspectopedia
 
2024.3

Access to inherited field looks like access to element from surrounding code

Warning
New
Last modified: 03 December 2024

Reports access to a superclass field from an anonymous, inner or local class, if a local variable, parameter, or field with the same name is available in the code surrounding the class. In this case it may seem that an element from the surrounding code is accessed, when in fact it is an access to a field from the superclass.

To clarify the intent of the code, it is recommended to add an explicit super qualifier to the field access.

Example:

After the quick-fix is applied: