abandon Guava Constraints ?

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


> I am not questioning guarded collections, I am questioning
> implementation of them via a deprecated "dead-end" Guava class.

Clearly. I just wasn't sure what "abandon" meant.

> I was surprised by the behavior of @NonnullElements. The Javadoc says
> "does not contain any null elements" but does not say "throws an NPE
> if a null element is added" while the wiki documents @NonnullElements
> as "whether a collection may contain null elements or not". I think we
> should be really clear when dealing with NPEs.

Yes. The wiki implies to me the broader meaning but could still be clarified. The Javadoc seems just plain wrong unless was meant only to apply to input or output parameters (not collections one could mutate).

> We use Guava Constraints in a variety of places. If we used our
> Constraint rather than Guava's, then we could throw our
> ConstraintViolationException rather than an NPE.

I didn't find many, but I only spent 5 minutes searching.

> TL;DR Consider alternatives to deprecated Guava Constraints and
> improve documentation of @NonnullElements.

Agreed.

-- Scott




More information about the dev mailing list