Search code examples
javaandroidjavadoc

Difference between java doc and Android doc in method documents


Some times I see problematic differences between Java doc and Android doc in about method documents.For example in about setReadable (boolean readable, boolean ownerOnly) method you can see java doc says that:

Throws: SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method denies write access to the file

But Android docs does not say any thing about throwing exception.Also we know that Docs say:

Any Exception that can be thrown by a method is part of the method's public programming interface. Those who call a method must know about the exceptions that a method can throw so that they can decide what to do about them.

So when we do not see any throw condition in Android documents of a method,

  1. Does it mean method will not throw exception any way?Or it may be forgotten?
  2. Do we need to check documents for any simple method for probability difference between Java and Android?Is it possible?

Solution

  • If you go to the declaration of setReadable(bool,bool) you'll see that the exception is caught and false is returned instead. So in this case the Android documentation supersedes the Javadoc.