diff --git a/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/NonNull.java b/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/NonNull.java index d76b2e3927c..aef7056e595 100644 --- a/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/NonNull.java +++ b/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/NonNull.java @@ -11,24 +11,25 @@ *******************************************************************************/ package org.eclipse.jdt.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - + /** - * Qualifier for a reference type in a {@link ElementType#TYPE_USE TYPE_USE} position: - * The type that has this annotation is intended to not include the value null. + * Qualifier for a type in a method signature or a local variable declaration: + * The entity (return value, parameter, field, local variable) whose type has this + * annotation can never have the value null at runtime. *

- * If annotation based null analysis is enabled using this annotation has two consequences: - *

+ * This has two consequences: *
    - *
  1. Dereferencing an expression of this type is safe, i.e., no NullPointerException can occur at runtime.
  2. - *
  3. An attempt to bind a null value to an entity (field, local variable, method parameter or method return value) - * of this type is a compile time error.
  4. + *
  5. Dereferencing the entity is safe, i.e., no NullPointerException can occur at runtime.
  6. + *
  7. An attempt to bind a null value to the entity is a compile time error.
  8. *
* For the second case, diagnostics issued by the compiler should distinguish three situations: *
    @@ -39,19 +40,12 @@ import java.lang.annotation.Target; *
  1. Nullness cannot be determined, because other program elements are involved for which * null annotations are lacking.
  2. *
- *

- * Note: Since org.eclipse.jdt.annotation 2.0.0, the - * @Target is {TYPE_USE}. For the old API, see - * - * @NonNull in 1.1.0. *

* @since 1.0 */ @Documented @Retention(RetentionPolicy.CLASS) - -// TODO: originally it's targer was TYPE_USE -@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE }) +@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE }) public @interface NonNull { - // marker annotation with no members + // marker annotation with no members } \ No newline at end of file diff --git a/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/Nullable.java b/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/Nullable.java index 82684bc4cb6..b0b5c3b5420 100644 --- a/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/Nullable.java +++ b/compiler/testData/foreignAnnotations/annotations/org/eclipse/jdt/annotation/Nullable.java @@ -11,37 +11,32 @@ *******************************************************************************/ package org.eclipse.jdt.annotation; -import java.lang.annotation.ElementType; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - + /** - * Qualifier for a reference type in a {@link ElementType#TYPE_USE TYPE_USE} position: - * The type that has this annotation explicitly includes the value null. + * Qualifier for a type in a method signature or a local variable declaration: + * The entity (return value, parameter, field, local variable) whose type has this + * annotation is allowed to have the value null at runtime. *

- * If annotation based null analysis is enabled using this annotation has two consequences: - *

- *
    - *
  1. Binding a null value to an entity (field, local variable, method parameter or method return value) - * of this type is legal.
  2. - *
  3. Dereferencing an expression of this type is unsafe, i.e., a NullPointerException can occur at runtime.
  4. - *
- *

- * Note: Since org.eclipse.jdt.annotation 2.0.0, the - * @Target is {TYPE_USE}. For the old API, see - * - * @Nullable in 1.1.0. + * This has two consequences: + *

*

* @since 1.0 */ @Documented @Retention(RetentionPolicy.CLASS) -// TODO: originally it's targer was TYPE_USE -@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE }) +@Target({ FIELD, METHOD, PARAMETER, LOCAL_VARIABLE }) public @interface Nullable { - // marker annotation with no members + // marker annotation with no members } \ No newline at end of file