Inspectopedia Help

Nested method call

Reports method calls used as parameters to another method call.

The quick-fix introduces a variable to make the code simpler and easier to debug.

Example:

public int y() { return 1; } public int f(int x) { return 2 * x; } public void foo() { int x = f(y()); }

After the quick-fix is applied:

public int y() { return 1; } public int f(int x) { return 2 * x; } public void foo() { int y = y(); int x = f(y); }

Use the inspection options to toggle the reporting of:

  • method calls in field initializers

  • calls to static methods

  • calls to simple getters

Inspection options

Option

Type

Default

Ignore nested method calls in field initializers

Checkbox

true

Ignore calls to static methods

Checkbox

false

Ignore calls to property getters

Checkbox

false

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023