Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Referendum on search for declarations behavior


As a user of search in hierarchy I expected all declarations to appear. If the current behavior stays I'll have to use the string pattern based search query but would like to use the Java element based query.
Maybe an additional parameter in SearchEngine.createHierarchyScope  could specify if to search in
- full hierarchy
- super types (+ element's class)
- subtypes (+ element's class)

Dani



Philippe_Mulet@xxxxxxx
Sent by: jdt-core-dev-admin@xxxxxxxxxxx

01/17/02 01:14 PM
Please respond to jdt-core-dev

       
        To:        jdt-core-dev@xxxxxxxxxxx
        cc:        
        Subject:        [jdt-core-dev] Referendum on search for declarations behavior


Here is a scenario, where the current accurate search is too restrictive.

If you select a method (which is also defined in a superclass), and search
for declarations in hierarchy, then it will not find the super method, but
it would find methods defined in subtypes.

e.g.:

public class X {
  public  void foo(){}
}

public class Y extends X {
 public void foo(){} // SEARCH DECL IN HIERARCHY
}

public class Z extends Y {
 public void foo(){}
}

Searching for declarations of Y.foo() in hierarchy would not find X.foo(),
but it would find Z.foo().

The reason for this behavior is that this particular search action is using
'Y.foo()', and not simply 'foo()'. Then the implementation of search for
declarations is implemented to check the declaring class if it was
specified in the search pattern, in which case it will only tolerate
declarations on type or subtypes.

There are 2 ways of solving this:
1) The search engine should also tolerate supertypes (somewhat
polymorphic).
2) The UI should not use 'Y.foo()' in this case, but simply 'foo()' (like
it does already for search declarations in workspace and working sets)

Do you have an opinion ? I think basically it comes down to:

When performing a search for declarations in the search page of 'Y.foo()',
do you expect X.foo(), or not ?


_______________________________________________
jdt-core-dev mailing list
jdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/jdt-core-dev



Back to the top