Declaration can have 'final' modifier
Reports fields, methods, or classes that may have the final modifier added to their declarations.
Final classes can't be extended, final methods can't be overridden, and final fields can't be reassigned.
Example:
After the quick-fix is applied:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
CanBeFinal- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
Use the Report classes and Report methods options to define which declarations are to be reported.
Inspection ID: CanBeFinal
Inspection options
Here you can find the description of settings available for the Declaration can have 'final' modifier inspection, and the reference of their default values.
- Report classes
Option ID:
REPORT_CLASSESDefault value:
Not selected- Report methods
Option ID:
REPORT_METHODSDefault value:
Not selected- Report fields
Option ID:
REPORT_FIELDSDefault value:
Selected
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |