Summary: | [search] Search for method declarations in workspace, disregarding declaring type | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | dirk_baeumer, martinae, philippe_mulet |
Version: | 3.1 | ||
Target Milestone: | 3.1 M6 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 76014, 79976 |
Description
Markus Keller
2004-12-06 09:23:36 EST
As discussed on the phone, this "ignore declaring type but consider exact parameter types" will be implemented by an additional flag for a SearchPattern. Should also consider a flag for ignoring return type. Could be carried only by pattern factory using element as a variation on limitTo parameter. For the RippleMethodFinder, the return type should also be ignored. Otherwise, we won't find methods with covariant return types. See also bug 87778. Proposal is to add 2 new constants in IJavaSearchConstants: /** * Ignore declaring type while searching result. * Can be used in conjunction with any of the nature of match. * @since 3.1 */ int IGNORE_DECLARING_TYPE = 0x10; /** * Ignore return type while searching result. * Can be used in conjunction with any of the nature of match. * Note that for fields search, pattern will ignore field type. * This value will have no effect for types search. * @since 3.1 */ int IGNORE_RETURN_TYPE = 0x20; Then client will have to set these flags on limitTo value while creating pattern and search engine will ignore corresponding types. Using bug 87778 example + class C: class A { A stable() { return null; } A covariant() { return null; } } class B extends A { A stable() { return null; } B covariant() { return null; } } class C { A stable() { return null; } A covariant() { return null; } } Search for declarations of A.covariant will return: Normal: 2 matches (in A and in B) IGNORE_DECLARING_TYPE: 2 match (in A and in C) IGNORE_RETURN_TYPE: 2 matches (in A and in B) IGNORE_DECLARING_TYPE+IGNORE_RETURN_TYPE: 3 matches (in A, in B and in C) Let me know if this behavior matches your requirement. That's perfect. Fixed. Implementation is described in comment 5. [jdt-core-internal] Changes done in IJavaSearchConstants and SearchPattern. Test cases added in JavaSearchBugsTests Verified in I20050330-0500 |