tracylihui / google-collections

Automatically exported from code.google.com/p/google-collections
Apache License 2.0
0 stars 0 forks source link

Predicates.equalTo() should return a Predicate<Object> #297

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I also noticed a TODO comment in the source about this.
Any chance of this happening by 1.0?

Original issue reported on code.google.com by ray.a.co...@gmail.com on 13 Nov 2009 at 6:22

GoogleCodeExporter commented 9 years ago
Unfortunately, we probably can never fix equalTo(), isNull(), notNull(), 
alwaysTrue() 
and alwaysFalse() in this way.  There is simply way too much broken code, even 
just 
within Google, that would break (even more) if we did.  (Canonical example: a 
method 
that accepts Predicate<String> instead of Predicate<? super String> as it is 
required 
to. There are so many of those.)

To fix all that code would take more time than we have, so we'll just have to 
live 
with these being wrong.

All that said -- you should be okay with its current formulation.  You can 
always 
coerce Predicates.equalTo(someFoo) to Predicate<Object> either using

  Predicates.equalTo((Object) someFoo)

or

  Predicates.<Object>equalTo(someFoo)

or just by assigning it directly to a Predicate<Object>.

Original comment by kevin...@gmail.com on 13 Nov 2009 at 8:02