Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding references of MyClass.toString() in Eclipse while ignoring Object.toString()

When attempting to do so, Eclipse will display all the calls in the project for any .toString() method, which is of course not what I'm aiming to.

Is there any way to filter the matches such that only classes of a certain type show up in the results pane?

like image 856
devoured elysium Avatar asked Dec 09 '12 22:12

devoured elysium


2 Answers

Either right-click your override toString() method and select References > Workspace, or simply press Ctrl+Shift+G while the cursor is on the method.

As some people have pointed out the list of results will normally include the vast number of references to the toString() method of class Object, which can be thousands or tens of thousands of hits. This obviously makes the whole search rather useless.

Luckily you can filter the results, by clicking on the little triangle on the top right of the Search tab and select to filter out all References to Overridden, which will leave you with just the references to your concrete class' method override.

like image 138
Andreas Klein Avatar answered Oct 08 '22 17:10

Andreas Klein


If your class overrides toString(), right-click on method name > References > Workspace.

If your class doesn't override toString(), you can't.

Implicit calls, for example when instances of your class are concatenated with a String, won't ever show.

like image 21
Bohemian Avatar answered Oct 08 '22 19:10

Bohemian