Bug 96761 - [1.5][search] Search for declarations of generic method finds non-overriding method
Summary: [1.5][search] Search for declarations of generic method finds non-overriding ...
Status: CLOSED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-26 06:28 EDT by Markus Keller CLA
Modified: 2005-06-10 09:05 EDT (History)
0 users

See Also:


Attachments
Patch implementing fix for both this bug and bug 96763 (31.73 KB, patch)
2005-06-08 12:33 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-05-26 06:28:51 EDT
N20050526-0010

class Generic<G> {
	void take(G g) {
		System.out.println("Generic#take(G): " + g);
	}
}

class Impl extends Generic<Number> {
	void take(Integer g) {
		System.out.println("nonripple Impl#take(Integer): " + g);
	}
	void take(Number g) {
		System.out.println("Impl#take(Number): " + g);
	}
}

Search for declarations of Generic#take(G). Both methods in Impl are reported,
but Impl#take(Integer) does not override Generic#take(G).

Here's a test program you can use to play with method overriding:

public class Main {
    public static void main(String[] args) {
        new Generic<Number>().take(new Double(1));
        new Generic<Integer>().take(new Integer(2));

        new Impl().take(new Integer(3));
        new Impl().take(new Float(4));
        
        Generic<Number> gn= new Impl();
        gn.take(new Integer(6));
        gn.take(new Double(7));
    }
}
Comment 1 Philipe Mulet CLA 2005-06-07 04:14:20 EDT
+1 for RC2
Comment 2 Frederic Fusier CLA 2005-06-08 12:33:40 EDT
Created attachment 22619 [details]
Patch implementing fix for both this bug and bug 96763

All JDT tests pass (Core+UI).
I've made some perf tests on method search modifying
FullSourceWorkspaceSearchTests to perform search using string
("equals(java.lang.Object)" ) and IJavaElement (IMethod "equals").
I didn't notice any time increase for both searches either for CPU Time and
Elapsed Process.
Comment 3 Frederic Fusier CLA 2005-06-08 12:55:59 EDT
Fixed and released in HEAD.

Search does no longer find non-overridden method while search for take(G)
declaration...

|jdt-core internal]
See patch for changes
Test cases added in JavaSearchBugsTests
Comment 4 Olivier Thomann CLA 2005-06-09 09:17:31 EDT
Verified in N20050609-0010.
take(Integer) is not reported anymore.
Comment 5 Jerome Lanneluc CLA 2005-06-10 09:05:46 EDT
Verified with I20050610-0010