abandon Guava Constraints ?
Tom Zeller
tzeller at dragonacea.biz
Mon Jun 3 13:34:07 EDT 2013
How do you feel about abandoning the use of Guava Constraints in IdPv3 ?
The Guava Constraints class is deprecated and scheduled for removal in
version 16, we are currently on 14. [1] There also have been comments
that Contraint is a "dead end". [2]
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. For example, the values of an
Attribute are constrained to be not null, and I wonder how many
existing v2 ScriptedAttributeDefinitions will throw NPEs in v3.
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.
Sigh, I was merely tracking down a silly NPE and then began
questioning returning constrained Collections.
[1] http://docs.guava-libraries.googlecode.com/git/javadoc/index.html?com/google/common/collect/Constraints.html
[2] http://code.google.com/p/guava-libraries/issues/detail?id=430#c8
More information about the dev
mailing list