Inspectopedia 2025.2 Help

Method parameter always has the same value

Reports method parameters that always have the same constant value.

Example:

static void printPoint(int x, int y) { // x is always 0 System.out.println(x + ", " + y); } public static void main(String[] args) { printPoint(0, 1); printPoint(0, 2); }

The quick-fix inlines the constant value. This may simplify the method implementation.

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.

SameParameterValue
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.

Settings or Preferences | Editor | Inspections | Java | Declaration redundancy

Use the Ignore when a quick-fix can not be provided option to suppress the inspections when:

  • the parameter is modified inside the method

  • the parameter value that is being passed is a reference to an inaccessible field (Java ony)

  • the parameter is a vararg (Java only)

Use the Maximal method visibility option to control the maximum visibility of methods to be reported.

Use the Minimal method usage count to report parameter field to specify the minimal number of method usages with the same parameter value.

Inspection options

Here you can find the description of settings available for the Method parameter always has the same value inspection, and the reference of their default values.

Ignore when a quick-fix cannot be provided

Default value:

Selected
Maximal method visibility

Default value:

protected

Other available settings:

  • public

  • package-private

  • private

Minimal method usage count to report parameter

Default value:

1

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:

//noinspection SameParameterValue

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:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025