I'm wondering if the Lucene community would be supportive of adopting
common annotations, such a @Nullable, to enable better static analysis for
downstream projects and within Lucene as well. Lucene makes extensive use
of nulls for performance reasons, but using this code can be prone to user
error.

Since most tools nowadays (e.g. Errorprone, NullAway, Intellij) will
recognize annotations based on their simple name, rather than the fully
qualified class name, it's possible to support this analysis without
introducing any third party dependencies. I would like to propose
annotating Lucene methods with "org.apache.lucene.annotations.Nullable"
where applicable, and perhaps similar for @MustBeClosed.

Reply via email to