Ask the IDE to navigate to an overridden implementation of the toString () method?

I am using eclipse neon. I am dealing with an extensive class hierarchy, for example:

class AbstractBase { ...

class ImplA extends AbstractBase { ...

class ImplAB extends ImplA { ...

      

Suppose ImplAB is open in my eclipse. I know that some of its ancestors do @Override toString () - and I would like to jump to that source code.

In other words: if you are given a class X that inherits a method foo()

but does not override itself foo()

- is there a quick way to go to the version foo()

that "applies" to X?

More precisely: suppose the cursor is somewhere in class X, and there is no call to this method inside the class X itself.

A workaround would be to quickly type foo()

somewhere in the source and then press F3 on that - but then I have to undo that changes (and yes, it can be a problem when you have autosave turned on).

And while we're at it: in case it's not possible in eclipse, can anyone tell if IntelliJ has this feature?

+3


source to share


1 answer


TL; DR: You can double tap Ctrl+ Oto view inherited items in a simple popup.




You can use the type hierarchy window (shortcut:) F4while the cursor is on the class name. Next to, Child

click the icon Show all inherited members

:

Image




If you want a slightly faster way to do this (including the search bar), just double-tap Ctrl+ Oand you can start typing:

Picture




As you edited your question, this also exists in IntelliJ via the Outline Tool Window ( Alt+ 7):

Image

+6


source







All Articles