Matt: Apache uses findBugs to assist Apache developers to catch bugs in the
Apache code. Xeno's suggestion isn't for Apache developers, it's for our
users. It's intended to help Apache users write better code. I have used
annotations like this for years in my application code. They're very
helpful, especially when used with IntelliJ's "Constant Conditions and
Exceptions" code inspection. Adding it to Apache's code would not only help
me further, it would reduce the resistance I get from other developers. I
think it's a very good idea.

A lot of people have been using Optional to prevent NullPointerExceptions,
and many are now figuring out that it doesn't really help with that.
(That's not what Optional was invented for.) But it shows how there's a
hunger to address this issue in Java. The annotations suggested by Xeno are
a much better solution.

— Miguel Muñoz

P.S. This is a bit off-topic, but I have an essay where I keep track of
many different ways where Optional is used very badly, often adding new
ways to introduce bugs in our code. Anyone who's interested can find it at
https://github.com/SwingGuy1024/Blog/blob/master/Bad%20Uses%20of%20Optional.md

— MM

On Tue, Aug 25, 2020 at 6:45 AM Matt Sicker <boa...@gmail.com> wrote:

> We use the findbugs annotations fairly extensively in Jenkins, and with the
> proper plugins, it’s helped a lot for nullability checking.
>
> On Mon, Aug 24, 2020 at 23:54 Xeno Amess <xenoam...@gmail.com> wrote:
>
> > Hi.
> >
> > Today I see a pr have similar ideas with this, so I will suggest we
> >
> > consider it again.
> >
> > at [LANG-1598 <https://issues.apache.org/jira/browse/LANG-1598>]
> >
> > He suggest a google annotations repo, and I'd prefer the one from
> >
> > jetbrains, but that is not key point.
> >
> > Key point is, should we consider about adding such Annotations?
> >
> > Adding such annotations can help:
> >
> > 1. make people who want to modify the function sure whether each
> >
> > param/return value can be null, and make sure do not change it.
> >
> > It has better readability than any other ways.
> >
> > 2. make people who invoke these functions have a clear idea whether this
> >
> > function can return null.
> >
> > And more importantly maybe, let the ide also knows whether this function
> >
> > can return null.
> >
> > That will simplify a lot of human time to check.
> >
> >
> >
> > Any ideas?
> >
> >
> >
> > Xeno Amess <xenoam...@gmail.com> 于2020年4月24日周五 下午6:50写道:
> >
> >
> >
> > > I want to know about your opinions about @NotNull and @Nullable.
> >
> > >
> >
> > > Should we use it in every function?
> >
> > > Or we use it  only at some misleading places?
> >
> > > Or simply not use them at all?
> >
> > >
> >
> > > thx.
> >
> > >
> >
> > >
> >
> > --
> Matt Sicker <boa...@gmail.com>
>

Reply via email to