Hi Guys,
I'm beginning to tie myself in knots and wondered if anyone could help.
I'm using {@inheritDoc} to propagate documentation from an interface definition to an implementing class.
An implementation method needs to throw several IllegalStateExceptions, (as well as some checked exceptions) all of which I subsequently shifted up to the corresponding interface method definition.
However, I now notice that I have to list each and every exception in the throws clause of the method, (in the class) instead of just the exceptions' super class, in order to get the corresponding exception comments to be visible - for the concrete method. Reading a bit more, this seems to be just how javadoc works, oh well.
Plus, I can only get the first IllegalStateException to propagate from the interface and that's by listing it too, (as "IllegalStateException") in the throws clause of the concrete method.
I can of course get around this by moving the IllegalStateExceptions (they aren't sub-classed) back to the implementing class, but that rather seems to defeat the object of using {@inheritDoc}.
This is a slightly alarming since I have already converted my DB interface instructions into javadoc and then inherited it (the javadoc) in the Data classes' method implementations.
I added some additional IllegalStateExceptions to some of Data's methods (and hence in the Data javadoc) and also, I don't implement a couple of the DB interface checked exceptions. So, these are simply not listed in the relevant Data method throws clauses.
In summary, I'm wondering if I really understand the philosophy behind interfaces and checked/unchecked exceptions. Is javadoc trying to tell me something ?
Thanks in advance Jim
I'm beginning to tie myself in knots and wondered if anyone could help.
I'm using {@inheritDoc} to propagate documentation from an interface definition to an implementing class.
An implementation method needs to throw several IllegalStateExceptions, (as well as some checked exceptions) all of which I subsequently shifted up to the corresponding interface method definition.
However, I now notice that I have to list each and every exception in the throws clause of the method, (in the class) instead of just the exceptions' super class, in order to get the corresponding exception comments to be visible - for the concrete method. Reading a bit more, this seems to be just how javadoc works, oh well.
Plus, I can only get the first IllegalStateException to propagate from the interface and that's by listing it too, (as "IllegalStateException") in the throws clause of the concrete method.
I can of course get around this by moving the IllegalStateExceptions (they aren't sub-classed) back to the implementing class, but that rather seems to defeat the object of using {@inheritDoc}.
This is a slightly alarming since I have already converted my DB interface instructions into javadoc and then inherited it (the javadoc) in the Data classes' method implementations.
I added some additional IllegalStateExceptions to some of Data's methods (and hence in the Data javadoc) and also, I don't implement a couple of the DB interface checked exceptions. So, these are simply not listed in the relevant Data method throws clauses.
In summary, I'm wondering if I really understand the philosophy behind interfaces and checked/unchecked exceptions. Is javadoc trying to tell me something ?
Thanks in advance Jim