lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Smiley, David W." <>
Subject Re: Use of MultiFields.getFields() bad practice?
Date Wed, 05 Jan 2011 20:50:28 GMT
On Jan 5, 2011, at 1:35 PM, Uwe Schindler wrote:

> BUT:
> I am just upset about such code:
>      final DocIdSet dis = filter.getDocIdSet(reader);
>      if (dis == null)
>        return null;
>      final DocIdSetIterator disi = dis.iterator();
>      if (disi == null)
>        return null;
>      return new ConstantScorer(similarity, disi, this);
> (this is what I have seen during my work for ConstantScoreQuery)

Exactly.  I can't stand such code either.  Null has its place but it is often avoidable. 
Given that we're talking about trunk for a major version, I think it's definitely not too

It would be awesome if we had @NotNull, @Nullable, (and various threadsafe ones!), and used
FindBugs to validate various constraints.  There isn't yet a standard set in the JDK so some
projects like Apache Http components have their own in their own package.  FindBugs ignores
the package name (I know, I've checked).  We could do the same?  If this would be acceptable
then I could create a patch.

~ David Smiley
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message