Possibly unintended overload of method from superclass
Reports instance methods with the same name and the same number of parameters as a method in a superclass, but where at least one of the parameters is of a different incompatible type.
In this case, the method in a subclass will be overloading the method from the superclass instead of overriding it. If it is unintended, it may result in latent bugs.
Example:
public class Foo {
void foo(int x) {}
}
public class Bar extends Foo {
void foo(Number x) {} // Method 'foo()' overloads a compatible method of a superclass,
// when overriding might have been intended
}
Use the option to choose whether the inspection should also report cases where parameter types are not compatible.
Inspection options
Option | Type | Default |
---|---|---|
Report even if parameter types are not compatible | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023