java - Enforce super call on non constructor methods -


is possible enforce overriden method call superclass method? constructors need call superclass constructor. want enforce on normal methods, without position of when called mattering.

example:

public class {      public void dosth() {         system.out.println("i must appear on console!");     }  }  public class b extends {      @override     public void dosth() {         system.out.println("bla!");  // ide should mark error, because supermethod not called.     }  } 

although not strictly java related, looking answer issue relates android , found annotation in support annotations library called "@callsuper". think, , throws lint error if subclass not call super's implementation of methods annotated @callsuper.

that solved usecase, again, know solution strictly tied android. please let me know if far off base , remove answer.

here more documentation on @callsuper. https://developer.android.com/reference/android/support/annotation/callsuper.html https://developer.android.com/studio/write/annotations.html (just search callsuper , it'll show right in second link.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -