Bug 39700 - Questionable result when searching for declarations of private methods in hierarchy
Summary: Questionable result when searching for declarations of private methods in hie...
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0 M4   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 3615 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-07-07 10:21 EDT by Dirk Baeumer CLA
Modified: 2004-04-06 11:21 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2003-07-07 10:21:07 EDT
I20030628++

Test case:

class A {
  private void foo() {}
}

class B extends A {
  private void foo() {}
}

Searching for declarations in hierarchy of A.foo() returns B.foo() which from 
a language point of view isn't correct. However it makes sense from a user's 
point of view.

The search engine should offer a flag to control whether the client or the 
language point of view is requested.
Comment 1 Adam Kiezun CLA 2003-07-07 10:39:56 EDT
it's a defect with a long history - see bug 3615 and bug 3619 
i'll close bug 3615 as a dup of this one
Comment 2 Adam Kiezun CLA 2003-07-07 10:41:22 EDT
*** Bug 3615 has been marked as a duplicate of this bug. ***
Comment 3 Philipe Mulet CLA 2003-07-07 12:43:14 EDT
Strictly speaking, the search is finding all declarations matching a signature, 
within a type hierarchy. Thus it is doing the right thing.

Now, the override indicator should not be positionned for private methods or 
default ones across package boundaries, since these aren't seeing each other.
Comment 4 Philipe Mulet CLA 2003-07-16 17:54:47 EDT
Ok to close?
Comment 5 Dirk Baeumer CLA 2003-07-17 04:01:49 EDT
Now, since for refactoring we need a way to find out if a method really 
overrides another method. We can trun this one into a feature request.
Comment 6 Adam Kiezun CLA 2003-08-21 14:03:51 EDT
FYI: this bug made me put a rather nasty workaround to fix bug 40767
Comment 7 Philipe Mulet CLA 2003-09-15 18:03:22 EDT
I'd rather keep the current behavior which allows to find related methods (even 
non visible).

Closing
Comment 8 Dirk Baeumer CLA 2003-09-17 04:36:40 EDT
Philippe, 

would it be possible to provide API that gives us the desired behaviour. 
Currently we have to put in the logic what "overrides" means. This is IMO core 
knowhow.
Comment 9 Philipe Mulet CLA 2003-09-17 05:39:31 EDT
At an API level, IMethod#isOverriding(IMethod) would be quite inefficient since 
it would need to check first whether the arg method is in the hierarchy of the 
first one... would be highly inefficient given your usecase.
Comment 10 Dirk Baeumer CLA 2003-09-17 05:41:49 EDT
So, what do you recommend to solve the issue <g>
Comment 11 Philipe Mulet CLA 2003-09-17 07:13:45 EDT
If it is in the DOM then this is a separate problem.
Comment 12 Dirk Baeumer CLA 2003-09-17 08:00:26 EDT
No it isn't in the DOM. We use "search declaration in hierarchy" and want a 
language conform result set.
Comment 13 Philipe Mulet CLA 2003-09-17 15:43:27 EDT
Refactoring is only a particular usecase where you would like to play certain 
rules. I think in general searching for related declarations is a useful query. 
Think for instance that looking for static methods or fields would never 
provide more than one hit when starting from an element...

You would need a slightly different query I believe.
Comment 14 Dirk Baeumer CLA 2003-09-18 03:52:58 EDT
I am not trying to say that the current query isn't useful. All we need is a 
language conformant counterpart of that query. Can we write one by ourselves ?