Closed GoogleCodeExporter closed 8 years ago
The signature is intentional. (We discussed the issue at greater length than any
other issue in the entire library.)
Show me a place where "Function<Foo,Bar> can be used where a
Function<Object,Bar>
cannot" and, 9 times out of 10, I'll show you a broken API, which neglected the
wildcards it was obligated by the language to use. If that API can't be fixed
-- or
you're that other 1 out of 10 -- a cast is very easy:
@SuppressWarnings("unchecked")
Function<Foo, Bar> f = (Function) Functions.constant(aBar);
Impact:
1. that is a true concern. when users are forced to use GETPs* their code gets
very
ugly; we don't want to make it worse.
2. there is no way to throw CCE because the type information has been erased.
3. yes, it is fine.
*Goddamn Explicit Type Parameters
Original comment by kevin...@gmail.com
on 8 May 2009 at 6:50
Original comment by kevin...@gmail.com
on 11 May 2009 at 5:10
OK. thanks.
Original comment by gil...@gmail.com
on 11 May 2009 at 8:10
Original issue reported on code.google.com by
gil...@gmail.com
on 8 May 2009 at 6:38