开发者

Can I view the javadoc for an implementation rather than the interface in IntelliJ IDEA?

开发者 https://www.devze.com 2022-12-31 04:45 出处:网络
I am using a third party library in my Intellij IDEA project. When I have the caret on a method name I can hit Ctrl-Q to get javadoc in the \'Quick Documentation Lookup\' window, however only the meth

I am using a third party library in my Intellij IDEA project. When I have the caret on a method name I can hit Ctrl-Q to get javadoc in the 'Quick Documentation Lookup' window, however only the method signature is displayed. This is because the type of object containing the method is an Interface with no javadoc comments. The actual implementation of the object does have javadoc comments. If I cast the object to the implementation type the j开发者_运维技巧avadoc comments will appear. Can I do something in IntelliJ get this to work without making any code changes?


Sorry, this won't be much help. But I am wondering:

why would anybody document the implementing classes but not the interface? The interface documents the contract, that should usually be enough, and an implementing class can of course brag how well it implements the contract or state why it breaks it, but in 90% of the cases an {@inheritDoc} tag is enough for an implementation method, while the interface should define the method semantics.

One of the reasons to do it that way is the one you are just encountering: people who develop code against interfaces (and I hope we all are) need these interfaces to be documented. If I need to look up the functionality of the implementing classes, why bother with interfaces at all?

Of course there are exceptions where implementing methods should be documented (see above), and of course the implementing classes and constructors should always be documented, but an API with undocumented interfaces is in my opinion a bad API.

0

精彩评论

暂无评论...
验证码 换一张
取 消