I want that when a child class overrides a method in a parent class, the super.method()
is called in that child method.
Is there any way to check this a
For the Android Developers out there, you can simply use the @CallSuper annotation.
Sample:
public class BaseClass {
@CallSuper
public void myMethod() {
//do base required thing
}
}
On the overriding class:
public class OverridingClass extends BaseClass{
@Override
public void myMethod(){
super.myMethod(); //won't compile if super is not called
//do overring thing here
}
}