abandon Guava Constraints ?

Cantor, Scott cantor.2 at osu.edu
Mon Jun 3 14:15:42 EDT 2013


> I think that annotating a returned Collection with @NonnullElements
> does not raise sufficient awareness that adding a null element to the
> Collection will result in an NPE.

Well, awareness and behavior are somewhat distinct. I think from a caller PoV, the annotation should be sufficient (along with just a general design note that I think we want all our collection APIs to be considered guarded now). But we definitely want guarded collections, IMHO.

> The Java Coding Conventions should be revised as they suggest use of
> our Assert class, which was later renamed to Constraint, which is
> different from a Guava Constraint.

I didn't remember that offhand. So the only place we use it is in some of the attribute code, I guess? We could rewrite those constraints ourselves.

If you're saying we shouldn't use guarded collections, I'm not sure I understand why.

-- Scott





More information about the dev mailing list