Inspectopedia Help

Suspicious variable/parameter name combination

Reports assignments and function calls in which the name of the target variable or the function parameter does not match the name of the value assigned to it.

Example 1:

int x = 0; int y = x; // x is used as a y-coordinate

Example 2:

int x = 0, y = 0; // x is used as a y-coordinate and y as an x-coordinate Rectangle rc = new Rectangle(y, x, 20, 20);

Configure the inspection:

Use the Group of names area to specify the names which should not be used together: an error is reported if the parameter name or assignment target name contains words from one group and the name of the assigned or passed variable contains words from a different group.

Use the Ignore methods area to specify the methods that should not be checked but have a potentially suspicious name. For example, the parameters are named x and y but are unrelated to coordinates.

Inspection options

Here you can find the description of settings available for the Suspicious variable/parameter name combination inspection, and the reference of their default values.

Groups of names (comma-separated)

[x,width,left,right, y,height,top,bottom]

Ignore methods


Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.14841

Last modified: 12 March 2024