Bug 88300 - [search] Reference search result is changed by placement of private method
Summary: [search] Reference search result is changed by placement of private method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 critical (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-17 04:26 EST by Tammo Freese CLA
Modified: 2005-03-30 16:59 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tammo Freese CLA 2005-03-17 04:26:11 EST
We've found this strange behavior on 3.1M5a.

package search;
public class SuperClass {
    public void aMethod(Object x) {
    }
}

package search;
public class SubClass extends SuperClass {
    public void aMethod(Object x) {
    }
    private void aMethod(String x) {
    }
}

package search;
public class User {
    public void methodUsingSubClassMethod() {
        SuperClass user = new SubClass();
        user.aMethod(new Object());
    }
}

When we do a reference search on SubClass.aMethod(Object x),
we get the result:
search.User.methodUsingSubClassMethod()

But if we change the order of the methods in SubClass (see below),
no references are found!
In Eclipse 3.0.1 the problem does not occur.

package search;
public class SubClass extends SuperClass {
    private void aMethod(String x) {
    }
    public void aMethod(Object x) {
    }
}
Comment 1 Frederic Fusier CLA 2005-03-23 18:11:32 EST
Increase severity of this bug as requested by user:
"I would like to suggest that we raise the severity of #88300 to 'critical',
since the incomplete search result may lead to the
assumption that a method is not called anymore and therefore to 
the deletion of the method. The compiler would not complain,
since the signature is available in the superclass. 

The code would be available in the attic of the SCM, but 
this kind of cleaning up could lead to the introduction of subtle bugs.
We only found this problem by pure luck and considered it so severe
that we decided to switch back to 3.0.1."

Comment 2 Frederic Fusier CLA 2005-03-23 18:16:55 EST
In fact, it has been already fixed and released in HEAD stream as we discover by
another way (mails titled "Unreferenced methods" on jdt-core-dev@eclipse.org
were talking about this issue).

When available, you can use this week integration build or next week 3.1 M6
milestone to have this bug fixed.

[jdt-core-dev internal]
Add specific test cases #testBug88300 and #testBug88300b in JavaSearchBugsTest
and rename #testBug70827b as #testBug88300c.
Also update buildnotes_jdt-core.html
Comment 3 Olivier Thomann CLA 2005-03-30 16:59:43 EST
Verified in I20050330-0500