Inspectopedia Help

Call to inherited method looks like call to local method

Reports calls to a superclass method from an anonymous, inner or local class, if a method with the same signature exists in the code surrounding the class. In this case it may seem that a method from the surrounding code is called, when in fact it is a call to a method from the superclass.

To clarify the intent of the code, it is recommended to add an explicit super qualifier to the method call.

Example:

class Parent { void ambiguous(){} } class Example { void ambiguous(){} class Inner extends Parent { void example(){ ambiguous(); //warning } } }

After the quick-fix is applied:

class Parent { void ambiguous(){} } class Example { void ambiguous(){} class Inner extends Parent { void example(){ super.ambiguous(); } } }

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.

AmbiguousMethodCall
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 | Visibility

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.2, Qodana for JVM 2024.2,

Can be installed with plugin:

Java, 242.22892

Last modified: 11 September 2024