RE: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
Sandip, Just tried it out and ran into unexpected behaviour. Essentially the situation is as follows. I have in my current buffer a class, say B, which extends a class A. In A I have a protected object logger which is an instance of a Logger class. In class B I have the code fragment logger.debug(...); When I then press C-c C-v / with point inside the word logger, I do not get information on the Logger class as I expected from your explanation, but on the class B and its superclass A. Sources are in the attached zipfile. Cheers, Karel -Original Message- From: Sandip Chitale [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 07:32 To: [EMAIL PROTECTED] Subject: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System /** * Constructors of class System **/ private System() /** * Methods of class System **/ public static native void arraycopy(Object, int, Object, int, int) public static native int identityHashCode(Object) public static void exit(int) public static void runFinalizersOnExit(boolean) private staticvoid initializeSystemClass() public static String setProperty(String, String) private static native void registerNatives() public static SecurityManager getSecurityManager() staticClass getCallerClass() public static void loadLibrary(String) public static String getProperty(String) public static String getProperty(String, String) public static native String mapLibraryName(String) public static void load(String) public static void setIn(InputStream) public static void setOut(PrintStream) public static void setErr(PrintStream) private staticvoid checkIO() private static native void setIn0(InputStream) private static native void setOut0(PrintStream) private static native void setErr0(PrintStream) public static void setSecurityManager(SecurityManager) private static synchronized void setSecurityManager0(SecurityManager) public static native long currentTimeMillis() private static native Properties initProperties(Properties) public static Properties getProperties() public static void setProperties(Properties) public static String getenv(String) public static void gc() public static void runFinalization() private staticInputStream nullInputStream() throws NullPointerException private staticPrintStream nullPrintStream() throws NullPointerException /** * Fields of class System **/ public final static InputStream in public final static PrintStream out public final static PrintStream err private staticSecurityManager security private staticProperties props problem.zip Description: problem.zip
RE: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
Hello, attached is a small library ecb-jde.el which enables you to display the contents of class at point in the method-window of ECB: (defun ecb-jde-display-class-at-point () Displays in the ECB-methods-buffer the contents \(methods, attributes etc...) of the class which contains the definition of the \thing\ under point \(this can be a variablename, classname, methodname, attributename). This function needs the same requirements to work as the method-completion feature of JDE \(see `jde-complete-at-point')!. The source-file is searched first in `jde-sourcepath', then in `jde-global-classpath', then in $CLASSPATH, then in current-directory. (interactive) ... ) Just do: 1. Save ecb-jde.el somewhere in your load-path - probably best in the ecb-directory ;-) 2. Activate ECB 3. Open a java-source 4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET 5. Try it. Differences to Sandips code: - uses ECB method-window to display the class-contents - uses semantic for getting the contents of a class - needs the source-file of the class to work The first point can be seen as advantage or disadvantage ;-) Especially the latter point is a disadvantage because it prevents from working for classes which are only available as *.class-file or within a jar-file... But it demonstrates another elegant way of displaying things of a class under point without needing java-introspection. Klaus -Original Message- From: Sandip Chitale [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System ecb-jde.el Description: Binary data
Re: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
In principal you do the following: 1. Getting the class of current point 2. Introspection with java-code of this class Here is your code , | (defun jde-introspect-javatype-at-point () | (interactive) | (if (jde-open-functions-exist) | (let* ((thing-of-interest (thing-at-point 'symbol)) | (pair (save-excursion (end-of-thing 'symbol) |(jde-parse-java-variable-at-point))) | (class-to-open (jde-open-get-class-to-open ;; step 1. | pair thing-of-interest)) |) | (if (and class-to-open (stringp class-to-open)) | (jde-introspect-javatype class-to-open) ;; step 2. | (error Can not parse the thing at point!))) | (message You need JDE = 2.2.6 and Senator for using this feature!))) ` IMHO step 1. is enough and step 2 can be done much smarter with semantic because this tool already offers all what we need for getting the contents of a class! I would do the following: 1. Getting the class C of current point like in your code. 2. Opening the file F which contains class C with find-file-noselect in a hidden buffer (save-excursion (set-buffer (find-file-noselect file of class c)) ) 3. In this buffer just call `senator-parse' or `semantic-bovinate-toplevel' which return all tokens in this file. The library semantic-util.el offers a lot to display and bucketize these tokens in several manners (e.g. like in UML-notation). (save-excursion (set-buffer (find-file-noselect file of class c)) (let ((tokens (senator-parse))) ;; do something with the tokens, e.g. display it in a special buffer ) ) 4. If you use ECB you can use its methods buffer to display the contents of class under point with the following short code: (save-excursion (set-buffer (find-file-noselect file of class c)) (ecb-update-methods-buffer--internal 'scroll-to-begin) ) You do not need more code to display the methods and variables of class C under point in the methods-buffer of ECB! IMHO this is much easier than using this somehow clumsy beanshell to communicate between java and elisp. IMHO java/Beanshell is good to find out in which file a class/method is defined, but the rest of the job can be done very easy with semantic (and ECB if you like). But do not misunderstand me: Your code is good and a really stringent mechanism for code-completion/introspection/browsing etc. is really needed in JDEE. IMHO currently there are too many different mechanisms in JDEE to do this things. Ciao, Klaus On Tue, 18 Feb 2003, Sandip Chitale wrote: To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System /** * Constructors of class System **/ private System() /** * Methods of class System **/ public static native void arraycopy(Object, int, Object, int, int) public static native int identityHashCode(Object) public static void exit(int) public static void runFinalizersOnExit(boolean) private staticvoid initializeSystemClass() public static String setProperty(String, String) private static native void registerNatives() public static SecurityManager getSecurityManager() staticClass getCallerClass() public static void loadLibrary(String) public static String getProperty(String) public static String getProperty(String, String) public static native String mapLibraryName(String) public static void load(String) public static void setIn(InputStream) public static void setOut(PrintStream) public static void setErr(PrintStream) private staticvoid checkIO() private static native void setIn0(InputStream) private static native void setOut0(PrintStream) private static native void setErr0(PrintStream) public static void setSecurityManager(SecurityManager) private static synchronized
Re: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
On Wed, 19 Feb 2003, Karel Sprenger wrote: Hello, Ironically enough, the method ecb-jde-display-class-at-point shows the same behaviour as Sandip's code when I invoke it with point in the variable logger in class B. Of course, this must be because Sandips and my code use the same JDE code to get the class for the thing under point. Or with other words: Both uses the JDE mechanism used for method/field-completion. The following code is responsible for getting the class: , | (let* ( | (thing-of-interest (thing-at-point 'symbol)) | (pair (save-excursion (end-of-thing 'symbol) |(jde-parse-java-variable-at-point))) | (class-to-open (jde-open-get-class-to-open | pair thing-of-interest)) | (source-path-prefix-list (jde-open-get-path-prefix-list)) | (java-file-name nil) | ) | (if (and class-to-open (stringp class-to-open)) | (progn | (setq java-file-name (jde-open-find-java-file-name | class-to-open source-path-prefix-list)) | (if (not java-file-name) | ;; here comes the code which displays contents of | ;; java-file-name ` Exactly the same mechanism is used by jde-open-class-at-point and also also jde-complete. See jde-open-source.el! Sandips and my code are equal in getting the correct class and different in getting and displaying the contents of this class. Ciao, Klaus public class A { protected Logger logger = new Logger(); public A() { } public String toString() { logger.debug(A.toString() invoked.); return A; } } public class B extends A { public B() { } public String toString() { logger.debug(B.toString() invoked.); // ^-- invoke ecb-jde-display-class-at-point here return B; } } If I invoke ecb-jde-display-class-at-point with point inside logger in the toString method of class A, all is well and I get: Logger [-] Varia... [+] Logger() Logger(String) void debug(String) void debug(String,Throwable) void error(String) void error(String,Throwable) void info(String) void info(String,Throwable) void warn(String) void warn(String,Throwable) Invoking ecb-jde-display-class-at-point with point inside logger in B's toString method will show B [-] Parents [+] + B() + String toString() Is this a semantic problem? Cheers, Karel -Original Message- From: Berndl, Klaus [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 11:07 To: 'Sandip Chitale'; [EMAIL PROTECTED] Subject: RE: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... Hello, attached is a small library ecb-jde.el which enables you to display the contents of class at point in the method-window of ECB: (defun ecb-jde-display-class-at-point () Displays in the ECB-methods-buffer the contents \(methods, attributes etc...) of the class which contains the definition of the \thing\ under point \(this can be a variablename, classname, methodname, attributename). This function needs the same requirements to work as the method-completion feature of JDE \(see `jde-complete-at-point')!. The source-file is searched first in `jde-sourcepath', then in `jde-global-classpath', then in $CLASSPATH, then in current-directory. (interactive) ... ) Just do: 1. Save ecb-jde.el somewhere in your load-path - probably best in the ecb-directory ;-) 2. Activate ECB 3. Open a java-source 4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET 5. Try it. Differences to Sandips code: - uses ECB method-window to display the class-contents - uses semantic for getting the contents of a class - needs the source-file of the class to work The first point can be seen as advantage or disadvantage ;-) Especially the latter point is a disadvantage because it prevents from working for classes which are only available as *.class-file or within a jar-file... But it demonstrates another elegant way of displaying things of a class under point without needing java-introspection. Klaus -Original Message- From: Sandip Chitale [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below
Re: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
Klaus Berndl writes: IMHO this is much easier than using this somehow clumsy beanshell to communicate between java and elisp. Easier for whom? The easiest way to implement a feature does not necessarily result in the implementation that is easiest to use. For example, your proposal for implementing completion works only for classes for which source code is available and requires opening and parsing the source file of each class to be completed during a session. Ever tried opening and parsing a large Java source file? Think of how long it would take to complete a method of JFrame class. People already complain about how long the existing JDEE feature takes. Your proposal would decrease the response time exponentially. semantic includes a database feature whereby it can save parsed versions of source files so that they don't need to be opened and parsed every time parse data is needed. The parsed info for all the source files in a directory are saved in a separate file in that directory named semantic.db. In principal, semantic.db could be used as a basis for completion. But a pure semantic.db-based implementation has some significant drawbacks compared to the present Java introspection-based completion: * No support for class files for which there is no source code * Requires prior creation of the semantic.db. For example, a semantic.db would have to be created for the entire JDK source files. It would be possible to provide semantic.db's for the JDK. * Requires loading and saving the semantic.db for each source directory that is visited in a session. This slows down opening Emacs (if you use Emacs' desktop feature, which I do) and closing Emacs substantially. In fact, the slow down is so annoying that I have turned off the semantic.db feature. * Requires improving the current interface to semantic.db. The current semantic.db implementation does not support Java's package-based scheme for quickly locating source and class files on a user's system. This support is essential to ensure reasonable response time for any feature based on semantic.db files. Put another way, the current Java introspection-based implementation of completion is faster, does not require a separate parse database, and works for all classes for which a class file exists on jde-global-classpath. The only advantage of a semantic.db-based approach that I can see at this point is that it would work for uncompiled classes. For this reason, it does not make sense to me to dump the current JDEE approach (let's call it the classpath-based approach) for the semantic.db approach (let's call it the sourcepath-based approach). You gain one minor advantage in return for several major disadvantages. My plan has been to merge the classpath and source path approaches so as to have a completion/browser facility that works whether only class files are available, only source files, or both. Under this approach, the JDEE would search the sourcepath first for parse data (i.e., use semantic.db) for a class and if nothing turned up, it would search the classpath (i.e., use Java instrospection via the Beanshell). To do this efficiently requires abstracting the semantic.db search mechanism so that the sourcepath and the classpath appear the same to clients of the search mechanism. I started work on this last spring with Eric Ludlum, semantic's author, but dropped it because of other JDEE work that was more pressing and also because semantic was currently in a great deal of flux. - Paul IMHO java/Beanshell is good to find out in which file a class/method is defined, but the rest of the job can be done very easy with semantic (and ECB if you like). But do not misunderstand me: Your code is good and a really stringent mechanism for code-completion/introspection/browsing etc. is really needed in JDEE. IMHO currently there are too many different mechanisms in JDEE to do this things.
Re: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
Sprenger, Karel [EMAIL PROTECTED] writes: Hello, [...] Is this a semantic problem? No. Completion looks for the logger class type by parsing the current java file. (jde-parse-declared-type-of) The method is not smart enough to look for it in the super class or classes within the same package. I will take a look at it later, it should be straightforward to use semantic to add the functionality to look for the variable in the super class. Javier
Re[2]: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
Berndl, Klaus [EMAIL PROTECTED] seems to think that: [ ... ] Differences to Sandips code: - uses ECB method-window to display the class-contents - uses semantic for getting the contents of a class - needs the source-file of the class to work The first point can be seen as advantage or disadvantage ;-) Especially the latter point is a disadvantage because it prevents from working for classes which are only available as *.class-file or within a jar-file... [ ... ] Hi Klaus, Your last point here about semantic not being able to look into a .class file is valid, however the CVS version semantic 2.0 semanticdb subsystem was recently enhanced to be extensible beyond just typical language parsers. The idea was Paul's originally, and I expanded on that. The basic premise is to sub-class a semanticdb class, and implement all the search methods. Your search methods can then call external programs, or whatever you like before returning a results table. There is an example that will search all Emacs Lisp symbols inside Emacs, regardless of having the sources available. The only part that needs to be done to make your new program support .class files is to extend the database. I can provide you with more details and perhaps start the process if you would like to try extending semanticdb. Have fun Eric -- Eric Ludlam: [EMAIL PROTECTED], [EMAIL PROTECTED] Home: http://www.ludlam.netSiege: www.siege-engine.com Emacs: http://cedet.sourceforge.net GNU: www.gnu.org
RE: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
A few more feature people might have missed are - 1. The output of the tool is hyperlinked. In other words by putting the point on any java type in the output and hitting RET key Invokes the tool on that type. 2. It attempts to display values of static final variables (including Private ones). 3. Additional bindings : [(return)] 'jde-introspect-javatype-by-xref-at-point ; run tool on the class at point in the output buffer [(control return)] 'jde-open-source-javatype-by-xref-at-point ; show source of class at point in the output buffer [(control shift return)] 'jde-help-javatype-by-xref-at-point ; show java doc of class at point in the output buffer [(down-mouse-1)] 'jde-introspect-javatype-by-xref-at-point; mouse based interface to above [(C-down-mouse-1)] 'jde-open-source-javatype-by-xref-at-point ; [(tab)] 'jde-introspect-next-ref ; goto next hyperlink [(shift tab)] 'jde-introspect-previous-ref; goto previous hyperlink Sandip -Original Message- From: Berndl, Klaus [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 2:07 AM To: 'Sandip Chitale'; [EMAIL PROTECTED] Subject: RE: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... Hello, attached is a small library ecb-jde.el which enables you to display the contents of class at point in the method-window of ECB: (defun ecb-jde-display-class-at-point () Displays in the ECB-methods-buffer the contents \(methods, attributes etc...) of the class which contains the definition of the \thing\ under point \(this can be a variablename, classname, methodname, attributename). This function needs the same requirements to work as the method-completion feature of JDE \(see `jde-complete-at-point')!. The source-file is searched first in `jde-sourcepath', then in `jde-global-classpath', then in $CLASSPATH, then in current-directory. (interactive) ... ) Just do: 1. Save ecb-jde.el somewhere in your load-path - probably best in the ecb-directory ;-) 2. Activate ECB 3. Open a java-source 4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET 5. Try it. Differences to Sandips code: - uses ECB method-window to display the class-contents - uses semantic for getting the contents of a class - needs the source-file of the class to work The first point can be seen as advantage or disadvantage ;-) Especially the latter point is a disadvantage because it prevents from working for classes which are only available as *.class-file or within a jar-file... But it demonstrates another elegant way of displaying things of a class under point without needing java-introspection. Klaus -Original Message- From: Sandip Chitale [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System
RE: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
Bernadl I am in Buffer A.java. I use ecb-jde-display-class-at-point to show methods of B.java. But I am still in A.java buffer. How do I tell ecb to show the methods of A.java. -Original Message- From: Berndl, Klaus [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 2:07 AM To: 'Sandip Chitale'; [EMAIL PROTECTED] Subject: RE: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... Hello, attached is a small library ecb-jde.el which enables you to display the contents of class at point in the method-window of ECB: (defun ecb-jde-display-class-at-point () Displays in the ECB-methods-buffer the contents \(methods, attributes etc...) of the class which contains the definition of the \thing\ under point \(this can be a variablename, classname, methodname, attributename). This function needs the same requirements to work as the method-completion feature of JDE \(see `jde-complete-at-point')!. The source-file is searched first in `jde-sourcepath', then in `jde-global-classpath', then in $CLASSPATH, then in current-directory. (interactive) ... ) Just do: 1. Save ecb-jde.el somewhere in your load-path - probably best in the ecb-directory ;-) 2. Activate ECB 3. Open a java-source 4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET 5. Try it. Differences to Sandips code: - uses ECB method-window to display the class-contents - uses semantic for getting the contents of a class - needs the source-file of the class to work The first point can be seen as advantage or disadvantage ;-) Especially the latter point is a disadvantage because it prevents from working for classes which are only available as *.class-file or within a jar-file... But it demonstrates another elegant way of displaying things of a class under point without needing java-introspection. Klaus -Original Message- From: Sandip Chitale [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System
RE: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
OK I got the answer. When you use C-c . 1 and come back to the source buffer, the methods window changes back to show the methods of the buffer you are in. -Original Message- From: Jayakrishnan Nair [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 9:18 AM To: [EMAIL PROTECTED] Subject: RE: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... Bernadl I am in Buffer A.java. I use ecb-jde-display-class-at-point to show methods of B.java. But I am still in A.java buffer. How do I tell ecb to show the methods of A.java. -Original Message- From: Berndl, Klaus [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 2:07 AM To: 'Sandip Chitale'; [EMAIL PROTECTED] Subject: RE: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... Hello, attached is a small library ecb-jde.el which enables you to display the contents of class at point in the method-window of ECB: (defun ecb-jde-display-class-at-point () Displays in the ECB-methods-buffer the contents \(methods, attributes etc...) of the class which contains the definition of the \thing\ under point \(this can be a variablename, classname, methodname, attributename). This function needs the same requirements to work as the method-completion feature of JDE \(see `jde-complete-at-point')!. The source-file is searched first in `jde-sourcepath', then in `jde-global-classpath', then in $CLASSPATH, then in current-directory. (interactive) ... ) Just do: 1. Save ecb-jde.el somewhere in your load-path - probably best in the ecb-directory ;-) 2. Activate ECB 3. Open a java-source 4. Load ecb-jde.el, e.g. with M-x load-library RET ecb RET 5. Try it. Differences to Sandips code: - uses ECB method-window to display the class-contents - uses semantic for getting the contents of a class - needs the source-file of the class to work The first point can be seen as advantage or disadvantage ;-) Especially the latter point is a disadvantage because it prevents from working for classes which are only available as *.class-file or within a jar-file... But it demonstrates another elegant way of displaying things of a class under point without needing java-introspection. Klaus -Original Message- From: Sandip Chitale [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:32 AM To: [EMAIL PROTECTED] Subject: Introspection based Java class browseralso demonstrates alittle bit of java and lisp integration... To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System
Re: Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
This is interesting. I know you've mentioned it before. If this would help the JDE project, I could do this fairly easily. We have the class parsing code already, we just have to tie it into semantic. But since we are not using the latest Semantic, and as far as I know we have no immediate need to change the way we do introspection, for the time being, I will hold off on doing this. Eric M. Ludlam [EMAIL PROTECTED] writes: Hi Klaus, Your last point here about semantic not being able to look into a .class file is valid, however the CVS version semantic 2.0 semanticdb subsystem was recently enhanced to be extensible beyond just typical language parsers. The idea was Paul's originally, and I expanded on that. The basic premise is to sub-class a semanticdb class, and implement all the search methods. Your search methods can then call external programs, or whatever you like before returning a results table. There is an example that will search all Emacs Lisp symbols inside Emacs, regardless of having the sources available. The only part that needs to be done to make your new program support .class files is to extend the database. I can provide you with more details and perhaps start the process if you would like to try extending semanticdb. Have fun Eric -- Eric Ludlam: [EMAIL PROTECTED], [EMAIL PROTECTED] Home: http://www.ludlam.netSiege: www.siege-engine.com Emacs: http://cedet.sourceforge.net GNU: www.gnu.org
Introspection based Java class browser....also demonstrates alittle bit of java and lisp integration...
To use : 1. unzip the attached zip at in the jde directory 2. Just put the following in your .emacs (require 'jde-introspect) Now put the point anywhere in Java buffer where you would normally invoke jde-complete functions. Then type (control c) (control v) (/) to see the java typeinfo buffer. For example: With point in the 'System' below : public class Foo { public static void main(String[] args) { System.out.println(args.length); } } here is what you get in a temp buffer. All the java class names are hyperlinks (activated by mouse or RET key). class java.lang.System /** * Constructors of class System **/ private System() /** * Methods of class System **/ public static native void arraycopy(Object, int, Object, int, int) public static native int identityHashCode(Object) public static void exit(int) public static void runFinalizersOnExit(boolean) private staticvoid initializeSystemClass() public static String setProperty(String, String) private static native void registerNatives() public static SecurityManager getSecurityManager() staticClass getCallerClass() public static void loadLibrary(String) public static String getProperty(String) public static String getProperty(String, String) public static native String mapLibraryName(String) public static void load(String) public static void setIn(InputStream) public static void setOut(PrintStream) public static void setErr(PrintStream) private staticvoid checkIO() private static native void setIn0(InputStream) private static native void setOut0(PrintStream) private static native void setErr0(PrintStream) public static void setSecurityManager(SecurityManager) private static synchronized void setSecurityManager0(SecurityManager) public static native long currentTimeMillis() private static native Properties initProperties(Properties) public static Properties getProperties() public static void setProperties(Properties) public static String getenv(String) public static void gc() public static void runFinalization() private staticInputStream nullInputStream() throws NullPointerException private staticPrintStream nullPrintStream() throws NullPointerException /** * Fields of class System **/ public final static InputStream in public final static PrintStream out public final static PrintStream err private staticSecurityManager security private staticProperties props jde.zip Description: Zip compressed data