Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » call hierarchy of overridden method
icon5.gif  call hierarchy of overridden method [message #631416] Thu, 07 October 2010 13:50 Go to next message
Luis  is currently offline Luis Friend
Messages: 5
Registered: October 2010
Junior Member
Hi there!

I have Object.equals(Object obj) method overridden in a final class. I want to modify this method but I need to check where it is called. If I select the name of the method and choose "Open Call Hierarchy", it shows me every call to equals overridden by any class. Is there a way in which it tells me where this equals method (only when called from an instance of this concrete class or subclasses) has been called?

Thanks!
Re: call hierarchy of overridden method [message #631654 is a reply to message #631416] Fri, 08 October 2010 11:48 Go to previous messageGo to next message
Vinicius Isola is currently offline Vinicius IsolaFriend
Messages: 40
Registered: March 2010
Location: Brazil
Member
Just right-click over the method you want, then go to References and choose Project. Then in the search view that opened you can see where it was called.

I hope that helps.
Regards.
Re: call hierarchy of overridden method [message #631665 is a reply to message #631654] Fri, 08 October 2010 12:21 Go to previous messageGo to next message
Luis  is currently offline Luis Friend
Messages: 5
Registered: October 2010
Junior Member
No, that's also finding calls to equals from every class. I want only the one to my class.

Thanks.
Re: call hierarchy of overridden method [message #631677 is a reply to message #631665] Fri, 08 October 2010 12:49 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Luis wrote:
> No, that's also finding calls to equals from every class. I want only
> the one to my class.
Make sure you select the equals method in your class.

Dani
>
> Thanks.
Re: call hierarchy of overridden method [message #631697 is a reply to message #631677] Fri, 08 October 2010 13:54 Go to previous messageGo to next message
Luis  is currently offline Luis Friend
Messages: 5
Registered: October 2010
Junior Member
OK, it's not from every class, but it's still finding equals methods from super classes. Since I'm overriding this method, I don't consider it the same method and I there should be a way to find all appearances of this only one method.

If B extends A, and A overrides equals but B doesn't, I open B, select the equals word of its equal method, select References -> Project It should appear every call to equals method from instances of A and B (since B is inheriting this method from A, it's the same method).

But, if we override this method in B too, and I open B, select the equals word of its equal method, select References -> Project, it should appear ONLY calls to equals method from instances of B. It's overridden, so it's a very different method.

Am I wrong?
Thanks!
Luis
Re: call hierarchy of overridden method [message #631756 is a reply to message #631697] Fri, 08 October 2010 15:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NOSPAM.ibm.com

Hi,

It's overridden, BUT, that explicit method can still be called from a
class that has an instance of type B set into a variable typed as A.
Because of this those classes can still call this method on B even
though they think it is an A. There is no way for JDT to know that such
a variable of type A would never ever contain an instance of type B.
That is a runtime question and not a static compile time analysis problem.

On 10/8/2010 9:54 AM, Luis wrote:
>
> But, if we override this method in B too, and I open B, select the
> equals word of its equal method, select References -> Project, it should
> appear ONLY calls to equals method from instances of B. It's overridden,
> so it's a very different method.

--
Thanks,
Rich Kulp
Re: call hierarchy of overridden method [message #631770 is a reply to message #631756] Fri, 08 October 2010 16:53 Go to previous messageGo to next message
Luis  is currently offline Luis Friend
Messages: 5
Registered: October 2010
Junior Member
You're completely right.

Thanks!
Re: call hierarchy of overridden method [message #631980 is a reply to message #631770] Mon, 11 October 2010 06:53 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
If you use 'search for References' instead of 'Call hierarchy', you could filter off some results by selecting 'References to Overriden'. Click on the view menu (small inverse triangle at the end) to filter.
Re: call hierarchy of overridden method [message #632026 is a reply to message #631980] Mon, 11 October 2010 09:18 Go to previous message
Luis  is currently offline Luis Friend
Messages: 5
Registered: October 2010
Junior Member
THAT'S IT!

Thank you very much!
Previous Topic:ASTParser having problems with line comments
Next Topic:Question!
Goto Forum:
  


Current Time: Wed Sep 25 09:01:55 GMT 2024

Powered by FUDForum. Page generated in 0.04277 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top