On Wed, Jan 5, 2011 at 3:50 PM, Smiley, David W. <dsmi...@mitre.org> wrote: > 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 late.
But, I think even w/ the sentinels we're going to have to have ifs here... > 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. This sounds awesome! So it could catch us if sometimes we return null from a @NotNull method? Mike --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org