RequiresSuperCall

The RequiresSuperCall annotation is useful to indicate that an inherited or an overridden method to works correctly and completely requires that also the original method is invoked like the @CallSuper annotation.

This annotation is useful for enforcing that subclasses do not neglect to invoke their super class method, thereby maintaining the expected functionality and state

Usage Example:

open class Vehicle {

    @RequiresSuperCall
    open fun startEngine() {
        // general logic to start the engine
    }

}

class Car : Vehicle() {

    @RequiresSuperCall
    override fun startEngine() {
        super.startEngine() // required for a complete and correct logic
        // Car specific logic to start engine
    }

}

Author

N7ghtm4r3 - Tecknobit

Since

1.0.5