Environment
I have a simple test-foo.jar
library with just two files:
- interface
Foo
with a single methodvoid doStuff()
- class
Bar
with a single methodvoid executeFoo(Foo foo)
, which just callsfoo.doStuff()
Then I have Eclipse Java project with a single class FooImpl
which implements Foo
. This project has test-foo.jar
as a build path entry. I don't have source codes for this JAR attached.
The Problem
Now lets say I am a bit curious about who actually calls doStuff()
method. So I click on the FooImpl#doStuff
signature and press Ctrl+Shift+G (find references). I expect to see Bar#executeFoo
in the search results, but the results are actually empty.
The Question
I am bit confused as I thought this works in Eclipse (been using Eclipse for more than a few years now). But it seems it only works for libraries with sources attached (which I didn't notice before).
Is there a way how to find references (or usage) of a type (or method) in project libraries without sources attached? Why does not Eclipse index and show references from .class
files?
Additional info:
- Finding references works as soon as I attach source codes to the JAR.
- I am interested in knowing why Eclipse JDT developers decided to not index or search
.class
without sources. - Note, that knowing who is calling my method is very useful information even if I don't have source codes.
- Seems to me that Eclipse is indexing method references in
.class
files. - And by the way NetBeans "don't work" as well ;).