Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find the overridden method in Eclipse?

Tags:

When I am looking at a method in eclipse java, how do I jump to the method it overrides/extends?

like image 495
andreas Avatar asked Aug 07 '12 15:08

andreas


People also ask

How do I access overridden methods?

Overriding and Access-Modifiers : The access modifier for an overriding method can allow more, but not less, access than the overridden method. For example, a protected instance method in the super-class can be made public, but not private, in the subclass. Doing so, will generate compile-time error.

Which method is overridden?

In Java, method overriding occurs when a subclass (child class) has the same method as the parent class. In other words, method overriding occurs when a subclass provides a particular implementation of a method declared by one of its parent classes.


2 Answers

Three ways to go about it.

Hyperlink Method (Mouse + Keyboard)

Press CTRL while hovering over the overriden method.

You should see an option called 'Open Super Implementation. Click it !

From here :

enter image description here

Keyboard shortcut

And for bonus points, you can setup a Keyboard shortcut to do this like so :

enter image description here

When you try to setup a keyboard shortcut, you may filter by typing Open Super Im. On my Eclipse Indigo three matches were found. I tried setting them one by one until the shortcut appeared in Navigate -> Open Super Implementation like so :

enter image description here

Mouse only - Using the vertical Ruler

enter image description here

Click the ovverride marker that appears in the Vertical Ruler as in the above snapshot.

like image 176
Ashutosh Jindal Avatar answered Sep 23 '22 14:09

Ashutosh Jindal


On the left edge of the editor there is a small triangle symbol next to the overwritten method. The tooltip tells you which superclass you are overwriting, clicking it leads you to the corresponding method.

Screenshot:

Screenshot

like image 33
moeTi Avatar answered Sep 21 '22 14:09

moeTi