Top Description Fields Constructors Methods
org.eclipse.jdt.annotation

public final Enum DefaultLocation

extends Enum<DefaultLocation>
Class Inheritance

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

Field Summary

Modifier and TypeField and Description
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.

public static final DefaultLocation
FIELD

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

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.

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.

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).

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.

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.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static DefaultLocation
public static DefaultLocation[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ARRAY_CONTENTSback to summary
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).

FIELDback to summary
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.

PARAMETERback to summary
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_TYPEback to summary
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.

TYPE_ARGUMENTback to summary
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.

TYPE_BOUNDback to summary
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 java.lang.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_PARAMETERback to summary
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>.

Constructor Detail

DefaultLocationback to summary
private DefaultLocation()

Method Detail

valueOfback to summary
public static DefaultLocation valueOf(String name)
valuesback to summary
public static DefaultLocation[] values()