Inspectopedia
 
2024.3

Static field referenced via subclass

Warning
New
Last modified: 03 December 2024

Reports accesses to static fields where the call is qualified by a subclass of the declaring class, rather than by the declaring class itself.

Java allows such qualification, but such accesses may indicate a subtle confusion of inheritance and overriding.

Example:

After the quick-fix is applied, the result looks like this: