Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eclim-java-find-type ignores files in jars #250

Open
gdanov opened this issue Sep 27, 2015 · 2 comments
Open

eclim-java-find-type ignores files in jars #250

gdanov opened this issue Sep 27, 2015 · 2 comments

Comments

@gdanov
Copy link

gdanov commented Sep 27, 2015

I have java project where the source codes for external libs (incl. the jdk) are in jars. When I run the eclimd command that eclim-emacs dumps in the terminal I get result, but it's filtered out from what I can see in the source code.
Details:

the terminal command

eclim -command java_search -p Integer -t type -x declarations -s workspace -i ''

result

[{"filename":"jar:file:///Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Classes/classes.jar!java/lang/Integer.class","offset":-1,"length":0,"line":1,"column":1,"message":"java.lang.Integer"},{"filename":"zip:///Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home/src.zip!/java/lang/Integer.java","offset":1149,"length":7,"line":52,"column":20,"message":"java.lang.Integer"}]

eclim grep view pops-up and shows empty result. Same also with a class from another lib where the jar contains the .class as well as the .java files.
I suspect that this is where these results are filtered out: https://github.com/senny/emacs-eclim/blob/master/eclim.el#L371

(defun eclim--find-display-results (pattern results &optional open-single-file)
  (let ((results (remove-if (lambda (result) (string-match (rx bol (or "jar" "zip") ":") (assoc-default 'filename result))) results)))

I guess there is good reason for that. I am interested to understand how to set-up my project so that emacs-eclim would be able to display these results

@sampajano
Copy link

+1 This is very useful for android programming as I quite often need to look up builtin class definitions. The default behavior in the Vim plugin is locating the jar and opening the class file.

Also with the existing packages like https://github.com/gbalats/autodisass-java-bytecode, there is a very simple fix.

@JordanFaust
Copy link

Eclim already provides an API for reading from a archive file: https://github.com/ervandew/eclim/blob/2.5.0/org.eclim.core/java/org/eclim/plugin/core/command/archive/ArchiveReadCommand.java

This command will create a temporary file that contains the contents of the decompiled java file just as you would see when using eclipse to "goto declaration".

EDIT:

Example command executed by the vim plugin:

-editor vim -command archive_read -f "jar:///Users/path/to/.m2/repository/org/apache/curator/curator-framework/2.7.1/curator-framework-2.7.1-sources.jar!/org/apache/curator/framework/CuratorFramework.java"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants