Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363989 - Call Hierarchy for a method is missing valid callers
Summary: Call Hierarchy for a method is missing valid callers
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows XP
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-16 20:38 EST by ai12796 CLA
Modified: 2021-03-23 05:20 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ai12796 CLA 2011-11-16 20:38:29 EST
Build Identifier: M20090211-1700

This bug is still present in Build id: M20110909-1335

public interface I {public void foo();}
public class B {public void foo(){}}
public class D extends B implements I {}
public class M {
 public void m(){
  ((I)new D()).foo();
 }
}

Call Hierarchy of B.foo() does not show M.m()!!!
Refactoring does work properly though.

Reproducible: Always

Steps to Reproduce:
1. Create a Java project
2. Create classes and interfaces as in details
3. Select B.foo() and click "Call Hierarchy"
Comment 1 Ayushman Jain CLA 2011-11-17 01:49:02 EST
The method foo being called from M.m() is actually I.foo not B.foo. Call hierarchy on I.foo does show M.m(). Am i missing something?
Comment 2 Satyam Kandula CLA 2011-11-17 02:06:08 EST
(In reply to comment #1)
> The method foo being called from M.m() is actually I.foo not B.foo. Call
> hierarchy on I.foo does show M.m(). Am i missing something?
but B is providing the implementation for I.foo and hence it should be reported.
Comment 3 Ayushman Jain CLA 2011-11-17 02:07:54 EST
(In reply to comment #2)
> (In reply to comment #1)
> > The method foo being called from M.m() is actually I.foo not B.foo. Call
> > hierarchy on I.foo does show M.m(). Am i missing something?
> but B is providing the implementation for I.foo and hence it should be
> reported.

Hm, but even search for references for B.foo doesn't show up anything. So, is this is a Java search issue?
Comment 4 Satyam Kandula CLA 2011-11-17 03:39:10 EST
(In reply to comment #3)
> Hm, but even search for references for B.foo doesn't show up anything. So, is
> this is a Java search issue?
Yes, this is a Java search issue.
Comment 5 Michael Schierl CLA 2012-02-15 13:44:30 EST
It also affects Ctrl+Click->"Open implementation" on method call foo(), which finds nothing.

As a workaround, it helped in my case to refactor the classes to look like this:

public abstract class B implements I {public void foo(){}}
public class D extends B {}

Or add a foo method to class D that just calls super.foo().

Although I don't think refactoring code just to make sure Eclipse search "works" is a good workaround.
Comment 6 Satyam Kandula CLA 2012-04-23 23:32:42 EDT
I will not be able to contain this for M7.
Comment 7 Eclipse Genie CLA 2020-04-07 14:35:34 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Michael Schierl CLA 2020-04-07 16:45:38 EDT
For the record, bug is still happening in 2020-03 and still relevant.

For some reason the fields for editing the version and status are readonly for me, though.