简体   繁体   中英

How do I find usages of method implementation in eclipse?

When I want to find usages of a normal method in java it is fairly easy and straightforward CTRL-SHIFT-G .

However if this method has a super definition, or implementation, then eclipse will show me usages of all types in the hierarchy types.

For example, if I have a toString() method on my class, I would only be interested in finding exactly where this toString() of this class was being called, instead eclipse gives me every single ancestor toString in the project (ie Object.toString() ).

How do I find only specific usages to my class? And not usages of parent classes like Object.toString() ?

Alt + ctrl + h should give you exactly, what you are looking for.

Updated with screenshot from my workspace as some people are facing issue in following it:

在此处输入图片说明

Thanks to @manouti answer , To show when using the overridden method only follow the steps:

Search by Java the method as com.package.MyObject.toString()

And after in search result screen click on the right arrow to the left and check References to Overridden

After having the same problem as many others in the comments (Eclipse shows references to Object.toString()) I have found a way that seems to work correctly:

Go to outline from your custom class, right click on your toString() implementation and References -> Project. This displays only references to said implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM