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

Java find references don't find references #184

Closed
kleewho opened this issue Jun 11, 2015 · 11 comments
Closed

Java find references don't find references #184

kleewho opened this issue Jun 11, 2015 · 11 comments

Comments

@kleewho
Copy link
Collaborator

kleewho commented Jun 11, 2015

When calling eclim-java-find-references I get buffer with this content:

-*- mode: eclim-find; default-directory: /home/corpo-user/Dokumenty/Projekty/Acme/foo/foo-domain/src/main/java/com/acme/domain -*-

eclim java_search -p ChannelView

and as you can see zero results. Making the same call from command-line:

./eclim -command java_search -p ChannelView 
[{"filename":"/home/corpo-user/Dokumenty/Projekty/Acme/foo/foo-domain/src/main/java/com/acme/domain/ChannelView.java","offset":304,"length":11,"line":12,"column":14,"message":"com.acme.domain.ChannelView"}]

Obviously the call is wrong cause even looking at the function definition I see that the call itself should at least have -x references somewhere. Calling it from cli like this:

./eclim -command java_search -p ChannelView -t all -x references

returns plenty of results

@kleewho
Copy link
Collaborator Author

kleewho commented Jun 11, 2015

It seems that content of eclim find buffer don't have anything to do with what was actually sent. Content is always the same https://github.com/senny/emacs-eclim/blob/master/eclim.el#L379

@jchochli
Copy link
Collaborator

It's working for me when I have point on any text.

@kleewho
Copy link
Collaborator Author

kleewho commented Jun 23, 2015

Lucky guy! If the situation occur then I will try to reproduce it in my test project. I have prepared test project but I'm looking for when it's failing. If possible do not close this issue yet as I'm sure that it's failing

@kleewho
Copy link
Collaborator Author

kleewho commented Jun 24, 2015

I found the problem... consider this project:

parent
 |- lib
 |- proj

lib is a dependency of proj and both of them are submodules of parent. Looking for anything in lib is failing probably because eclim returns wrong project for files present in lib. Command:

~/opt/eclipse/eclim -command project_by_resource -f /home/user/parent/lib/src/main/java/com/acme/Library.java

instead returning lib returns parent and then eclim can't find any references. Calling java_search with fixed project name returns correct list of references but call with wrongly set project name returns empty list.

I will clean workspace and reimport project. Also I will search for similar issue in eclim issues

@kleewho
Copy link
Collaborator Author

kleewho commented Jun 24, 2015

Reimport did the trick. Closing cause it doesn't sound like an emacs-eclim issue

@kleewho kleewho closed this as completed Jun 24, 2015
@jchochli
Copy link
Collaborator

You're a fireball of activity! 🔥

@liujoey
Copy link

liujoey commented Jul 30, 2015

I've experienced the same issue, it starts since my last updates of packages.
Now eclim-java-find-declaration giving me nothing. Reimport does not work for me.
Here is the content of eclim-find buffer:

-*- mode: eclim-find; default-directory: /home/joey/workspace/icon/libicon/src/main/java/com/philips/prna/util/ -*-

eclim java_search -p TermMap

I have icon as the parent project, and libicon is one of the sub-project.

@kleewho
Copy link
Collaborator Author

kleewho commented Jul 30, 2015

I've been experiencing some similar problems from time to time but I can't seem to find any pattern. @liujoey can you describe how exactly your project looks like? How do you import it? I've got concerns about multimodule maven project with parent being simple pom that groups couple projects. Do you have similar setup? I'm willing to try to tackle this once again, but I'm looking for some inspiration

@liujoey
Copy link

liujoey commented Jul 30, 2015

It was working last week. Then I did Emacs package update earlier this week, don't remember what's the version I was using previously.

I don't think it's anything wrong with Eclim. I've no problem to jump to declaration when using Vim eclim plugin. And from the command line, the eclim command result looks also good.

$ /opt/eclipse_luna/eclim -command java_search -p TermMap
[{"filename":"/home/joey/workspace/icon/libicon/src/main/java/com/philips/prna/util/TermMap.java","offset":328,"length":7,"line":17,"column":14,"message":"com.philips.prna.util.TermMap"}]

It's just that the updated emacs-eclim can't jump to the file, I guess.

@liujoey
Copy link

liujoey commented Jul 31, 2015

I tested eclim-java-find-type, and it works
Now I was confused. The code of eclim-java-find-declaration uses -n -f -o options for java_search.

(defun eclim-java-find-declaration ()
  "Find and display the declaration of the java identifier at point."
  (interactive)
  (let ((i (eclim--java-identifier-at-point t)))
    (eclim/with-results hits ("java_search" "-n" "-f" ("-o" (car i)) ("-l" (length (cdr i))) ("-x" "declaration"))
      (eclim--find-display-results (cdr i) hits t))))

When I run command:

/opt/eclipse_luna/eclim -command java_search -n -f -o TermMap -l 7 -x declaration

I got Missing argument for option: n

according to the eclim document, there's no -n or -f options, it only supports -p, am I missing something here?

@kleewho
Copy link
Collaborator Author

kleewho commented Jul 31, 2015

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