Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find instances of overridden method in Eclipse

Tags:

java

eclipse

Say I have the following:

public class TextField {
  private String value = "";
  public String getValue() { return value; }
}

And:

public class TextField2 extends TextField {
  public String getValue() { return value; }
}

Is there any way in Eclipse to search for only instances of the getValue() method called on a TextField2 object? I'm assuming the answer is no, but figured I would ask.

like image 832
Tommo Avatar asked Aug 30 '25 17:08

Tommo


1 Answers

You can do this by selecting the overriden method, pressing the key combination Ctrl+Shift+G. Or by selecting Search --> References --> Workspace from the menu. In the Search view that shows the result, click on the button with the arrow icon at the top right of the view and select References to Overriden.

enter image description here

But as @Sotirios implied in the comment, this would not detect references by variables declared of type TextField which may be instances of the subtype TextField2 at runtime.

like image 94
M A Avatar answered Sep 02 '25 07:09

M A