Closed spnda closed 3 years ago
Duplicated by #18 This problem is much more complex than just adding a new target and two lines of documentation. There are many questions to address, e.g.:
String getString()
in @NotNull
package, then implement it inside the @Nullable
package? Which resulting nullability should be used?interface X<T> {}
in @NotNull
package? Will all instantiations of T
be assumed as @NotNull
? What if we instantiate it inside the @Nullable
package?@NotNull
method parameters and return values into runtime assertions. It's quite difficult to implement this feature if you have @NotNull
in package declaration which is a separate file (and can be even separately compiled).I'm closing this, as we already have #18 to track the same problem.
When
@NotNull
and@Nullable
are used on a package declaration in apackage-info.class
, all fields in all classes should be not-nullable or nullable by default, respectively. Frameworks like Spring have had these annotations for a while (@NonNullFields
and@NonNullApi
, and would therefore not require any new implementation for many static analyzers). It might also be a bit better to make these new annotations, but that's up to you, reviewers.