How do I force a polymorphic call to the super method?

前端 未结 7 1059
猫巷女王i
猫巷女王i 2020-12-16 15:54

I have an init method that is used and overridden through out an extensive heirarchy. Each init call however extends on the work that the previous did. So naturally, I would

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 15:59

    I frequently like to use this solution. It wont throw a runtime error, but it will show a syntax error:

     @CallSuper
     public void init() {
         // do stuff
     }
    

    This is a part of Android support annotations.

提交回复
热议问题