# Java Search Tab

This tab in the Search dialog allows you to search for Java elements. To show the tab invoke Search > Java.

## Search string

In this field, type the expression for which you wish to search, using the wildcard characters mentioned in the dialog as needed. This field is initialized based on the current selection.

- Type patterns have the following syntax:

  `[qualification '.']typeName ['<' typeArguments '>']`

  Examples:

  - `java.lang.Object`
  - `Runnable`
  - `List<String>`

  Type arguments can be specified to search for references to parameterized types using following syntax:

  `'<' { [ '?' {'extends'|'super'} ] type ( ',' [ '?' {'extends'|'super'} ] type )* | '?' } '>'`

  Note that:
  - '*' is not valid inside type arguments definition <>
  - '?' is treated as a wildcard when it is inside <> (i.e. it must be put on first position of the type argument)
- Method patterns have the following syntax:

  `[declaringType '.'] ['<' typeArguments '>'] methodName ['(' parameterTypes ')'] [returnType]`

  Type arguments have the same syntax as explained in the type patterns section.

  Examples:

  - `java.lang.Runnable.run() void`
  - `main(*)`
  - `<String>toArray(String[])`
- Constructor patterns have the following syntax:

  `['<' typeArguments '>'] [declaringQualification '.'] typeName ['(' parameterTypes ')']`

  Type arguments have the same syntax as explained in the type patterns section.

  Note that the constructor name should not be entered as it is always the same as the type name.

  Examples:

  - `java.lang.Object()`
  - `Test(*)`
  - `<Exception>Sample(Exception)`
- Field patterns have the following syntax:

  `[declaringType '.'] fieldName [fieldType]`

  Examples:

  - `java.lang.String.serialVersionUID long`
  - `field*`
- Package patterns have the following syntax:

  `packageNameSegment {'.' packageNameSegment}`

  Examples:

  - `java.lang`
  - `org.e*.jdt.c*e`

## Search For

Select to search for one of the following kinds of elements:

- Type
- Method
- Package
- Constructor
- Field

## Limit To

Select to limit your search results to one of the following kinds of matches:

- Declarations
- Implementors (available only when searching for types)
- References
- All occurrences
- Read access (available only when searching for fields)
- Write access (available only when searching for fields)
- Match locations (available only when searching for types or methods references).

  Match locations allow to further narrow the location of matches.

  Select the location where to search for:

  - type reference:
    - Super class declarations
    - Annotations
    - Field types
    - Local variable types
    - Method return types
    - Method parameter types
    - Thrown exception types
    - Type parameter bounds
    - Wildcard bounds
    - Type argument
    - Cast expressions
    - Catch clauses
    - Class instance creations
    - 'instanceof' checks
  - method reference:
    - 'this' references
    - Implicit 'this' references
    - 'super' references
    - Qualified references

## Search In

Select where in the scope to search for results

- Sources: Search in all source files in the scope
- Required projects: Search in all required projects
- JRE libraries: Search in JRE libraries on the build path
- Application libraries: Search in libraries on the build path

## Scope

Select to limit your search results to one of the following scope

- Workspace
- Selected resources
- Enclosing Projects
- Working Set

Press Choose to select or create a working set.

Java search

Search