GNOME Bugzilla – Bug 584018
Linking to methods in Objective-C protocols is problematic
Last modified: 2018-07-30 10:59:40 UTC
Linking to a method in an Objective-C protocol doesn't work in the cases I've tested. I discovered this when trying to use \copydoc to copy the documentation for a method declared in a protocol so I could add information specific to a given implementation. No link is created for \copydoc or \see commands, and the link generated for \link commands directs to the concrete implementation on the same page, not to the declaration in the protocol. The expected behavior is that using MyClass#methodWithParam() or MyClass#method:withParam: should create a proper link to the protocol, just as it does for a normal Objective-C class. The incorrect behavior can be examined by applying a simple patch to a checkout of the trunk of the project in which I'm experiencing the problem -- details are given below. svn checkout -r 462 http://dysart.cs.byu.edu/chsvn/CHDataStructures Index: source/CHAbstractBinarySearchTree.m =================================================================== --- source/CHAbstractBinarySearchTree.m (revision 462) +++ source/CHAbstractBinarySearchTree.m (working copy) @@ -528,6 +528,15 @@ return [set autorelease]; } +/** + \copydoc CHSortedSet#subsetFromObject:toObject: + + \see CHSortedSet#subsetFromObject:toObject: + + \link CHSortedSet#subsetFromObject:toObject: \endlink + + \attention This implementation tests objects for membership in the subset according to their sorted order. This worst-case input causes more work for self-balancing trees, and subsets of unbalanced trees will always degenerate to linked lists. + */ - (id<CHSortedSet>) subsetFromObject:(id)fromObject toObject:(id)toObject { // If both parameters are nil, return a copy containing all the objects. if (fromObject == nil && toObject == nil)
I should mention... the documentation can be generated by running `doxygen doxygen/Doxyfile` in the CHDataStructures directory. The output will be saved to the docs/ directory, and the docs.html file redirects to the index page.
This also occurs for protocols included in an XML tag file. <compound kind="protocol"> <name>NSLocking</name> <filename>http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSLocking_Protocol/Reference/Reference.html</filename> <member kind="function"> <name>lock</name> <anchor>//apple_ref/occ/intfm/NSLocking/lock</anchor> </member> <member kind="function"> <name>unlock</name> <anchor>//apple_ref/occ/intfm/NSLocking/unlock</anchor> </member> </compound> ... <compound kind="protocol"> <name>NSObject</name> <filename>http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html</filename> <member kind="function"> <name>isEqual:</name> <anchor>//apple_ref/occ/intfm/NSObject/isEqual:</anchor> </member> <member kind="function"> <name>hash</name> <anchor>//apple_ref/occ/intfm/NSObject/hash</anchor> </member> </compound> When I run Doxygen, methods on CLASSES get picked up from the tag file, but methods on PROTOCOLS do not: CHDataStructures/source/CHSortedSet.h:189: Warning: unable to resolve link to `NSObject#isEqual:' for \link command CHDataStructures/source/CHSortedSet.h:189: Warning: unable to resolve link to `NSObject#hash' for \link command CHDataStructures/source/CHLockable.h:57: Warning: unable to resolve link to `NSLocking#unlock' for \link command CHDataStructures/source/CHLockable.h:57: Warning: unable to resolve link to `NSLocking#lock' for \link command Note that this bug is related to #581781, but this bug happens even when there are no duplicate compound names. (For example, my tag file contains an NSObject class and an NSObject protocol, but only an NSLocking protocol, no corresponding class.) These errors occur in the HEAD version of my repository. An anchor tag is still created, but the href attribute is empty, so the link directs back to the same page. I would think that in addition to fixing the protocol method lookup problem, it would be a good idea to change the code so no anchor tag is created if the link cannot be resolved.
Changed version 'latest' to '1.8.2-SVN' so I can remove 'latest' as an option as it is a moving target.
As discussed in https://github.com/doxygen/doxygen/pull/734 , Doxygen has moved its issue tracking to https://github.com/doxygen/doxygen/issues All Doxygen tickets in GNOME Bugzilla have been migrated to Github. You can subscribe and participate in the new ticket in Github. You can find the corresponding Github ticket by searching for its Bugzilla ID (number) in Github. Hence I am closing this GNOME Bugzilla ticket. Please use the corresponding ticket in Github instead. Thanks a lot!