Inspectopedia 2025.3 Help

Method overrides inaccessible method of superclass

Reports methods with the same signature as an inaccessible method of a superclass, for example, a private method, or a package-private method of a superclass in another package.

Such method names may be confusing because the method in the subclass may look like an override when in fact it hides the inaccessible method of the superclass. Moreover, if the visibility of the method in the superclass changes later, it may either silently change the semantics of the subclass or cause a compilation error.

A quick-fix is suggested to rename the method.

Example:

public class Super { private void test() { } } public class Sub extends Super { void test() { // making 'Super.test()' public causes a compilation error // making 'Super.test()' package-private makes 'Sub.test()' an override } }

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.

MethodOverridesInaccessibleMethodOfSuper
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 ID: MethodOverridesInaccessibleMethodOfSuper

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 MethodOverridesInaccessibleMethodOfSuper

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.3, Qodana for JVM 2025.3,

Last modified: 03 December 2025