Hi,
we have not yet discussed about that. At moment Lucene uses one custom
annotation "@SuppressForbidden") which is detected by the forbiddenapis
plugin based on pure class name (not package). Forbiddenapis
(https://github.com/policeman-tools/forbidden-apis) is a static analysis
tool used extensively in Lucene and related projects.
In general, I have no problems with adding those annotations, but it
should only be done on public APIs. Maybe open an issue for discussion
and a small mockup PR showing it for some classes like IndexSearcher or
IndexWriter.
Uwe
Am 06.12.2024 um 02:21 schrieb Evan Darke:
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.
--
Uwe Schindler
Achterdiek 19, D-28357 Bremen
https://www.thetaphi.de
eMail: u...@thetaphi.de
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org