> Larry Riedel recently asked me about whether jtags handles
> classes. I answered too hastily in the negative. Actually,
> jtags does tag classes (and interfaces) and seems to work
> just fine. I'm not sure why Larry was having a problem.
> 
> On the other hand, I believe that etags does not tag classes
> and interfaces. If anybody can confirm this, I'd be greatful.

With regard to finding the definition of a class, etags
and jtags seem to me pretty much equivalent as far as
what gets put into the TAGS file.  As I said, I do not
think there is an issue with jtags so much as with using
the flat TAGS namespace to find class (etc) definitions
in the hierarchical Java package namespace.

I have included below a little example of a general
problem.  There is a class "Buffer" in each of the packages
"sub1" and "sub2".  When the TAGS file is built, they
are both tagged as "Buffer", with no particularly useful
qualification as to the package of which they are part.
If I am in the "use2.java" file and I try to do "M-." on
the word "Buffer", it will take me to the definition of
the class "Buffer" in package "sub1" (presumably because
it comes first in the TAGS file), even though the file is
using the "Buffer" class in the package "sub2".

I thought the idea of making a function similar to
"jde-help-class", which "for an unqualified class name,
[tests] for existence of the class in each package imported
into the current source file", such that "if the class
exists in more than one package, it lets you choose which
one you really want."

I thought it made sense that "the same functionality could
be extended to jumping to the source file that defines
the class."


There is an additional problem in that the "etags.el"
which comes with XEmacs 21 (I think I have 21.1.8), does
not seem to prefer an exact match of the string used with
"M-.", but using the FSF Emacs 19.34 etags.el seems to work
okay in this regard, although that still does not solve the
problem with the flat TAGS namespace.


Larry



------------------------------------------------------------------------
sub1/Buffer.java
--


package sub1;

public class Buffer {
    public static String hello() {
        return "sub1.Buffer.hello";
    }

}

------------------------------------------------------------------------
sub2/Buffer.java
--

package sub2;

public class Buffer {
    public static String hello() {
        return "sub2.Buffer.hello";
    }

}

------------------------------------------------------------------------
use/use2.java
--

package use;

import sub2.Buffer;

public class use2 {
    public static void main(String[] args) {
        System.out.println(Buffer.hello());
    }
}

------------------------------------------------------------------------

Reply via email to