Method can be made 'static'
Reports methods that can safely be made static
. Making methods static when possible can reduce memory consumption and improve your code quality.
A method can be static
if:
it is not
synchronized
,native
orabstract
,does not reference any of non-static methods and non-static fields from the containing class,
is not an override and is not overridden in a subclass.
- 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.
MethodMayBeStatic
Use the following options to configure the inspection:
Whether to report only
private
andfinal
methods, which increases the performance of this inspection.Whether to ignore empty methods.
Whether to ignore default methods in interface when using Java 8 or higher.
Whether to let the quick-fix replace instance qualifiers with class references in calls to methods which are made
static
, that is, callmyClass.m()
would be replaced withMyClass.m()
.
Here you can find the description of settings available for the Method can be made 'static' inspection, and the reference of their default values.
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!