Package org.eclipse.jdt.annotation

## Enum DefaultLocation

- java.lang.Object
- - java.lang.Enum<DefaultLocation>
  - - org.eclipse.jdt.annotation.DefaultLocation

All Implemented Interfaces:
  `Serializable`, `Comparable<DefaultLocation>`

    public enum DefaultLocation
    extends Enum<DefaultLocation>

Locations that can be affected by a `NonNullByDefault` annotation. Each constant of this enum describes a specific kind of type use. Wildcards and the use of type variables are always excluded from `NonNullByDefault`.

Since:
  2.0

### Enum Constant Summary

Enum Constants
`ARRAY_CONTENTS` Defines that a given `NonNullByDefault` annotation should affect all unannotated array components within the scope of the annotated declaration.
`FIELD` Defines that a given `NonNullByDefault` annotation should affect all unannotated field types within the scope of the annotated declaration.
`PARAMETER` Defines that a given `NonNullByDefault` annotation should affect all unannotated parameters of any method or constructor within the scope of the annotated declaration.
`RETURN_TYPE` Defines that a given `NonNullByDefault` annotation should affect all unannotated method return types within the scope of the annotated declaration.
`TYPE_ARGUMENT` Defines that a given `NonNullByDefault` annotation should affect all unannotated type arguments within the scope of the annotated declaration (except wildcards and type variables).
`TYPE_BOUND` Defines that a given `NonNullByDefault` annotation should affect all unannotated explicit type bounds within the scope of the annotated declaration.
`TYPE_PARAMETER` Defines that a given `NonNullByDefault` annotation should affect all unannotated type parameter declarations within the scope of the annotated declaration.

### Method Summary

All Methods Static Methods Concrete Methods
`static DefaultLocation` `valueOf​(String name)` Returns the enum constant of this type with the specified name.
`static DefaultLocation[]` `values()` Returns an array containing the constants of this enum type, in the order they are declared.

### Methods inherited from class java.lang.Enum

`clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

### Methods inherited from class java.lang.Object

`getClass, notify, notifyAll, wait, wait, wait`

### Enum Constant Detail

#### PARAMETER

    public static final DefaultLocation PARAMETER

Defines that a given `NonNullByDefault` annotation should affect all unannotated parameters of any method or constructor within the scope of the annotated declaration.

## Example

     @NonNullByDefault(PARAMETER)
     interface X {
         void print(Number n);
     }

Here `Number` will be interpreted as `@NonNull Number`.

#### RETURN_TYPE

    public static final DefaultLocation RETURN_TYPE

Defines that a given `NonNullByDefault` annotation should affect all unannotated method return types within the scope of the annotated declaration.

## Example

     @NonNullByDefault(RETURN_TYPE)
     interface X {
         Number getNumber();
     }

Here `Number` will be interpreted as `@NonNull Number`.

#### FIELD

    public static final DefaultLocation FIELD

Defines that a given `NonNullByDefault` annotation should affect all unannotated field types within the scope of the annotated declaration.

## Example

     @NonNullByDefault(FIELD)
     class X {
         Number number = Integer.MAX_VALUE;
     }

Here `Number` will be interpreted as `@NonNull Number`.

#### TYPE_PARAMETER

    public static final DefaultLocation TYPE_PARAMETER

Defines that a given `NonNullByDefault` annotation should affect all unannotated type parameter declarations within the scope of the annotated declaration.

## Example

     @NonNullByDefault(TYPE_PARAMETER)
     class X {
         <T> T identity(T t) { return t; }
     }

Here `<T>` will be interpreted as `<@NonNull T>`.

#### TYPE_BOUND

    public static final DefaultLocation TYPE_BOUND

Defines that a given `NonNullByDefault` annotation should affect all unannotated explicit type bounds within the scope of the annotated declaration. A type bound of type `Object` is never considered as an explicit bound, i.e., `T extends Object` is never affected by `NonNullByDefault`.

## Example

     @NonNullByDefault(TYPE_BOUND)
     interface X {
         <T extends Number> void process(T t, List<? super Number> l);
     }

Here both occurrences of `Number` will be interpreted as `@NonNull Number`.

#### TYPE_ARGUMENT

    public static final DefaultLocation TYPE_ARGUMENT

Defines that a given `NonNullByDefault` annotation should affect all unannotated type arguments within the scope of the annotated declaration (except wildcards and type variables).

## Example

     @NonNullByDefault(TYPE_ARGUMENT)
     interface X<T> {
         void process(List<T> tl, List<Number> nl);
     }

Here `Number` will be interpreted as `@NonNull Number`, but the use of type variable `T` is not affected.

#### ARRAY_CONTENTS

    public static final DefaultLocation ARRAY_CONTENTS

Defines that a given `NonNullByDefault` annotation should affect all unannotated array components within the scope of the annotated declaration.

## Example

     @NonNullByDefault(ARRAY_CONTENTS)
     interface X {
         Number[] n1;
         Number[][] n2;
     }

These declarations are interpreted as:

        @NonNull Number [] n1;
        @NonNull Number [] @NonNull[] n2;

I.e., both fields can still be `null` (see the unannotated left-most pair of brackets) but none of the contents of these arrays is allowed to be `null` (at any dimension).

### Method Detail

#### values

    public static DefaultLocation[] values()

Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

    for (DefaultLocation c : DefaultLocation.values())
        System.out.println(c);

Returns:
  an array containing the constants of this enum type, in the order they are declared

#### valueOf

    public static DefaultLocation valueOf​(String name)

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
  `name` - the name of the enum constant to be returned.
Returns:
  the enum constant with the specified name
Throws:
  `IllegalArgumentException` - if this enum type has no constant with the specified name
  `NullPointerException` - if the argument is null