blob: 5d7de804c56f772f04af8c6b12422c26627f78bd [file] [view] [edit]
For `@Nullable` type annotations (such as
`org.checkerframework.checker.nullness.qual.Nullable`), `@Nullable byte[]` means
a 'non-null array of nullable bytes', and `byte @Nullable []` means a 'nullable
array of non-null bytes'. Since primitive types cannot be null, the former is
incorrect.
Some other nullness annotations (such as `javax.annotation.Nullable`) are
*declaration* annotations rather than *type* annotations. Their meaning is
different: For such annotations, `@Nullable byte[]` refers to 'a nullable array
of non-null bytes,' and `byte @Nullable []` is rejected by javac. Thus, this
check never reports errors for usages of declaration annotations.
See also: https://checkerframework.org/manual/#faq-array-syntax-meaning