Annotation Interface ParametricNullness


@Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER}) @TypeQualifierNickname @Nonnull(when=UNKNOWN) @interface ParametricNullness
Marks a "top-level" type-variable usage as the closest we can get to "non-nullable when non-nullable; nullable when nullable" (like the Android NullFromTypeParam).

Consumers of this annotation include:

  • Kotlin, for which it makes the type-variable usage (a) a Kotlin platform type when the type argument is non-nullable and (b) nullable when the type argument is nullable. We use this to "undo" ElementTypesAreNonnullByDefault.
  • J2ObjC
  • NullPointerTester, at least in the Android backport (where the type-use annotations NullPointerTester would need are not available) and in case of JDK-8202469