jde-usages is a plugin for the Java Development Environment for Emacs (JDEE) that uses the ASM bytecode library to provide usage (eg: find all the callers of a method) and other useful information about your Java classes.
This plugin is based on the ideas in jde-xref.el that is distributed with JDEE but it is better because it is:
To use jde-usages you need to have customized
DownloadAn installable plugin binary of version 0.9.1 released on May 17, 2005 is available here along with release notes and the detailed ChangeLog. This file also includes all the source files used to build the plugin.
The source is also available via anonymous CVS here.
Using the binary: (jde-usages.zip)
you could accomplish the same thing from within emacs:
From CVS: The source is structured to look like an expanded plugin and so can be installed directly into the plugins directory.
Useful KeybindingsI find the following Keybindings useful in addition to the menu bar commands.
Note: The bindings use "M-u" as a prefix command, overriding its default binding of 'upcase-word, which I almost never use. YMMV.
(define-key jde-mode-map "\M-u" nil) (define-key jde-mode-map "\M-up" 'jde-usages-display-call-tree-for-thing-at-point) ;; p = point (define-key jde-mode-map "\M-ui" 'jde-usages-display-call-tree-for-specified-class) ;; i = interactive (define-key jde-mode-map "\M-uc" 'jde-usages-display-call-tree) ;; c = callers (define-key jde-mode-map "\M-ut" 'jde-usages-display-type-hierarchy) ;; t = types (define-key jde-mode-map "\M-ur" 'jde-usages-display-subs-implementing-method) ;; r = reimplements (define-key jde-mode-map "\M-ud" 'jde-usages-display-subs-and-implementers) ;; d = descendants (define-key jde-mode-map "\M-ua" 'jde-usages-display-superclasses) ;; a = ancestors (define-key jde-mode-map "\M-un" 'jde-usages-next-pos) (define-key jde-mode-map "\M-ul" 'jde-usages-locate-class) (global-set-key [(meta n)] (lambda () (interactive) (jde-load-project-file) (jde-open-class-source-with-completion)))
During the setup phase jde-usages looks at the constant table for every class to determine which other classes it refers to and uses this info. to create a dependency table which maps a class to all classes that might call that class. It's critical that this stage be as fast as possible. It is much faster than jde-xref ,which in its setup phase parses the byte-code of all methods to create the final usage table and then writes this data structure to disk, but it won't hurt to make it faster.
Directory classpath entries take longer to process than jars because reading many small files turns out to be much slower than reading one large one. To mitigate this problem there is some experimental support to cache the processing results for directory classpath entries between runs. To enable this caching create a directory called ".jde-usages" in your home directory. To find out what java thinks is your home directory type
in the *bsh* buffer. If the ~/.jde-usages directory exists cache files will we written there just before the JVM quits. To ensure that the java process is allowed to shut down completely when quitting emacs add the following code to your .emacs file.print (System.getProperty("user.home"));
(defun jde-bsh-exit-nicely () "Tells the beanshell process to terminate and waits until the process finishes up." (interactive) (if (jde-bsh-running-p) (let ((process (bsh-get-process (oref 'jde-bsh the-bsh)))) (message "Shutting down beanshell process") (if (and (boundp 'jde-ant-invocation-method) ;; ant package may not be loaded. (string= (car jde-ant-invocation-method) "Ant Server")) (bsh-eval (oref 'jde-bsh the-bsh) "jde.util.JdeUtilities.exit();\n") (bsh-eval (oref 'jde-bsh the-bsh) "exit();\n")) (message "")))) (add-hook 'kill-emacs-hook 'jde-bsh-exit-nicely)
A special buffer called
HelpTo report bugs, request features, or heap accolades, send me (Suraj Acharya) an email. I also monitor the JDEE mailing list pretty closely.