public enum DefaultLocation extends Enum<DefaultLocation>
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.| Enum Constant and Description |
|---|
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. |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static final DefaultLocation PARAMETER
NonNullByDefault annotation should affect all unannotated
parameters of any method or constructor within the scope of the annotated declaration.
@NonNullByDefault(PARAMETER)
interface X {
void print(Number n);
}
Here Number will be interpreted as @NonNull Number.
public static final DefaultLocation RETURN_TYPE
NonNullByDefault annotation should affect all unannotated
method return types within the scope of the annotated declaration.
@NonNullByDefault(RETURN_TYPE)
interface X {
Number getNumber();
}
Here Number will be interpreted as @NonNull Number.
public static final DefaultLocation FIELD
NonNullByDefault annotation should affect all unannotated
field types within the scope of the annotated declaration.
@NonNullByDefault(FIELD)
class X {
Number number = Integer.MAX_VALUE;
}
Here Number will be interpreted as @NonNull Number.
public static final DefaultLocation TYPE_PARAMETER
NonNullByDefault annotation should affect all unannotated
type parameter declarations within the scope of the annotated declaration.
@NonNullByDefault(TYPE_PARAMETER)
class X {
<T> T identity(T t) { return t; }
}
Here <T> will be interpreted as <@NonNull T>.
public static final DefaultLocation TYPE_BOUND
NonNullByDefault annotation should affect all unannotated
explicit type bounds within the scope of the annotated declaration.
@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.
public static final DefaultLocation TYPE_ARGUMENT
NonNullByDefault annotation should affect all unannotated
type arguments within the scope of the annotated declaration (except wildcards and
type variables).
@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.
public static final DefaultLocation ARRAY_CONTENTS
NonNullByDefault annotation should affect all unannotated
array components within the scope of the annotated declaration.
@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).
public static DefaultLocation[] values()
for (DefaultLocation c : DefaultLocation.values()) System.out.println(c);
public static DefaultLocation valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is null
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.