Reputation: 7421
I have an application as JAR file with many dependencies. For some reason I need to decompile one of the libraries and open it up with Eclipse. For a given interface in the project, is there a way to find the class(s) that implements it? It may be the case that the interface was implemented in other library that I didn't decompile yet. Is it possible to do this for this kind of classes?
Upvotes: 93
Views: 73759
Reputation: 968
Select the class name, then 'F4' in Eclipse (Windows environment)
Upvotes: 0
Reputation: 11
Ctrl + H (Search Option) Open Java Search perspective and, enter the interface name, click Implementors radio button and you will find which classes implement a particular interface. Same as answer from stackexchanger above
Upvotes: 0
Reputation: 3976
Try Ctrl+T after selecting the classname; should work in Java Perspective.
Upvotes: 49
Reputation: 298838
Or right-click and select Quick Type Hierarchy
for a pulldown menu of extending interfaces and implementing classes.
Upvotes: 1
Reputation: 18344
You can "Show Type Hierarchy" on the item (Right Click to choose this option or press F4 when the item is highlighted)*.
However, this will list only items in those projects that are referred ("dependent"). Not in others.
So if you have decompiled a jar, and there is another jar that you have not decompiled, then the implementations (of the interface) in that jar will not be listed.
Also, say you have decompiled a jar as a project and there is another project that is referring to the jar, and not the decompiled project, implementations in that will also not be listed.
So you will have to decompile all jars and add them as projects (and add references via "Java Build Path") to make sure all the implementations in the jars of your choice are listed.
* Quick type Hierarchy, ctrl + T will show a similar structure in a tooltip/autocomplete kind of panel. But the complete type hierarchy is more useful for the type of analysis you are intending to do.
Upvotes: 10
Reputation: 691655
Right-click on the interface, and choose "Open type hierarchy". Then click on "Show the subtype hierarchy".
Upvotes: 125