Inspectopedia
 
2024.3

'protected' member in 'final' class

Warning
New
Last modified: 03 December 2024

Reports protected members in finalclasses.

Since final classes cannot be inherited, marking the method as protected may be confusing. It is better to declare such members as private or package-visible instead.

Example:

After the quick-fix is applied:

As shown in the example, a class can be marked as final explicitly or implicitly.