Remove support for generics nullability for now

See https://github.com/Kotlin/KEEP/issues/79
This commit is contained in:
Sebastien Deleuze
2017-09-21 18:40:56 +02:00
parent 819ca0dbd4
commit 6c4a103f70
5 changed files with 7 additions and 24 deletions

View File

@@ -30,15 +30,13 @@ import javax.annotation.meta.TypeQualifierNickname;
* Leverages JSR 305 meta-annotations to indicate nullability in Java to common tools with
* JSR 305 support and used by Kotlin to infer nullability of Spring API.
*
* <p>Should be used at generic type argument, parameter, return value, and field level.
* <p>Should be used at parameter, return value, and field level.
* Methods overrides should repeat parent {@code @NonNull} annotations unless they behave
* differently.
*
* <p>Use {@code @NonNullApi} (scope = parameters + return values) and/or {@code @NonNullFields}
* (scope = fields) to set the default behavior to non-nullable in order to avoid annotating
* your whole codebase with {@code @NonNull}. No default retricted to generic type argument
* is possible ({@code ElementType.TYPE_USE} scope is too wide) so each generic type argument
* needs to be annotated with @code @NonNull}.
* your whole codebase with {@code @NonNull}.
*
* @author Sebastien Deleuze
* @author Juergen Hoeller
@@ -47,7 +45,7 @@ import javax.annotation.meta.TypeQualifierNickname;
* @see NonNullFields
* @see Nullable
*/
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE_USE, ElementType.FIELD})
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Nonnull

View File

@@ -30,15 +30,9 @@ import javax.annotation.meta.TypeQualifierDefault;
* Leverages JSR 305 meta-annotations to indicate nullability in Java to common tools with
* JSR 305 support and used by Kotlin to infer nullability of Spring API.
*
*
* <p>Should be used at package level in association with {@link Nullable}
* annotations at parameter and return value level.
*
* <p>This annotation does not define nullability of generic type arguments, because
* {@code @TypeQualifierDefault(ElementType.TYPE_USE)} scope would be too broad.
* As a consequence, each API generic type argument should be annotated
* with {@link Nullable} or {@link NonNull} to specify their nullability.
*
* @author Sebastien Deleuze
* @author Juergen Hoeller
* @since 5.0

View File

@@ -34,11 +34,6 @@ import javax.annotation.meta.TypeQualifierDefault;
* <p>Should be used at package level in association with {@link Nullable}
* annotations at field level.
*
* <p>This annotation does not define nullability of generic type arguments, because
* {@code @TypeQualifierDefault(ElementType.TYPE_USE)} scope would be too broad.
* As a consequence, each field generic type argument should be annotated
* with {@link Nullable} or {@link NonNull} to specify their nullability.
*
* @author Sebastien Deleuze
* @since 5.0
* @see NonNullFields

View File

@@ -30,7 +30,7 @@ import javax.annotation.meta.When;
* some circumstance. Leverages JSR 305 meta-annotations to indicate nullability in Java
* to common tools with JSR 305 support and used by Kotlin to infer nullability of Spring API.
*
* <p>Should be used at generic type argument, parameter, return value, and field level.
* <p>Should be used at parameter, return value, and field level.
* Methods overrides should repeat parent {@code @Nullable} annotations unless they behave
* differently.
*
@@ -44,7 +44,7 @@ import javax.annotation.meta.When;
* @see NonNullFields
* @see NonNull
*/
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE_USE, ElementType.FIELD})
@Target({ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Nonnull(when = When.MAYBE)