Manual min/max calculation
Reports cases where the minimum or the maximum of two numbers can be calculated using a Math.max() or Math.min() call, instead of doing it manually.
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.
ManualMinMaxCalculation- 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 Disable for float and double option to disable this inspection for double and float types. This is useful because the quick-fix may slightly change the semantics for float/double types when handling NaN. Nevertheless, in most cases this will actually fix a subtle bug where NaN is not taken into account.
New in 2019.2
Inspection options
Here you can find the description of settings available for the Manual min/max calculation inspection, and the reference of their default values.
- Disable for float and double
Default value:
Not 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: |