Skip to content

Commit

Permalink
Remove support for generics nullability for now
Browse files Browse the repository at this point in the history
  • Loading branch information
sdeleuze committed Sep 21, 2017
1 parent 819ca0d commit 6c4a103
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,13 @@
* 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
Expand All @@ -47,7 +45,7 @@
* @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,9 @@
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
* <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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* 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.
*
Expand All @@ -44,7 +44,7 @@
* @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)
Expand Down
8 changes: 2 additions & 6 deletions src/docs/asciidoc/kotlin.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,8 @@ the default behavior in an upcoming release of Kotlin.

[NOTE]
====
Make sure to https://github.com/sdeleuze/spring-kotlin-functional/blob/2d6ac07adfc2b8f25e91681dbb2b58a1c6cdf9a7/build.gradle.kts#L57[include JSR-305 JAR]
until Kotlin 1.1.5 is released (it will fix https://youtrack.jetbrains.com/issue/KT-19419[KT-19419]).
Support for generic type arguments, varargs and array elements is still work in progress,
see https://youtrack.jetbrains.com/issue/KT-19592[KT-19592] and
https://youtrack.jetbrains.com/issue/IDEA-153093[IDEA-153093] for up-to-date
Generic type arguments, varargs and array elements nullability are not yet supported,
see https://github.com/Kotlin/KEEP/issues/79[this dicussion] for up-to-date
informations.
====

Expand Down

0 comments on commit 6c4a103

Please sign in to comment.