Skip to main content
Jump to: navigation, search

Difference between revisions of "Recommenders/CodeSearch"

m (Code Recommenders - Code Search Engine)
m (Code Recommenders - Code Search Engine)
Line 5: Line 5:
  
 
* [Search String] ''what literal'' to look for
 
* [Search String] ''what literal'' to look for
* [Limit to] ''what kind'' of relation you are looking for (references, declarations,  implementators, all)  '''- or -'''
+
* [Limit to] ''what kind'' or ''where in code'' you are looking for:
* [Match Location] ''where in code'' the search literal should match in a compilation unit (specified in Match Location Dialog),
+
** any location
* [Search for] ''which type'' of java element you are looking for when searching for a string (Type/Method/Package/Constructor/Field)
+
** references
 +
** declarations
 +
** implementor
 +
* [Match Location] ''where in code on statement level'' the search literal should match in a compilation unit (specified in Match Location Dialog),
 +
** in (any kind of) declaration
 +
*** Imports
 +
*** super type declarations
 +
*** annotations
 +
*** field types
 +
*** local variable types
 +
*** method return types
 +
*** method parameter types
 +
*** thrown exception types
 +
** in (any kind of) parameterized types
 +
*** type parameter bounds
 +
*** wildcard bounds
 +
*** type arguments
 +
** in expressions:
 +
*** cast expressions
 +
*** catch clauses
 +
*** instanceof expressions
 +
*** class instance creations
 +
*** thrown exception types
 +
* [Search for] ''which type'' of java element you are looking for when searching for a string:
 +
** Type
 +
** Constructor
 +
** Method
 +
** Field
 +
** Package
 
* [Search in] ''where''' to search for potential hits (sources, required projects, JRE libraries, App libraries), and
 
* [Search in] ''where''' to search for potential hits (sources, required projects, JRE libraries, App libraries), and
 
* [Scope] which further limits the ''Search in'' clause.
 
* [Scope] which further limits the ''Search in'' clause.
  
 
+
Quite a lot of different locations you can specify where JDT is searching for the occurrence of the given literal. This is, however, sometimes not enough if you want to use more complex queries. What do you have in mind? What query would you like to ask Siri?
  
 
'''Siri, ...'''
 
'''Siri, ...'''

Revision as of 09:09, 17 December 2011

Code Recommenders - Code Search Engine

If Siri were a code search engine... what would you ask it?

This page collects your demands on what search questions a code search engine should be able to answer. Do you have some frequently reoccurring searches you ask your code search engine? Then add it on this page (no matter how complex or simple the question is). Note, JDT's code search offers a quite sophisticated code search engine that allows you to specify many different options such as

  • [Search String] what literal to look for
  • [Limit to] what kind or where in code you are looking for:
    • any location
    • references
    • declarations
    • implementor
  • [Match Location] where in code on statement level the search literal should match in a compilation unit (specified in Match Location Dialog),
    • in (any kind of) declaration
      • Imports
      • super type declarations
      • annotations
      • field types
      • local variable types
      • method return types
      • method parameter types
      • thrown exception types
    • in (any kind of) parameterized types
      • type parameter bounds
      • wildcard bounds
      • type arguments
    • in expressions:
      • cast expressions
      • catch clauses
      • instanceof expressions
      • class instance creations
      • thrown exception types
  • [Search for] which type of java element you are looking for when searching for a string:
    • Type
    • Constructor
    • Method
    • Field
    • Package
  • [Search in] where' to search for potential hits (sources, required projects, JRE libraries, App libraries), and
  • [Scope] which further limits the Search in clause.

Quite a lot of different locations you can specify where JDT is searching for the occurrence of the given literal. This is, however, sometimes not enough if you want to use more complex queries. What do you have in mind? What query would you like to ask Siri?

Siri, ...

... who calls this method? (solvable by JDT call hierarchy)

... who calls these 3 methods together in a method?

... who uses this type in his own code? (as in JDT's References workspace search)

... who uses these 3 types together in a method?

... who extends this type in his own code? (as in JDT class hierarchy)

... tell me which public methods exist in my libraries that return an instance of type X?

... tell me which classes exist in my project that offer static fields or methods?

... tell me which classes exist in my project that offer static fields or methods of (return) type IWorkbench?

... find all Type/Method/Constructor/Package/Field declarations that are named like "someName*" (JDT search)

... find all references in $location of Type/Method/Constructor/Package/Field declarations named like "someName*" (JDT search)

... find all implementors of Type/Method named like "someName*"

(JDT search)

Back to the top