After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 581781 - Confusion with entities with the same name in XML tags file
Confusion with entities with the same name in XML tags file
Status: RESOLVED OBSOLETE
Product: doxygen
Classification: Other
Component: documentation
1.5.9
Other All
: Normal normal
: ---
Assigned To: Dimitri van Heesch
Dimitri van Heesch
[moved_to_github]
Depends on:
Blocks:
 
 
Reported: 2009-05-07 19:36 UTC by Quinn Taylor
Modified: 2018-07-30 10:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Quinn Taylor 2009-05-07 19:36:55 UTC
I discovered that when linking to methods in external documentation (the URLs and anchors for which are documented in an XML tags file) confusion can arise in linking to the correct entity when they have the same name, even though they are of different kinds and contain different functions/methods.

For example, in Objective-C / Cocoa, the NSObject class adopts the NSObject protocol, and there is no conflict because there is a separate namespace for classes and protocols. However, attempting to link to a method in the NSObject protocol (an action which fails if the NSObject class is included in the tag file, but the NSObject protocol is not) doesn't produce an error, but incorrectly links to the NSObject class with the anchor for the protocol HTML page.

Note: The bug is further susceptible to ordering in the XML file. When the NSObject class is declared first, the protocol links mistakenly direct to the class page; if I reverse the order, the protocol links work correctly, but the links to the NSObject class direct to the protocol instead.

There is somewhat of a workaround, although it's annoying and incorrect: it requires renaming one of the entities in the XML and the links. For example, for some reason Doxygen names protocols with a trailing "-p". Doing the same in the XML and anywhere the protocol is linked works only partially; auto-links are deformed (the protocol name appears in plain text before the link, with no white-space in between. Using "_p" seems to work better. However, using "NSObject_p" instead of "NSObject" is esoteric and counter-intuitive, plus the inline comments become more confusing and somewhat less maintainable. (IMO, documenting code should be as natural as possible, requiring the fewest number of hoops to jump through as possible.)

It would be great if, when the link is created, the tool checks not only for a match of the containing entity, but also whether that particular entity contains the function/method/etc. specified in the documentation.
Comment 1 Quinn Taylor 2009-05-07 21:26:48 UTC
I figured it would help if I can provide a real-life example of this bug in action. :-)

My XML tag file looks like this: (The NSObject class and protocol are almost at the very bottom.)

    http://dysart.cs.byu.edu/websvn/filedetails.php?path=/CHDataStructures/doxygen/doxygen-cocoa-tags.xml

The NSObject entries are referenced by the -copyWithZone: and -member: methods of CHSortedSet (and in many other places).

    http://dysart.cs.byu.edu/websvn/filedetails.php?path=/CHDataStructures/source/CHSortedSet.h

The resulting documentation looks like this: (Examine the links for -copy, -hash, and -isEqual:)

    http://dysart.cs.byu.edu/CHDataStructures/protocol_c_h_sorted_set-p.html#431d7c090f16a88e4569675b103fd1be

    http://dysart.cs.byu.edu/CHDataStructures/protocol_c_h_sorted_set-p.html#17cedea65e457e607033d2e43009d2fe
Comment 2 Quinn Taylor 2009-10-20 20:47:29 UTC
This is also somewhat related to bug #584018, although that bug happens regardless of whether there are entries for a class and protocol of the same name in the tag file.
Comment 3 Quinn Taylor 2011-01-09 09:10:24 UTC
Updated links:

http://dysart.cs.byu.edu/websvn/wsvn/CHDataStructures/trunk/doxygen/doxygen-cocoa-tags.xml?rev=665
http://dysart.cs.byu.edu/websvn/wsvn/CHDataStructures/trunk/source/CHSortedSet.h?rev=692

I have since ended up adding a workaround for now, by changing the protocol references to "NSObject-protocol". As mentioned above, this is not ideal, but I'd rather have working docs than not.

Checking out revision 700 of trunk and running `doxygen doxygen/Doxyfile` will still exhibit the problem, even though the online documentation will not.
Comment 4 André Klapper 2018-07-30 10:09:20 UTC
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!