java - Should methods that throw RuntimeException indicate it in method signature? -


For example, you can throw several ways in frameworks / jdk

  java.lang .SecurityException  

But this method is not shown in signature (since it is normally reserved for checking exceptions). I want to argue that there are many benefits to declaring the runtime exception in method SIG (for example, to check the static type) Is I intoxicated or otherwise?

I will not declare an uncontrollable exception in the signature because it is misleading for that user of that API It is no longer clear that the exception is to be handled with clearly.

Declaring it in Javadok is a better way because it allows someone to handle it if they think it is necessary, but to know that they can ignore it if they want to Are there. It creates the separation between the checked and unchecked clear.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -